/* =========================================
   1. RESET ET FOND D'ÉCRAN
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --album-grid-bg: rgba(255,255,255,0.05);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0b1622;
    height: 100vh;
    padding: 20px;
    overflow: hidden;
}

/* Scrollbar globale thémée */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #4EA653; border-radius: 4px; }

/* =========================================
   2. LA GRILLE PRINCIPALE (50/50)
   ========================================= */
.dashboard-grid {
    height: 100%; 
    width: 100%;
}

.new-grid-layout {
    display: grid;
    grid-template-columns: minmax(300px, 45%) minmax(0, 1fr);
    grid-auto-rows: auto;
    gap: 20px;
    padding-bottom: 100px;
    overflow-y: auto;
}

.block-map { grid-column: 1 / 2; grid-row: 1 / 2; height: 450px; }
.block-rt { grid-column: 2 / 3; grid-row: 1 / 2; height: 450px; }
.block-g-temp { grid-column: 1 / 2; grid-row: 2 / 3; min-height: 350px; }
.block-g-wind { grid-column: 2 / 3; grid-row: 2 / 3; min-height: 350px; }
.block-g-precip { grid-column: 1 / 2; grid-row: 3 / 4; min-height: 350px; }
.block-gallery { grid-column: 2 / 3; grid-row: 3 / 4; height: 350px; }

.dashboard-block {
    background-color: #11202F;
    border-radius: 12px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    overflow: hidden;
}
.dashboard-block header { padding: 15px 20px; background: #11202F; border-bottom: 1px solid rgba(232, 237, 242, 0.15); color: white; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.dashboard-block header h2 { font-size: 16px; margin: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.gallery-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; padding: 15px; overflow-y: auto; flex: 1; min-height: 0; align-content: start; }
.gallery-item { display: flex; flex-direction: column; cursor: pointer; border-radius: 8px; background: transparent; transition: transform 0.2s; gap: 5px; }
.gallery-item:hover { transform: scale(1.03); }
.gallery-item img { width: 100%; height: auto; display: block; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.gallery-item span { text-align: center; font-size: 12px; color: #8BA3BB; font-weight: bold; display: block; padding: 5px; }

/* =========================================
   3. DESIGN DES BLOCS PRINCIPAUX
   ========================================= */
.bloc-historique, .carte-principale {
    background-color: #11202F; 
    border-radius: 12px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    overflow: hidden;
}

.bloc-graphiques {
    background-color: #11202F; 
    border-radius: 12px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    overflow: hidden;
    margin-top: 20px; 
    flex-shrink: 0;
}

.bloc-historique { height: 100%; min-height: 0; }
.carte-principale { flex-shrink: 0; }

/* =========================================
   4. LES EN-TÊTES (Headers)
   ========================================= */
.bloc-historique header, .carte-principale header, .bloc-graphiques header {
    padding: 20px;
    background: #11202F; 
    border-bottom: 1px solid rgba(232, 237, 242, 0.15);
    color: white;
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
}

.bloc-historique header h2, .carte-principale header h2, .bloc-graphiques header h2 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
}

.header-journal { display: flex; justify-content: space-between; align-items: center; }

.select-filtre {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    background-color: #11202F;
    font-size: 14px;
    font-weight: 600;
    color: #8BA3BB;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}
.select-filtre:hover { background-color: #4EA653; color: white; }
.select-filtre option { background-color: #11202F; color: #8BA3BB; }

.guest-station { color: white; }
body.light-mode .guest-station { color: #2c3e50; }

/* =========================================
   5. ZONES DE CONTENU
   ========================================= */
.zone-scrollable, .data-footer { background: transparent; color: #e0e0e0; }

.zone-graphique {
    background-color: transparent;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    padding: 15px;
    position: relative;
    flex: 1;
    min-height: 250px;
    width: 100%;
}

.zone-graphique canvas {
    display: block;
}

.zone-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; 
    min-height: 0; 
    scroll-behavior: smooth;
}

/* =========================================
   6. COLONNE DROITE : SCROLL ET MÉDIAS
   ========================================= */
.vue-principale {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto; 
    padding-right: 5px; 
    scroll-behavior: smooth;
}


.grande-photo { 
    max-width: 100%; 
    max-height: 100%; 
    width: auto; 
    height: auto;
    border-radius: 8px;
    border: 3px solid #4EA653;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    object-fit: contain; 
    transition: opacity 0.2s, transform 0.2s;
}

img.mini-photo { cursor: pointer; transition: opacity 0.2s; }
img.mini-photo:hover { opacity: 0.8; }
img.grande-photo:hover { opacity: 0.9; transform: scale(1.02); }

/* =========================================
   NOUVELLE SECTION TEMPS REEL
   ========================================= */
.rt-content { display: flex; flex-wrap: nowrap; padding: 15px; gap: 15px; height: 100%; overflow: hidden; }
.rt-left, .rt-right { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.rt-photo-box { flex: 1; position: relative; border-radius: 8px; overflow: hidden; background: transparent; display: flex; align-items: center; justify-content: center; }
.rt-date-box { flex: 0 0 35px; display: flex; align-items: center; justify-content: center; color: #8BA3BB; font-size: 14px; font-weight: bold; margin-top: 5px; }

/* =========================================
   7. LE JOURNAL (Bandeaux et Accordéon)
   ========================================= */
.bandeau-releve {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05); 
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 5px solid #4EA653; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
}
.bandeau-releve:hover { background: rgba(255, 255, 255, 0.1); }

.bandeau-media {
    display: flex;
    gap: 10px;
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease, margin-bottom 0.4s ease;
}

.bandeau-releve.active .bandeau-media {
    max-height: 200px; 
    opacity: 1;
    margin-bottom: 15px;
}

.mini-photo {
    flex: 1;
    min-width: 0;
    height: 200px;
    border-radius: 6px;
    background-color: transparent;
}
.mini-photo { object-fit: contain; }

.infos-releve {
    display: flex;
    gap: 30px;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: #e0e0e0;
    padding-bottom: 5px;
}

/* =========================================
   8. LES GRILLES MÉTÉO (Wunderground)
   ========================================= */
.meteo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 15px;
    margin-top: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.bandeau-releve .meteo-grid {
    display: none; 
    grid-template-columns: repeat(2, 1fr); 
    background: transparent; border: none; padding: 5px 0; margin-top: 5px; gap: 8px;
}
.bandeau-releve.active .meteo-grid { display: grid; }

.m-group { display: flex; flex-direction: column; border-right: 1px solid rgba(255, 255, 255, 0.1); padding: 0 5px; align-items: center; }
.m-group:last-child { border-right: none; }
.m-item { font-size: 14px; color: #f0f0f0; margin-bottom: 2px; }
.m-item b { color: #4EA653; font-size: 15px; }
.m-sub { font-size: 10px; color: #8BA3BB; text-transform: uppercase; letter-spacing: 0.5px; }

/* Séparateurs corrects pour la grille du journal (toujours 2 colonnes) */
.bandeau-releve .meteo-grid .m-group:nth-child(2n) { border-right: none !important; }

/* =========================================
   9. RESPONSIVE DESIGN (Mobiles)
   ========================================= */

.map-station-label { background: rgba(11, 22, 34, 0.85); color: white; border: 1px solid #4EA653; font-size: 12px; font-weight: bold; padding: 3px 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); border-radius: 4px; white-space: nowrap; }

@media screen and (max-width: 1200px) {
    .new-grid-layout { display: flex; flex-direction: column; }
    .block-rt { order: 1; height: auto; }
    .rt-content { flex-direction: column; overflow: visible; height: auto; }
    .block-map { order: 2; height: 350px; }
    .block-g-temp { order: 3; }
    .block-g-wind { order: 4; }
    .block-g-precip { order: 5; }
    .block-gallery { order: 6; height: 400px; }
    .album-layout { flex-direction: column; }
    .album-left { flex: none; width: 100%; height: fit-content; }
    .album-right { flex: none; width: 100%; height: fit-content; }
}

@media screen and (max-width: 950px) {
    body { height: auto; overflow-y: auto; padding: 10px; }
    .dashboard-grid { display: flex; flex-direction: column; gap: 20px; }
    .vue-principale { order: 1; overflow-y: visible; padding-right: 0; }
    .bloc-historique { order: 2; height: 600px; }

    /* Fix pour la section Temps Réel sur Mobile */
    .rt-content { flex-direction: column; height: auto; }
    .rt-left { order: 2; }
    .rt-right { order: 1; }
    .rt-photo-box { height: 300px; flex: none; width: 100%; }
    .rt-date-box { height: auto; padding: 10px 0; flex: none; margin-top: 0; }
    
    .meteo-grid { grid-template-columns: repeat(2, 1fr); }
    .meteo-grid.grid-preconisations .m-group:nth-child(2n) { border-right: none !important; }
    
    /* Fix pour le journal empilé */
    .bandeau-releve.active .bandeau-media { flex-direction: column; max-height: 550px; }
    .mini-photo { height: 250px; width: 100%; flex: none; }
    /* 8. Fix pour les en-têtes et les boutons trop larges sur mobile */
    .header-journal {
        flex-direction: column; /* Empile le titre et la zone des boutons */
        align-items: stretch; /* Étire le contenu sur toute la largeur */
        gap: 15px;
    }

    /* On cible la zone qui contient les deux sélecteurs du graphique */
    .header-journal > div {
        display: flex;
        flex-direction: column; /* Empile les boutons l'un sur l'autre */
        width: 100%;
        gap: 10px;
    }

    /* Les listes déroulantes prennent 100% de largeur UNIQUEMENT dans le journal/graphiques */
    .header-journal .select-filtre {
        width: 100%;
    }

    .top-actions {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center !important;
        gap: 10px;
    }
    .station-controls { 
        flex-wrap: nowrap; justify-content: flex-start; 
        width: auto; max-width: 100%; overflow-x: auto; 
        scrollbar-width: none; -ms-overflow-style: none; 
        gap: 2px; /* On réduit l'écart au minimum */
        padding: 4px 6px; /* On réduit le padding interne de la barre */
    }
    .station-controls::-webkit-scrollbar { display: none; }
    
    /* On compresse tous les boutons et sélecteurs dans la barre du haut */
    .station-controls .select-filtre,
    .station-controls .btn-ajouter,
    .station-controls .btn-supprimer {
        padding: 6px 8px !important; /* On réduit le padding horizontal */
    }
    .station-controls div[style*="margin: 0 5px;"] { margin: 0 1px !important; } /* On réduit la marge des séparateurs */
    .user-badge { gap: 4px; }
}
@media screen and (max-width: 450px) {
    .btn-text-mobile-hidden { display: none; }
}

/* Bouton d'ajout manuel de station */
.btn-ajouter {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    background-color: transparent;
    color: #8BA3BB;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0; /* Empêche le bouton de s'écraser si l'écran est petit */
}

.btn-ajouter:hover {
    background-color: #4EA653;
    color: white;
}

/* Bouton de suppression de station */
.btn-supprimer {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    background-color: transparent;
    color: #8BA3BB;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-supprimer:hover { background-color: #e74c3c; color: white; }

/* =========================================
   10. BARRE DE MENU FLOTTANTE ET MODALES
   ========================================= */
.bottom-nav-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background-color: #11202F;
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 1000;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: transparent;
    color: #8BA3BB;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap; /* Force le texte sur une seule ligne même sur tablette */
}

.nav-btn:hover, .nav-btn.active { background-color: #4EA653; color: white; }

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000; display: none; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: #11202F; border: 1px solid #4EA653; border-radius: 12px;
    padding: 20px; width: 95%; max-width: 950px; color: white;
    display: flex; flex-direction: column; gap: 15px; position: relative;
}
#modal-album .modal-content, #modal-timelapse .modal-content { max-width: 750px; }

.modal-close {
    position: absolute; top: 15px; right: 20px; font-size: 28px;
    color: #e0e0e0; cursor: pointer; line-height: 1;
    z-index: 10;
}
.modal-close:hover { color: #4EA653; }

.album-layout { display: flex; gap: 15px; width: 100%; align-items: center; justify-content: center; }
.album-left { flex: 0 0 360px; display: flex; flex-direction: column; min-width: 0; height: fit-content; }
.album-right {background: transparent; padding: 0; display: flex; flex-direction: column; justify-content: flex-start; height: fit-content; }

.album-meteo-grid {
    grid-template-columns: repeat(2, 1fr);
    background: transparent;
    border: none;
    padding: 0;
    gap: 15px;
    margin-top: 5px;
}
.album-meteo-grid .album-val { font-size: 22px; }
.album-meteo-grid .m-sub { font-size: 12px; }
.album-meteo-grid .m-group:nth-child(2n) { border-right: none; }
body.light-mode .album-meteo-grid .m-group:nth-child(2n) { border-right: none; }

@media screen and (max-width: 768px) {
    .album-meteo-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
    .album-meteo-grid .album-val { font-size: 15px; }
    .album-meteo-grid .m-item i { font-size: 13px; }
    .album-meteo-grid .m-sub { font-size: 9px; letter-spacing: 0; }
    /* La règle de padding spécifique pour mobile n'est plus nécessaire */
    .album-meteo-grid .m-group:nth-child(2n) {
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }
    body.light-mode .album-meteo-grid .m-group:nth-child(2n) {
        border-right: 1px solid rgba(0, 0, 0, 0.12);
    }
    .album-meteo-grid .m-group:last-child { border-right: none !important; }
}

.modal-header {
    margin: -20px -20px 0 -20px;
    padding: 20px;
    background: #0b1622;
    border-radius: 11px 11px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 45px; /* Empêche le texte de passer sous la croix */
}

.modal-header h3 { margin: 0; color: white; font-size: 18px; font-weight: 600; }

.album-viewer {
    width: 100%;
    background: transparent; border-radius: 8px; position: relative;
    display: flex; justify-content: center; align-items: center; overflow: hidden;
}
.album-viewer img { 
    width: 100%; height: auto; max-height: 65vh; object-fit: contain; 
    cursor: zoom-in; transition: transform 0.3s ease; 
}

.photo-date-overlay {
    position: static; transform: none; width: 100%; text-align: center;
    background: rgba(0,0,0,0.3); padding: 8px 20px; border-radius: 8px; font-size: 15px; font-weight: bold; color: #8BA3BB;
}

.album-controls, .timelapse-config {
    display: flex; justify-content: center; align-items: center; gap: 15px; flex-wrap: wrap;
}

.album-controls button, .timelapse-config button {
    background: #11202F; color: #8BA3BB; border: 1px solid rgba(232, 237, 242, 0.15);
    padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: bold;
    transition: all 0.2s ease;
}
.header-btn { background: #11202F; color: #8BA3BB; border: 1px solid rgba(232, 237, 242, 0.15); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 13px; transition: all 0.2s; white-space: nowrap; }
.header-btn:hover { background: #4EA653; color: white; border-color: #4EA653; }

.album-controls button:hover, .timelapse-config button:hover { background: #4EA653; color: white; }

.album-controls button:disabled,
.album-controls button:disabled:hover {
    background-color: #1a2c3d;
    color: #8BA3BB;
    border-color: #1a2c3d;
    cursor: not-allowed;
}

.album-controls input, .timelapse-config input, .timelapse-config select {
    padding: 8px; border-radius: 6px; border: 1px solid rgba(232, 237, 242, 0.15); background: #0b1622; color: #8BA3BB;
}

/* =========================================
   11. RESPONSIVE MODALES (Mobiles)
   ========================================= */
@media screen and (max-width: 768px) {
    .bottom-nav-bar { 
        width: 95%; 
        justify-content: center; 
        padding: 6px 8px; 
        bottom: 15px; 
        flex-wrap: nowrap; 
        border-radius: 25px; 
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 3px;
    }
    .bottom-nav-bar::-webkit-scrollbar { display: none; }
    .nav-btn { padding: 6px 8px; font-size: 12px; gap: 4px; flex: 0 0 auto; justify-content: center; white-space: nowrap; }

    .modal-content { padding: 15px; width: 95%; gap: 10px; }
    .modal-header { margin: -15px -15px 0 -15px; padding: 12px 15px; padding-right: 40px; }
    .modal-header h3 { font-size: 15px; }
    .modal-close { top: 10px; right: 15px; font-size: 24px; }

    .album-viewer { height: auto; min-height: 0; }
    .photo-date-overlay { font-size: 13px; padding: 6px 10px; }

    .album-controls { gap: 10px; justify-content: space-between; }
    /* On met le sélecteur de date au dessus, et on sépare les boutons 50/50 en dessous */
    .album-controls input { flex: 1 1 100%; order: -1; text-align: center; font-size: 16px; }
    .album-controls button { flex: 1 1 45%; padding: 12px 5px; font-size: 14px; }

    .timelapse-config { flex-direction: column; align-items: stretch; gap: 10px; }
    /* On étire le formulaire pour que ça soit confortable au doigt */
    .timelapse-config label { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: bold; color: #4EA653; }
    .timelapse-config input, .timelapse-config select { width: 65%; padding: 10px; font-size: 15px; }
    .timelapse-config button { width: 100%; padding: 15px; font-size: 16px; margin-top: 10px; }
}

/* =========================================
   12. PAGE DE CONNEXION ET UTILISATEUR
   ========================================= */
.top-actions {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: none; /* Permet de cliquer à travers l'espace vide */
}

.top-actions > * {
    pointer-events: auto; /* Réactive les clics sur les boutons eux-mêmes */
}

.station-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #11202F;
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(232, 237, 242, 0.15);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* Masque tous les éléments sauf le bouton collapse et l'utilisateur quand le menu est enroulé */
.station-controls.collapsed > *:not(.btn-collapse):not(.user-menu-container) {
    display: none !important;
}

.user-menu-container {
    position: relative;
}

.user-badge {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8BA3BB;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-badge:hover {
    background-color: rgba(255,255,255,0.1);
}

.user-dropdown {
    display: none; /* Caché par défaut */
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background-color: #11202F;
    border: 1px solid rgba(232, 237, 242, 0.15);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    width: 220px;
    z-index: 1001;
    overflow: hidden;
}

.user-dropdown.show {
    display: block;
}

/* Fix pour mobile : sort le menu du conteneur pour éviter qu'il soit masqué par le scroll horizontal */
@media screen and (max-width: 950px) {
    .user-dropdown {
        position: fixed;
        top: 55px;
        right: 15px;
    }
}

.dropdown-header {
    padding: 10px 15px;
    font-weight: bold;
    color: white;
    background-color: #0b1622;
    border-bottom: 1px solid rgba(232, 237, 242, 0.15);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #8BA3BB;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s, color 0.2s;
}
.dropdown-item i { width: 16px; text-align: center; }
.dropdown-item:hover {
    background-color: #4EA653;
    color: white;
}
.user-badge i.fa-user, .user-badge i.fa-user-shield { color: #8BA3BB; }
.user-badge a { color: #e74c3c; text-decoration: none; transition: transform 0.2s; }
.user-badge a:hover { transform: scale(1.2); }

/* Masquer l'email (nom d'utilisateur) sur tous les appareils */
.username-text { display: none; }

.login-box {
    background: #11202F;
    border: 1px solid rgba(232, 237, 242, 0.15);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    width: 100%;
    max-width: 400px;
    color: white;
}
.login-box h2 { color: #4EA653; margin-bottom: 10px; font-size: 24px; }
.login-box p { color: #8BA3BB; margin-bottom: 25px; font-size: 14px; }
.login-input {
    width: 100%; padding: 12px 15px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2); background: rgba(0,0,0,0.3);
    color: white; font-size: 16px; margin-bottom: 20px;
    outline: none; text-align: center;
}
.login-input:focus { border-color: #4EA653; }
.login-btn {
    width: 100%; padding: 12px; border-radius: 8px; border: 1px solid rgba(232, 237, 242, 0.15);
    background: transparent; color: #8BA3BB; font-size: 16px; font-weight: bold;
    cursor: pointer; transition: all 0.3s ease;
}
.login-btn:hover { background: #4EA653; color: white; transform: scale(1.02); }

/* =========================================
   13. MODE CLAIR (Thème Beige Foncé)
   ========================================= */
body.light-mode { background-color: #e4dfcf; color: #2c3e50; --album-grid-bg: rgba(0,0,0,0.04); }
body.light-mode .bloc-historique, body.light-mode .carte-principale, body.light-mode .bloc-graphiques,
body.light-mode .task-card, body.light-mode .login-box, body.light-mode .modal-content, body.light-mode .dashboard-block,
body.light-mode .bottom-nav-bar, body.light-mode .station-controls { background-color: #f7f5f0; border-color: rgba(0,0,0,0.15); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
body.light-mode .bloc-historique header, body.light-mode .carte-principale header, body.light-mode .dashboard-block header,
body.light-mode .bloc-graphiques header, body.light-mode .modal-header { background-color: #ece8dd; border-bottom: 1px solid rgba(0,0,0,0.15); color: #2c3e50; }
body.light-mode .bloc-historique header h2, body.light-mode .carte-principale header h2, body.light-mode .dashboard-block header h2,
body.light-mode .bloc-graphiques header h2, body.light-mode .modal-header h3 { color: #2c3e50; }
body.light-mode .zone-scrollable, body.light-mode .data-footer, body.light-mode .m-item, 
body.light-mode .task-title, body.light-mode .crit-val { color: #2c3e50; }
body.light-mode .bandeau-releve, body.light-mode .meteo-grid, body.light-mode .criterion, body.light-mode .forecast-item { background: #ffffff; border: 1px solid rgba(0,0,0,0.12); }
body.light-mode .gallery-item { background: transparent; border-color: transparent; }
body.light-mode .gallery-item img { box-shadow: 0 2px 8px rgba(0,0,0,0.15); background: transparent; }
body.light-mode .gallery-item span { background: transparent; color: #2c3e50; border-top-color: transparent; }
body.light-mode .album-right { background: transparent; }
body.light-mode .bandeau-releve:hover, body.light-mode .forecast-item:hover { background: #ece8dd; }
body.light-mode .m-group { border-right: 1px solid rgba(0,0,0,0.12); }
body.light-mode .m-group:last-child { border-right: none; }
body.light-mode .infos-releve, body.light-mode .m-sub, body.light-mode .login-box p, body.light-mode p[style*="color: #8BA3BB"] { color: #5c6b7a !important; }
body.light-mode .select-filtre, body.light-mode .login-input, body.light-mode .album-controls input, 
body.light-mode .timelapse-config input, body.light-mode .timelapse-config select,
body.light-mode .album-controls button, body.light-mode .timelapse-config button, body.light-mode .header-btn { background-color: #ffffff; color: #2c3e50; border: 1px solid rgba(0,0,0,0.2); }
body.light-mode .nav-btn, body.light-mode .btn-ajouter, body.light-mode .btn-supprimer, 
body.light-mode .login-btn, body.light-mode .btn-previsions { color: #2c3e50; border: 1px solid rgba(0,0,0,0.2); }
body.light-mode .nav-btn:hover, body.light-mode .nav-btn.active, body.light-mode .btn-ajouter:hover, body.light-mode .btn-previsions:hover, body.light-mode .album-controls button:hover, body.light-mode .timelapse-config button:hover, body.light-mode .header-btn:hover, body.light-mode .login-btn:hover { background-color: #4EA653; color: white; border-color: #4EA653; }
body.light-mode .btn-supprimer:hover { background-color: #e74c3c; color: white; border-color: #e74c3c; }
body.light-mode .album-controls button:disabled, body.light-mode .album-controls button:disabled:hover { background-color: #f0f0f0; color: #a0a0a0; border-color: #d0d0d0; cursor: not-allowed; }
body.light-mode .rt-map-overlay { background: #ffffff; }
body.light-mode .photo-date-overlay { background: rgba(0,0,0,0.05); color: #2c3e50; }
body.light-mode .modal-close { color: #2c3e50; }
body.light-mode .criterion::after { background: #ffffff; color: #2c3e50; }
body.light-mode .m-group div[style*="color: white"], body.light-mode .forecast-header-item span[style*="color:white"] { color: #2c3e50 !important; }
body.light-mode .station-controls div[style*="background: rgba(255,255,255,0.2)"], body.light-mode .bottom-nav-bar div[style*="background: rgba(255,255,255,0.2)"] { background: rgba(0,0,0,0.2) !important; }
body.light-mode .task-header { border-bottom: 1px solid rgba(0,0,0,0.1); }
body.light-mode .forecast-details { border-top: 1px solid rgba(0,0,0,0.1); }
body.light-mode select option, body.light-mode .select-filtre option { background-color: #ffffff; color: #2c3e50; }
body.light-mode .user-badge:hover { background-color: rgba(0,0,0,0.05); }
body.light-mode .user-dropdown {
    background-color: #f0f3f6;
    border-color: rgba(0,0,0,0.1);
}
body.light-mode .dropdown-header {
    background-color: #e9ecef;
    color: #2c3e50;
    border-bottom-color: rgba(0,0,0,0.1);
}
body.light-mode .dropdown-item { color: #2c3e50; }
body.light-mode .dropdown-item:hover { background-color: #4EA653; color: white; }
body.light-mode .grande-photo { background: rgba(0,0,0,0.05); }

/* =========================================
   14. PANNEAU ADMINISTRATEUR
   ========================================= */
.admin-dashboard-wrapper { display: block; height: 100%; overflow-y: auto; padding: 20px; }
.admin-container { margin: 0 auto; padding: 40px; text-align: center; width: 100%; max-width: 1100px; height: auto; }
.admin-main-title { color: #4EA653; margin-bottom: 40px; font-size: 36px; }
.admin-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; border: none; background: transparent; margin-bottom: 50px; }
.admin-stat-icon { font-size: 60px; margin-bottom: 20px; }
.admin-stat-label { color: #4EA653; font-size: 18px; margin-top: 10px; font-weight: 600; }
.admin-stat-card { background: #11202F; padding: 40px 20px; border-radius: 16px; border: 1px solid rgba(232, 237, 242, 0.15); box-shadow: 0 10px 20px rgba(0,0,0,0.5); }
.admin-stat-val { font-size: 54px; font-weight: bold; color: white; }
.admin-table-container { background: rgba(0,0,0,0.2); padding: 30px; border-radius: 16px; border: 1px solid rgba(232, 237, 242, 0.1); text-align: left; }
.admin-table-title { margin-bottom: 20px; font-size: 22px; color: white; display: flex; align-items: center; gap: 10px; }
.admin-table-title i { color: #8BA3BB; }
.admin-id { color: #8BA3BB; }
.admin-connexions-badge { background: rgba(255,255,255,0.1); padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: bold; }
.admin-no-action { color: #8BA3BB; font-size: 13px; font-style: italic; }
.admin-empty { text-align: center; color: #8BA3BB; padding: 20px; }

.admin-select-station { background: rgba(0,0,0,0.3); color: #e0e0e0; border: 1px solid rgba(255,255,255,0.2); padding: 4px 8px; border-radius: 4px; outline: none; font-size: 13px; max-width: 120px; }
.admin-select-station option { background: #11202F; }
.admin-btn-action { background: transparent; color: #8BA3BB; border: 1px solid rgba(255,255,255,0.2); padding: 4px 8px; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.admin-btn-action:hover { background: #4EA653; color: white; border-color: #4EA653; }
.admin-btn-action.del:hover { background: #e74c3c; border-color: #e74c3c; }

.admin-table { width: 100%; border-collapse: collapse; color: #e0e0e0; text-align: left; font-size: 14px; }
.admin-table th { padding: 12px 15px; border-bottom: 2px solid rgba(255,255,255,0.1); color: #8BA3BB; font-weight: 600; white-space: nowrap; }
.admin-table td { padding: 12px 15px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.admin-table tr:hover { background: rgba(255,255,255,0.02); }
.btn-upgrade { background: #4EA653; color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: bold; transition: background 0.2s; white-space: nowrap; }
.btn-upgrade:hover { background: #3d8b40; }

body.light-mode .admin-stat-card { background: #ffffff; border-color: rgba(0,0,0,0.1); box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
body.light-mode .admin-stat-val { color: #2c3e50; }
body.light-mode .admin-table-container { background: #ffffff; border-color: rgba(0,0,0,0.1); }
body.light-mode .admin-table-title { color: #2c3e50; }
body.light-mode .admin-table-title i { color: #4EA653; }
body.light-mode .admin-id { color: #666; }
body.light-mode .admin-connexions-badge { background: rgba(0,0,0,0.05); color: #2c3e50; }
body.light-mode .admin-no-action { color: #666; }
body.light-mode .admin-empty { color: #666; }
body.light-mode .admin-select-station { background: white; color: #2c3e50; border-color: rgba(0,0,0,0.2); }
body.light-mode .admin-select-station option { background: white; }
body.light-mode .admin-btn-action { color: #2c3e50; border-color: rgba(0,0,0,0.2); }
body.light-mode .admin-btn-action:hover { background: #4EA653; color: white; border-color: #4EA653; }
body.light-mode .admin-btn-action.del:hover { background: #e74c3c; color: white; border-color: #e74c3c; }
body.light-mode .admin-table { color: #2c3e50; }
body.light-mode .admin-table th { border-bottom: 2px solid rgba(0,0,0,0.1); color: #2c3e50; }
body.light-mode .admin-table td { border-bottom: 1px solid rgba(0,0,0,0.05); }
body.light-mode .admin-table tr:hover { background: rgba(0,0,0,0.02); }

/* Adaptations Mobiles du Panneau Admin */
@media screen and (max-width: 950px) {
    .admin-dashboard-wrapper { padding: 10px; }
    .admin-container { padding: 20px 10px; }
    .admin-main-title { font-size: 26px; margin-bottom: 25px; }
    .admin-stats-grid { grid-template-columns: 1fr; gap: 15px; margin-bottom: 30px; }
    .admin-stat-card { padding: 20px 15px; }
    .admin-stat-icon { font-size: 40px; margin-bottom: 10px; }
    .admin-stat-val { font-size: 36px; }
    .admin-stat-label { font-size: 15px; }
    .admin-table-container { padding: 15px 10px; }
    .admin-table-title { font-size: 18px; margin-bottom: 15px; }
    .admin-table th, .admin-table td { padding: 10px 8px; font-size: 12px; }
    .admin-select-station { max-width: 80px; padding: 4px; }
    .admin-btn-action { padding: 4px 6px; }
    .btn-upgrade { font-size: 11px; padding: 6px 8px; white-space: normal; }
}

/* =========================================
   15. TOGGLE AIR / SOL & OVERLAYS CAPTEURS
   ========================================= */
.air-sol-switch { display: flex; align-items: center; gap: 8px; }
.switch-label { font-size: 14px; font-weight: bold; color: #8BA3BB; transition: color 0.3s; }
.switch-label.active { color: white; }
.switch-label.locked { color: #555; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #3498db; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #e67e22; }
input:checked + .slider:before { transform: translateX(20px); }
.switch.locked .slider { background-color: #333; cursor: not-allowed; }

.disabled-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(11, 22, 34, 0.7); z-index: 10; display: flex; align-items: center; justify-content: center; }
.disabled-content { opacity: 0.4; filter: grayscale(50%); transition: all 0.3s; }

body.light-mode .switch-label.active { color: #2c3e50; }
body.light-mode .switch-label.locked { color: #ccc; }
body.light-mode .switch.locked .slider { background-color: #ddd; }
body.light-mode .disabled-overlay { background: rgba(0, 0, 0, 0.15); }
body.light-mode .disabled-content { opacity: 0.7; filter: grayscale(30%); }