/* ========================================
   CALENDRIER DE SÉJOUR — panneau components/calendrier_sejour.html
   Carte de réservation de la fiche, et « Modifier » les dates de la page de réservation
   (reservation.css le replace sous la ligne des dates). Popover deux mois dès 1024px,
   feuille plein écran au-dessus de la navbar en dessous (calendrier_sejour.js).
   La grille qu'il contient est celle de la recherche (.calendrier, calendrier_voyageur.css) :
   deux calendriers seulement sur le site, le voyageur et .calendrier-pro (propriétaire).
   ======================================== */

.booking-cal {
    display: none;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
}

.booking-cal.is-open {
    display: flex;
}

.booking-cal:focus {
    outline: none;
}

.booking-cal__backdrop {
    display: none;
}

.booking-cal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.booking-cal__title {
    font-size: var(--font-size-title);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.booking-cal__subtitle {
    margin-top: 4px;
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
}

/* Bouton ✕ : .btn-fermer (components.css), visible sur la feuille mobile seulement */
.booking-cal__close {
    display: none;
    margin: -8px -8px 0 0;
}

.booking-cal__body {
    min-height: 0;
}

.booking-cal__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 16px;
}

.booking-cal__foot [hidden] {
    display: none;
}

.booking-cal__clear {
    min-height: 44px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.booking-cal__clear:hover {
    background: var(--color-surface);
}

/* Grand écran : popover ancré sous les champs, deux mois */
@media (min-width: 1024px) {
    .booking-cal {
        position: absolute;
        top: -12px;
        right: -37px;
        z-index: 10;
        width: 680px;
        max-width: calc(100vw - 2 * var(--page-gutter));
        max-height: calc(100vh - var(--nav-height) - 120px);
        overflow-y: auto;
        padding: 24px 32px;
        border-radius: var(--radius-3xl);
        box-shadow: var(--shadow-float);
    }

    .booking-cal.is-open {
        animation: dropdownIn 0.2s var(--ease);
    }
}

/* Mobile et tablette : feuille plein écran au-dessus de la navbar */
@media (max-width: 1023px) {
    /* Pas de position ni de z-index ici : la feuille fixe doit passer au-dessus de la navbar */
    .booking-sidebar {
        position: static;
        z-index: auto;
        max-width: 560px;
        margin: 0 auto;
    }

    .booking-cal {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: var(--z-feuille);
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 24px 24px calc(16px + env(safe-area-inset-bottom));
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        box-shadow: var(--shadow-float);
    }

    .booking-cal.is-open {
        animation: feuilleMonte 0.28s var(--ease);
    }

    .booking-cal__close {
        display: inline-flex;
    }

    .booking-cal__body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        width: 100%;
        max-width: 720px;
        margin: 0 auto;
    }

    .booking-cal__foot {
        justify-content: space-between;
        margin: 0 -24px;
        padding: 16px 24px 0;
        border-top: 1px solid var(--color-border);
    }
}

@media (max-width: 719px) {
    .booking-cal__body {
        max-width: 420px;
    }
}

@media (max-width: 1023px) {
    .booking-cal__backdrop {
        position: fixed;
        inset: 0;
        z-index: calc(var(--z-feuille) - 1);
        background: var(--color-overlay);
    }

    .booking-cal.is-open + .booking-cal__backdrop {
        display: block;
    }
}
