/* ==========================================================================
   1. RESET ET LAYOUT (PLEINE PAGE)
   ========================================================================== */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

.map-container {
    width: 100%;
    height: calc(100vh - 60px - 50px);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

@media(min-width: 1024px) {
    .map-container {
        height: calc(100vh - 80px - 60px);
    }
}

#map {
    flex-grow: 1;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   2. FILTRES SANS FORMES (ICON-ONLY)
   ========================================================================== */
.filter-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    /* Fond très léger pour la lisibilité */
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    /* Plus d'espace car plus de bordures */
    padding: 10px 15px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.filter-container::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    /* SUPPRESSION DES FORMES */
    background: none !important;
    border: none !important;
    box-shadow: none !important;

    padding: 4px 5px;
    min-width: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
    /* Grisé quand inactif */
}

/* ÉTAT ACTIF : On utilise l'opacité et une petite barre discrète */
.filter-btn.active {
    opacity: 1;
    transform: scale(1.1);
    /* Légère emphase sur l'icône active */
}

.filter-btn::after {
    content: "";
    width: 0%;
    height: 2px;
    background: #8b9d83;
    transition: width 0.3s ease;
    margin-top: 4px;
}

.filter-btn.active::after {
    width: 15px;
    /* Petite barre de soulignement */
}

.filter-icon,
.filter-icon-wrapper {
    width: 26px !important;
    height: 26px !important;
    margin-bottom: 2px;
    object-fit: contain;
}

.filter-label {
    font-size: 8px;
    /* Très discret */
    font-weight: 700;
    text-transform: uppercase;
    color: #444;
}

/* Adaptation PC : Filtre Vertical à Droite */
@media(min-width: 1024px) {
    .filter-container {
        /* Positionnement à droite */
        width: auto;
        left: auto;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        /* Centrage vertical */

        /* Orientation verticale */
        flex-direction: column;
        padding: 20px 10px;
        border-radius: 40px;

        /* Esthétique */
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .filter-btn {
        min-width: 60px;
        padding: 10px 5px;
    }

    .filter-btn::after {
        /* La barre de soulignement devient latérale ou reste en dessous */
        margin-top: 6px;
    }
}

/* ==========================================================================
   3. MARQUEURS ET POPUPS
   ========================================================================== */
.custom-marker-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-icon {
    width: 28px !important;
    height: 28px !important;
}

.marker-label {
    margin-top: 4px;
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}

.leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    /* border-radius: 12px; */
}

.leaflet-popup-content {
    margin: 0;
    width: 250px !important;
}

/* Styles des Popups */
.popup-card {
    overflow: hidden;
}

.popup-text-content {
    padding: 15px;
    text-align: center;
}

.popup-image-container img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.popup-title {
    margin: 0;
    font-size: 1.1em;
    color: #2d3436;
}

.popup-category {
    color: #8b9d83;
    font-weight: 600;
    font-size: 0.9em;
}

.popup-eta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #666;
}

.popup-eta.randonnee {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #666;
    display: flex;
}

.popup-eta span {
    flex: 1;
    /* Force chaque span à prendre 1/3 de la largeur (répartition égale) */
    text-align: center;
    /* Centre le texte à l'intérieur de chaque bloc */
    display: flex;
    /* Permet de mieux organiser l'icône et le texte */
    flex-direction: column;
    /* Optionnel : met l'icône au-dessus du texte */
    font-size: 0.85em;
    /* Ajuste la taille pour que tout tienne sur une ligne */
    white-space: nowrap;
    /* Empêche le texte de revenir à la ligne si c'est trop serré */
}

.popup-description {
    font-size: 0.85em;
    margin-top: 10px;
    color: #444;
    line-height: 1.4;
}

/* --- SIDEBAR DESKTOP --- */
.sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 350px;
    height: 100%;
    background: white;
    z-index: 1100;
    /* Au-dessus de la carte */
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    display: none;
    /* Caché par défaut */
    scrollbar-width: thin;
    scrollbar-color: #8b9d83 transparent;
}

.sidebar.active {
    transform: translateX(0);
}

/* Style amélioré du bouton de fermeture */
.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #2d3436;
    /* Couleur de votre header [cite: 1, 2] */
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.close-btn:hover {
    background: #f8f9fa;
    color: #8b9d83;
    /* Votre couleur verte [cite: 3, 10] */
    transform: rotate(90deg);
    /* Petit effet de rotation sympa */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.close-btn svg {
    transition: transform 0.2s ease;
}

/* Adaptation Desktop */
@media(min-width: 1024px) {
    .sidebar {
        display: block;
        /* On permet l'affichage sur PC */
    }
}

/* On réutilise les styles de popup pour la sidebar pour la cohérence */
.sidebar .popup-image-container img {
    height: 250px;
    /* Plus grand en sidebar */
}

/* 1. Supprime l'arrondi du conteneur principal */
.leaflet-popup-content-wrapper {
    border-radius: 0 !important;
}

.leaflet-popup {
    margin-bottom: 40px !important;
}

/* 2. Supprime l'arrondi du petit triangle en bas du popup */
.leaflet-popup-tip-container {
    border-radius: 0 !important;
}

.leaflet-popup-tip {
    border-radius: 0 !important;
}

/* 3. Optionnel : Si vous avez des images en haut du popup, 
   assurez-vous qu'elles ne forcent pas d'arrondi non plus */
.popup-image-container img {
    border-radius: 0 !important;
}

/* 1. Le bouton en haut à gauche de la carte */
.map-control-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1100;

    /* Design épuré */
    background: rgba(255, 255, 255, 0.7);
    /* Fond translucide */
    backdrop-filter: blur(8px);
    /* Effet de flou */
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Bordure très fine */
    color: #2d3436;
    /* Rappel couleur header [cite: 1] */

    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    /* Bouton rond plus discret */
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    /* Ombre très douce */
    transition: all 0.3s ease;
}

.map-control-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.05);
    color: #8b9d83;
    /* Rappel de votre couleur fétiche [cite: 3, 10] */
}

/* Ajustement position mobile sous les filtres */
@media (max-width: 1023px) {
    .map-control-btn {
        top: 75px;
        /* Aligné avec la hauteur des filtres [cite: 9] */
        left: 10px;
        width: 34px;
        height: 34px;
    }
}

/* 2. L'état "Plein Écran" déclenché par le JS */
/* On cible le header pour le cacher quand le body a la classe fullscreen-mode */
body.fullscreen-mode .fixed.top-0.left-0.w-full.z-50 {
    display: none !important;
    /* Cache votre header actuel  */
}

body.fullscreen-mode .map-control-btn {
    position: fixed;
    z-index: 10000;
}

/* En plein écran sur mobile, on garde le décalage si les filtres sont là */
@media (max-width: 1023px) {
    body.fullscreen-mode .map-control-btn {
        top: 80px;
    }
}

/* On force la carte à prendre toute la fenêtre */
body.fullscreen-mode .map-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    /* Passe devant tout le reste */
}

/* On s'assure que le contenu de la carte suit la taille */
body.fullscreen-mode #map {
    height: 100% !important;
    width: 100% !important;
}

/* Conteneur de groupe pour aligner le bouton principal et ses enfants */
.filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 5px;
}

/* Cache les sous-filtres par défaut */
.sub-filters.hidden {
    display: none;
}

/* Affiche les sous-filtres quand actif */
.sub-filters.visible {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-left: 20px;
    /* Indentation */
    margin-top: 5px;
}

/* Style des boutons sous-filtres */
.filter-btn.sub-btn {
    font-size: 0.85em;
    padding: 4px 10px;
    background-color: #f0f0f0;
    border-radius: 15px;
    border: 1px solid #ddd;
}

.filter-btn.sub-btn.active {
    background-color: #3b82f6;
    color: white;
}