/* ==========================================================================
   Tunnel de prise de RDV en plein écran
   --------------------------------------------------------------------------
   Partagé par la fiche publique (layout vitrine) et « Mon psychologue »
   (espace patient) : balisage dans element/patient/tunnel/plein_ecran.php,
   comportement dans js/tunnel-plein-ecran.js. Variables de la DA avec
   valeurs de repli, la feuille ne dépend d'aucun autre fichier.

   Le bloc #rdv reste à sa place dans le DOM : la classe .tunnel-plein-ecran
   le fait passer en position fixe par-dessus la page. Hors plein écran, les
   éléments .tunnel-pe-* propres au mode sont masqués.
   ========================================================================== */
.tunnel-pe-entete,
.tunnel-pe-aside {
    display: none;
}

html.tunnel-pe-ouvert,
html.tunnel-pe-ouvert body {
    overflow: hidden;
}

#rdv.tunnel-plein-ecran {
    position: fixed;
    inset: 0;
    /* Au-dessus de l'en-tête et de la nav sticky, sous les modales/SweetAlert */
    z-index: 1045;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    background: var(--doux, #F5FAFA) !important;
    animation: tunnel-pe-apparition .28s ease-out;
}

@keyframes tunnel-pe-apparition {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* --- En-tête : identité du psy + bouton quitter + progression --- */
.tunnel-plein-ecran .tunnel-pe-entete {
    display: block;
    flex-shrink: 0;
    background: var(--blanc, #fff);
    border-bottom: 1px solid var(--ligne, #E3ECEC);
    box-shadow: var(--ombre-sm, 0 2px 8px -2px rgba(11, 87, 104, .12));
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 14px;
}

.tunnel-pe-barre {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tunnel-pe-identite {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tunnel-pe-photo {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--vert, #31a99f);
}

.tunnel-pe-identite-texte {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.tunnel-pe-surtitre {
    font-size: .78rem;
    color: var(--gris, #5c6f72);
}

.tunnel-pe-nom {
    font-weight: 700;
    color: var(--teal, #0B5768);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tunnel-pe-quitter {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--ligne, #E3ECEC);
    background: var(--blanc, #fff);
    color: var(--encre, #12333a);
    border-radius: var(--rayon-pill, 999px);
    padding: 8px 16px;
    font-weight: 600;
    font-size: .9rem;
    transition: background .15s, border-color .15s;
}

.tunnel-pe-quitter:hover,
.tunnel-pe-quitter:focus-visible {
    background: var(--vert-clair, #e6f5f3);
    border-color: var(--vert, #31a99f);
}

.tunnel-pe-quitter .fa-xmark {
    font-size: 1.05rem;
}

/* Barre de progression segmentée */
.tunnel-pe-progression {
    max-width: 1100px;
    margin: 14px auto 0;
}

.tunnel-pe-progression-mobile {
    display: none;
    font-size: .85rem;
    color: var(--gris, #5c6f72);
    margin-bottom: 8px;
}

.tunnel-pe-progression-mobile b,
.tunnel-pe-progression-mobile .tunnel-pe-libelle {
    color: var(--teal, #0B5768);
    font-weight: 700;
}

.tunnel-pe-etapes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tunnel-pe-segment {
    display: block;
    height: 6px;
    border-radius: var(--rayon-pill, 999px);
    background: var(--ligne, #E3ECEC);
    position: relative;
    overflow: hidden;
}

.tunnel-pe-segment::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--vert, #31a99f), var(--teal-2, #258C8C));
    transition: width .45s ease;
}

.tunnel-pe-etape.fait .tunnel-pe-segment::after,
.tunnel-pe-etape.active .tunnel-pe-segment::after {
    width: 100%;
}

.tunnel-pe-etape-libelle {
    display: block;
    margin-top: 6px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gris-clair, #8a9b9d);
    transition: color .2s;
}

.tunnel-pe-etape.fait .tunnel-pe-etape-libelle {
    color: var(--vert-fonce, #1e7f77);
}

.tunnel-pe-etape.active .tunnel-pe-etape-libelle {
    color: var(--teal, #0B5768);
}

/* --- Corps défilant --- */
.tunnel-plein-ecran .tunnel-pe-corps {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 28px 16px calc(env(safe-area-inset-bottom, 0px) + 32px);
}

.tunnel-plein-ecran .tunnel-pe-grille {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.tunnel-plein-ecran .tunnel-pe-titre-normal {
    display: none;
}

/* Carte psy + récapitulatif */
.tunnel-plein-ecran .tunnel-pe-aside {
    display: block;
    position: sticky;
    top: 0;
}

.tunnel-pe-carte {
    background: var(--blanc, #fff);
    border: 1px solid var(--ligne, #E3ECEC);
    border-radius: var(--rayon, 18px);
    box-shadow: var(--ombre, 0 18px 44px -24px rgba(11, 87, 104, .38));
    padding: 24px 20px 20px;
    text-align: center;
}

.tunnel-pe-carte-photo {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--vert-clair, #e6f5f3);
    box-shadow: 0 0 0 2px var(--vert, #31a99f);
}

.tunnel-pe-carte-nom {
    margin-top: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--teal, #0B5768);
}

.tunnel-pe-carte-titre {
    margin-top: 2px;
    font-size: .88rem;
    color: var(--gris, #5c6f72);
}

.tunnel-pe-recap {
    margin: 18px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--ligne, #E3ECEC);
    text-align: left;
}

.tunnel-pe-recap > div {
    padding: 6px 0;
}

.tunnel-pe-recap dt {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gris-clair, #8a9b9d);
}

.tunnel-pe-recap dt [class*="fa-"] {
    width: 16px;
    text-align: center;
    margin-right: 4px;
    color: var(--vert, #31a99f);
}

.tunnel-pe-recap dd {
    margin: 2px 0 0 24px;
    font-weight: 600;
    color: var(--encre, #12333a);
    font-size: .92rem;
}

.tunnel-pe-rassurance {
    margin: 14px 0 0;
    text-align: center;
    font-size: .82rem;
    color: var(--gris, #5c6f72);
}

.tunnel-pe-rassurance [class*="fa-"] {
    color: var(--vert-fonce, #1e7f77);
    margin-right: 4px;
}

/* Le tunnel lui-même : carte blanche, sans hauteur max (c'est le corps qui défile) */
#rdv.tunnel-plein-ecran #tunnel-wrapper {
    max-height: none;
    overflow: visible;
    background: var(--blanc, #fff);
    border: 1px solid var(--ligne, #E3ECEC);
    border-radius: var(--rayon, 18px);
    box-shadow: var(--ombre, 0 18px 44px -24px rgba(11, 87, 104, .38)) !important;
    padding: 24px 28px 28px;
}

#rdv.tunnel-plein-ecran #tunnel-wrapper > .header {
    margin-bottom: 1.5rem !important;
}

#rdv.tunnel-plein-ecran #tunnel-wrapper > .header h3 {
    margin-top: .5rem !important;
    font-size: 1.4rem;
    color: var(--teal, #0B5768);
}

/* La progression est portée par l'en-tête plein écran */
#rdv.tunnel-plein-ecran #tunnel-wrapper > .header .progress,
#rdv.tunnel-plein-ecran #tunnel-wrapper > .header .num-etape {
    display: none;
}

/* --- Responsive --- */
@media (max-width: 991.98px) {
    .tunnel-plein-ecran .tunnel-pe-grille {
        grid-template-columns: minmax(0, 1fr);
        max-width: 720px;
    }

    /* La photo de l'en-tête suffit : on masque la carte latérale */
    .tunnel-plein-ecran .tunnel-pe-aside {
        display: none;
    }
}

@media (min-width: 992px) {
    /* La carte latérale montre déjà la photo : en-tête plus sobre */
    .tunnel-pe-photo {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 575.98px) {
    .tunnel-plein-ecran .tunnel-pe-entete {
        padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 12px;
    }

    .tunnel-pe-quitter {
        padding: 8px 12px;
    }

    .tunnel-pe-quitter-texte {
        display: none;
    }

    .tunnel-pe-progression {
        margin-top: 10px;
    }

    .tunnel-pe-progression-mobile {
        display: block;
    }

    .tunnel-pe-etapes {
        gap: 5px;
    }

    .tunnel-pe-etape-libelle {
        display: none;
    }

    .tunnel-plein-ecran .tunnel-pe-corps {
        padding: 16px 12px calc(env(safe-area-inset-bottom, 0px) + 24px);
    }

    #rdv.tunnel-plein-ecran #tunnel-wrapper {
        padding: 16px;
        border-radius: var(--rayon-sm, 12px);
    }

    #rdv.tunnel-plein-ecran #tunnel-wrapper > .header h3 {
        font-size: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #rdv.tunnel-plein-ecran {
        animation: none;
    }

    .tunnel-pe-segment::after {
        transition: none;
    }
}
