:root {
    --bg-dark: #0b0c15;       /* Fond très sombre */
    --sidebar-bg: #151926;    /* Fond sidebar */
    --card-bg: #1c2133;       /* Fond des cartes */
    --primary: #5e72e4;       /* Bleu moderne */
    --accent: #2dce89;        /* Vert succès */
    --danger: #f5365c;        /* Rouge danger */
    --warning: #fb6340;       /* Orange warning */
    --text-white: #ffffff;
    --text-gray: #8898aa;
    --border-radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }

body { background-color: var(--bg-dark); color: var(--text-white); height: 100vh; overflow: hidden; }

/* Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    background-color: var(--sidebar-bg);
    
    /* --- MODIFICATION ICI --- */
    /* On remplace "padding: 20px;" par la ligne ci-dessous. */
    /* Cela met 80px en haut, 20px à droite, 20px en bas, 20px à gauche. */
    padding: 80px 20px 20px 20px;
    
    display: flex;
    flex-direction: column;
    gap: 25px;
    border-right: 1px solid rgba(255,255,255,0.05);
    overflow-y: auto;
}

.brand {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-white);
    margin-bottom: 10px;
}
.brand .highlight { color: var(--primary); }

.sidebar-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-gray);
    letter-spacing: 1px;
    margin-bottom: 15px;
}

/* Map & Search */
.search-wrapper {
    position: relative;
    margin-bottom: 15px;
}
.search-wrapper input {
    width: 100%;
    background: #0b0c15;
    border: 1px solid #2b3553;
    padding: 10px 10px 10px 35px;
    border-radius: 5px;
    color: white;
    outline: none;
}
.search-icon {
    position: absolute;
    left: 10px; top: 12px;
    color: var(--text-gray);
}
.search-results {
    position: absolute;
    top: 100%; left: 0; width: 100%;
    background: var(--card-bg);
    border: 1px solid #2b3553;
    list-style: none;
    z-index: 1000;
}
.search-results li { padding: 10px; cursor: pointer; border-bottom: 1px solid #2b3553; }
.search-results li:hover { background: var(--primary); }
.hidden { display: none; }

#map-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    height: 200px;
    border: 2px solid #2b3553;
}
#map { height: 100%; width: 100%; }
.map-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,0.6);
    font-size: 0.7rem;
    padding: 4px;
    text-align: center;
    pointer-events: none;
    z-index: 999;
}

.coords-box {
    display: flex;
    justify-content: space-between;
    background: #0b0c15;
    padding: 8px;
    border-radius: 5px;
    margin-top: 10px;
    font-size: 0.8rem;
}
.coords-box .label { color: var(--text-gray); margin-right: 5px; }

/* Rules Inputs */
.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.rule-item label { font-size: 0.85rem; color: var(--text-gray); }
.rule-item input {
    width: 70px;
    background: #0b0c15;
    border: 1px solid #2b3553;
    color: white;
    padding: 5px;
    border-radius: 4px;
    text-align: center;
}

/* Buttons */
button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}
.btn-primary { background: var(--primary); color: white; margin-top: 10px; }
.btn-primary:hover { background: #4d60c6; }
.btn-secondary { background: transparent; border: 1px solid #2b3553; color: var(--text-gray); margin-top: 10px; }
.btn-secondary:hover { background: #2b3553; color: white; }


/* --- MAIN DASHBOARD --- */
.dashboard {
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Banner */
.status-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-radius: var(--border-radius);
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: background 0.3s;
}
.status-banner.go { background: linear-gradient(87deg, #2dce89 0, #2dcecc 100%); }
.status-banner.nogo { background: linear-gradient(87deg, #f5365c 0, #f56036 100%); }
.status-banner.waiting { background: linear-gradient(87deg, #172b4d 0, #1a174d 100%); border: 1px solid #2b3553; }

.status-left h1 { font-size: 1.8rem; margin-bottom: 5px; text-transform: uppercase; }
.status-left p { opacity: 0.9; font-size: 0.95rem; }

.score-circle {
    background: rgba(0,0,0,0.2);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: bold;
}
.score-circle small { font-size: 0.8rem; opacity: 0.7; }

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.kpi-card { display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.kpi-header { font-size: 0.75rem; color: var(--text-gray); font-weight: bold; letter-spacing: 0.5px; margin-bottom: 10px; }
.kpi-body { display: flex; align-items: center; gap: 15px; margin-bottom: 10px; }
.kpi-value { font-size: 1.6rem; font-weight: bold; }
.kpi-value small { font-size: 0.9rem; font-weight: normal; color: var(--text-gray); }
.kpi-footer { font-size: 0.8rem; color: var(--text-gray); }

.kpi-icon-bg { font-size: 3rem; position: absolute; right: -10px; bottom: -10px; opacity: 0.05; transform: rotate(-15deg); }
#weather-icon { font-size: 2rem; color: #ffce44; } /* Soleil jaune */

/* Compass Icon */
.wind-compass {
    width: 35px; height: 35px;
    border: 2px solid var(--text-gray);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    color: var(--primary);
    transition: transform 0.5s ease;
}

/* Charts & Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    flex-grow: 1;
}

.chart-section { min-height: 300px; display: flex; flex-direction: column; }
.chart-wrapper { flex-grow: 1; position: relative; width: 100%; }
.chart-section h3, .atmosphere-section h3 { font-size: 1rem; margin-bottom: 15px; color: var(--text-white); }
.chart-legend { text-align: center; font-size: 0.8rem; color: var(--text-gray); margin-top: 10px; }

/* Atmosphere List (Look de ton image) */
.data-list { list-style: none; }
.data-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}
.data-list li:last-child { border-bottom: none; }
.data-list .label { color: var(--text-gray); display: flex; align-items: center; gap: 10px; }
.data-list .value { font-weight: 600; color: var(--text-white); }
.data-list .separator { border-bottom: 1px solid rgba(255,255,255,0.1); margin: 5px 0; }

.source-tag {
    margin-top: auto;
    text-align: right;
    font-size: 0.7rem;
    color: var(--text-gray);
    padding-top: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container { grid-template-columns: 1fr; overflow-y: auto; height: auto; }
    .sidebar { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.1); height: auto; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .details-grid { grid-template-columns: 1fr; }
}

/* Bouton Agrandir - Positionné en bas à droite */
.map-expand-btn {
    position: absolute;
    bottom: 15px;       /* Marge du bas */
    right: 15px;        /* Marge de DROITE (c'est ça qui change tout) */
    z-index: 1000;      /* Pour être au-dessus de la carte */
    
    background-color: white;
    color: #333;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px; /* Coins légèrement arrondis comme les contrôles Leaflet */
    
    width: 34px;        /* Largeur fixe pour faire un carré */
    height: 34px;       /* Hauteur fixe */
    padding: 0;         /* Pas de padding interne pour centrer l'icône */
    
    display: flex;
    justify-content: center; /* Centre l'icône horizontalement */
    align-items: center;     /* Centre l'icône verticalement */
    
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4); /* Petite ombre pour le relief */
    font-size: 1rem;
    transition: all 0.2s;
}

.map-expand-btn:hover {
    background-color: #f4f4f4;
    transform: scale(1.05);
}

/* La classe pour agrandir la carte (ne change pas) */
.geoportail-wrapper.expanded {
    height: 700px !important;
}

/* Bouton Retour Accueil Flottant */
.btn-home-floating {
    position: fixed;       /* Fixe par rapport à l'écran */
    top: 20px;             /* Marge du haut */
    left: 20px;            /* Marge de gauche */
    z-index: 9999;         /* Au-dessus de tout le reste */
    
    background-color: #5e72e4; /* Bleu du thème (ou #333 pour du gris) */
    color: white;
    text-decoration: none;
    
    padding: 10px 20px;
    border-radius: 50px;   /* Bords très arrondis */
    font-family: 'Segoe UI', sans-serif;
    font-weight: bold;
    font-size: 0.9rem;
    
    display: flex;
    align-items: center;
    gap: 8px;              /* Espace entre l'icône et le texte */
    
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, background-color 0.2s;
}

.btn-home-floating:hover {
    transform: translateY(-3px); /* Petit effet de levée */
    background-color: #4558c4;   /* Bleu un peu plus foncé */
}