#map { flex-grow: 1; width: 100%; z-index: 10; background: #f1f5f9; }

/* Popups */
.leaflet-popup-content-wrapper { padding: 0 !important; border-radius: 8px !important; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5) !important; background: transparent !important; overflow: hidden; }
.leaflet-popup-content { margin: 0 !important; line-height: 1.5; }
/* Force la visionneuse photo/topo à passer au-dessus de TOUTES les modales */
#photo-lightbox-modal {
    z-index: 99999 !important;
}

/* On isole la largeur de 700px uniquement sur la grande fiche technique */
.transmitter-large-popup .leaflet-popup-content { width: 700px !important; max-width: 95vw !important; }
@media (max-width: 767px) { 
    .transmitter-large-popup .leaflet-popup-content { width: 285px !important; } 
    .leaflet-popup-content { width: 300px !important; }
}
.leaflet-popup-tip { background-color: #ffffff !important; box-shadow: 0 10px 20px rgba(0,0,0,0.2) !important; }
.leaflet-container a.leaflet-popup-close-button { color: #cbd5e1 !important; font-weight: bold; top: 12px; right: 12px; z-index: 10; font-size: 16px;}
.leaflet-container a.leaflet-popup-close-button:hover { color: #ffffff !important; background: transparent;}

/* Fix mobile : le menu de calques ne doit jamais dépasser l'écran et doit scroller */
@media (max-width: 767px) {
    .leaflet-control-layers-expanded {
        max-height: 50vh !important; /* On limite à 50% de l'écran pour laisser place aux crédits */
        overflow-y: auto !important;
        font-size: 11px !important; /* Légèrement plus petit sur mobile */
    }
}

/* La légende Leaflet doit toujours survoler les crédits */
.leaflet-bottom.leaflet-right {
    z-index: 1000 !important;
}
.leaflet-control-layers {
    z-index: 1001 !important; /* Toujours au-dessus des crédits */
}

/* Sidebar & Layout */
header { z-index: 2000 !important; }
#info-panel { z-index: 3000 !important; }
#menu-overlay { z-index: 4000 !important; }
#sidebar { transition: transform 0.3s ease-in-out; z-index: 4500 !important; }
.sidebar-open { transform: translateX(0); }
.sidebar-closed { transform: translateX(-100%); }
.leaflet-top.leaflet-right { top: 10px !important; z-index: 1000 !important; }

.menu-scroll::-webkit-scrollbar { width: 4px; }
.menu-scroll::-webkit-scrollbar-thumb { background: #475569; border-radius: 10px; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Rasters & Map Layers */
.pixelated-layer { 
    image-rendering: -webkit-optimize-contrast !important; 
    image-rendering: crisp-edges !important; 
    image-rendering: pixelated !important; 
}
.leaflet-coverage-pane { pointer-events: none !important; }

/* Légende thématique (recherche de signal) */
.legend-box { 
    position: absolute; bottom: 70px; right: 20px; background: rgba(15, 23, 42, 0.95); 
    padding: 10px; border-radius: 8px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5); 
    z-index: 1100; font-size: 10px; border: 1px solid #334155; color: #cbd5e1; 
    width: auto; max-width: 200px; 
}
@media (max-width: 767px) { 
    /* CORRECTION : On descend la légende au ras du bas de la carte sur mobile */
    .legend-box { bottom: 150px !important; right: 12px; padding: 10px; max-width: 200px; max-height: 40vh; overflow-y: auto; } 
}
.legend-item { display: flex; align-items: center; margin-bottom: 3px; font-weight: bold; }
.legend-color { width: 14px; height: 14px; margin-right: 8px; border-radius: 2px; }

/* Correction pour la légende d'accueil de la carte globale */
#global-legend {
    z-index: -10;
}

@media (max-width: 767px) {
    #global-legend {
        border-radius: 12px !important;
        min-width: 160px;
    }
    #global-legend span.w-3 {
        width: 10px !important;
        height: 10px !important;
    }
}
.svg-marker { background: transparent; border: none; }

/* Modale Plein Écran Mobile (Remplace l'ancienne popup Leaflet) */
@media (max-width: 767px) {
    /* 1. On annule l'effet "carte volante" */
    #popup-container { 
        height: 100% !important; 
        max-height: none !important;
        border-radius: 0 !important; 
        box-shadow: none !important; 
        display: flex !important; 
        flex-direction: column !important; 
        flex: 1 !important;
    }
    
    /* 2. LA CORRECTION EST ICI : On ajoute :not(.hidden) pour respecter les onglets */
    #pop-tab-cont-details:not(.hidden) { 
        display: flex !important; 
        flex-direction: column !important; 
        flex: 1 !important; 
        min-height: 0 !important; 
    }
    
    /* 3. On autorise la liste à défiler jusqu'au bout de l'écran */
    #pop-tab-cont-details > div { 
        max-height: none !important; 
        flex: 1 !important; 
        overflow-y: auto !important; 
        padding-bottom: 24px; 
    }
    
    /* 4. CORRECTION ICI AUSSI : Pareil pour l'onglet Topo */
    #pop-tab-cont-topo:not(.hidden) { 
        display: flex !important; 
        flex-direction: column !important;
        flex: 1 !important; 
        overflow-y: auto !important; 
        padding-bottom: 24px;
    }
}

/* --- SURIMPRESSION PC ET DÉFILEMENT --- */
@media (min-width: 768px) {
    #pc-map-overlay-content #pop-tab-cont-details { display: flex !important; flex-direction: column !important; flex: 1 !important; overflow: hidden !important; }
    #pc-map-overlay-content #pop-tab-cont-details > div { max-height: none !important; flex: 1 !important; overflow-y: auto !important; }
    #pc-map-overlay-content #pop-tab-cont-topo { flex: 1 !important; overflow-y: auto !important; }
}
/* --- LOGIQUE ANTI-ADBLOCK --- */
.adsbygoogle[data-ad-status="unfilled"], .adsbygoogle:empty { height: 0px !important; display: none !important; }

/* Ajustement exact du bouton partager sur le bouton de calques Leaflet */
#map-share-button a { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.leaflet-touch #map-share-button a { width: 44px; height: 44px; }

/* Empêche le menu de toucher le bas de l'écran et de passer sous les crédits */
.leaflet-control-layers-expanded {
    max-height: 70vh !important;
    overflow-y: auto !important;
    z-index: 1500; /* Higher than default container */

}

.leaflet-image-layer, .leaflet-tile-pane img {
    -webkit-user-drag: none !important; /* Empêche le glisser-déposer vers le bureau */
    user-select: none !important;
    pointer-events: none !important; /* Rend l'image "fantôme" au clic */
}

/* Styles spécifiques pour animer l'apparition des onglets de la modale d'aide */
    @keyframes fadeInModal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    .animate-fadeIn { animation: fadeInModal 0.3s ease-out forwards; }

    .leaflet-control-layers {
    z-index: 99999 !important;
}