/* ============================================================
   carte.css — mise en page de la carte publique et de l'embed.
   ============================================================ */

.page-carte { height: 100%; }
html, body { height: 100%; }
body.page-carte { display: flex; flex-direction: column; }

.carte-layout {
    flex: 1;
    display: flex;
    min-height: 0; /* pour que les enfants puissent scroller */
}

/* --- Panneau latéral --- */
.panneau {
    width: 340px;
    max-width: 90vw;
    background: #fff;
    border-right: 1px solid var(--gris-bord);
    overflow-y: auto;
    overflow-x: hidden;      /* pas de scroll horizontal dans le panneau */
    padding: 1rem;
}
.panneau h2 { font-size: 1.05rem; margin-top: 1rem; }
.bascule-panneau { display: none; margin-bottom: .5rem; }

/* Les colonnes de la grille des filtres peuvent rétrécir sous la largeur
   intrinsèque des champs date (sinon « Jusqu'au » déborde du panneau). */
.panneau .ligne-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panneau input, .panneau select { min-width: 0; max-width: 100%; }

.liste-events { display: flex; flex-direction: column; gap: .6rem; }
.event-item {
    border: 1px solid var(--gris-bord);
    border-left: 5px solid var(--noir);
    border-radius: var(--rayon);
    padding: .6rem .7rem;
    cursor: pointer;
    background: #fff;
    transition: background .15s;
}
.event-item:hover { background: var(--gris-fond); }
.event-item .titre { font-weight: 600; font-size: .95rem; font-family: var(--police-titre); }
.event-item .meta { font-size: .82rem; color: var(--gris-doux); margin-top: .2rem; }

/* --- Zone carte --- */
.carte-zone { position: relative; flex: 1; min-width: 0; }
#carte { position: absolute; inset: 0; }

/* --- Légende --- */
.legende {
    position: absolute;
    left: 10px; bottom: 22px;
    background: rgba(255,255,255,.94);
    border: 1px solid var(--gris-bord);
    border-radius: var(--rayon);
    padding: .5rem .6rem;
    font-size: .78rem;
    box-shadow: var(--ombre);
    max-width: 190px;
    z-index: 2;
}
.legende h3 { margin: 0 0 .35rem; font-size: .8rem; }
.legende .rangee { display: flex; align-items: center; gap: .4rem; margin: .12rem 0; }
.legende .pastille { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* --- Sélecteur de fond --- */
.selecteur-fond {
    position: absolute;
    right: 10px; top: 10px;
    background: rgba(255,255,255,.94);
    border: 1px solid var(--gris-bord);
    border-radius: var(--rayon);
    padding: .35rem .5rem;
    font-size: .82rem;
    box-shadow: var(--ombre);
    z-index: 2;
}
.selecteur-fond select { width: auto; display: inline-block; padding: .25rem .4rem; font-size: .82rem; }

/* --- Popup --- */
.popup-event { font-size: .88rem; max-width: 240px; }
.popup-event h3 { margin: 0 0 .3rem; font-size: 1rem; }
.popup-event .lignes { margin: .3rem 0; }
.popup-event .lignes div { margin: .12rem 0; }
.popup-event img.affiche {
    width: 100%; border-radius: 6px; margin-top: .4rem; cursor: zoom-in;
    display: block;
}
.popup-event .etiquettes { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.popup-event .etiquette {
    background: var(--gris-fond); border: 1px solid var(--gris-bord);
    border-radius: 999px; padding: .05rem .5rem; font-size: .72rem;
}

/* --- Modale affiche --- */
.modale-affiche {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modale-fond { position: absolute; inset: 0; background: rgba(0,0,0,.8); }
#modale-img {
    position: relative; max-width: 92vw; max-height: 92vh;
    border-radius: 8px; box-shadow: 0 4px 30px rgba(0,0,0,.5);
}

/* --- Responsive : panneau en bas sur mobile --- */
@media (max-width: 720px) {
    .carte-layout { flex-direction: column-reverse; }
    .panneau {
        width: 100%; max-width: none;
        border-right: none; border-top: 1px solid var(--gris-bord);
        max-height: 45vh;
    }
    .bascule-panneau { display: inline-block; }
    .panneau-contenu.replie { display: none; }
    .carte-zone { min-height: 45vh; }
}
