/******************************************************************************
 *
 * css/sequence-video-1-0.css
 *
 * Bouton "lancer la séquence vidéo" + lecteur modal.
 *
 * Le bouton est unique par page, en position fixed (miroir du FAB
 * report-widget côté gauche) — une seule vidéo par fiche, visible en
 * permanence quelle que soit l'étape/page affichée, pas de dépendance à
 * .card-image-zone. La modale reprend le visuel de .v3-anim-* de
 * vision3d.css, sous un préfixe de classe dédié (.sv-*) pour ne pas
 * coupler ce fichier au module vision3d/.
 *
 *****************************************************************************/

/******************************************************************************
    BOUTON "LANCER LA SÉQUENCE"
    Position fixe à l'écran (comme le FAB report-widget, en miroir côté
    gauche) : visible en permanence, indépendamment du scroll et de
    l'étape/page affichée. Une seule vidéo par fiche → un seul bouton
    par page, pas un par carte.
******************************************************************************/
.sv-video-btn {
    position: fixed;
    bottom: 24px;
    left: 180px;
    z-index: 8000;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(26, 32, 64, .45);
    border-radius: 999px;
    cursor: pointer;
    background: rgba(240, 243, 249, .6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #1a2040;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
    transition: transform .15s, background .2s, opacity .2s;
}
[data-theme="light"] .sv-video-btn {
    color: var(--accent-blue);
    background: var(--bg-deep, #13181f);
    border-color: rgba(61, 142, 248, .45);
}

.sv-video-btn:hover {
    background: rgba(240, 243, 249, .8);
    border-color: rgba(26, 32, 64, .8);
    transform: scale(1.08);
}
[data-theme="light"] .sv-video-btn:hover {
  background: rgba(61, 142, 248, .12);
  border-color: rgba(61, 142, 248, .45);
}

.sv-video-btn .mat-icon {
    font-size: 32px;
    line-height: 1;
}

/* Miroir de la position mobile du FAB report-widget (bottom:72px;right:14px
   → ici bottom:72px;left:14px), pour laisser la place à la navbar basse. */
@media (max-width: 768px) {
    .sv-video-btn {
        bottom: 72px;
        left: 14px;
        width: 44px;
        height: 44px;
    }
    .sv-video-btn .mat-icon {
        font-size: 22px;
    }
}

/* Info-bulle 2 lignes, au-dessus du bouton : "Lancer la séquence" puis le
   titre le cas échéant, via data-tooltip / data-tooltip-sub — même
   mécanique que .v3-play-toggle dans vision3d.css. */
.sv-video-btn::after,
.sv-video-btn::before {
    position: absolute;
    left: 0;
    white-space: nowrap;
    background: rgba(20, 24, 45, .92);
    color: #fff;
    font-size: .72rem;
    padding: 5px 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

/* 2e ligne (titre) — la plus proche du bouton */
.sv-video-btn::before {
    content: attr(data-tooltip-sub);
    bottom: calc(100% + 8px);
    border-radius: 6px;
}

.sv-video-btn:not([data-tooltip-sub])::before {
    content: none;
}

/* 1re ligne ("Lancer la séquence") — au-dessus de la 2e si présente */
.sv-video-btn::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    border-radius: 6px;
}

.sv-video-btn[data-tooltip-sub]::after {
    bottom: calc(100% + 8px + 1.6em);
    border-radius: 6px 6px 0 0;
}

.sv-video-btn[data-tooltip-sub]::before {
    border-radius: 0 0 6px 6px;
}

.sv-video-btn:hover::after,
.sv-video-btn:hover::before {
    opacity: 1;
}

/******************************************************************************
    MODALE DE LECTURE (webm)
    Une seule instance par page, partagée par tous les boutons des
    différentes étapes/pages — même vidéo pour toute la fiche.
    Desktop : dialog centré. Mobile : plein écran.
******************************************************************************/
.sv-anim-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.sv-anim-modal[hidden] {
    display: none;
}

.sv-anim-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .75);
    cursor: pointer;
}

.sv-anim-dialog {
    position: relative;
    z-index: 1;
    width: min(1000px, 90vw);
    aspect-ratio: 4 / 3;
    max-height: 88vh;
    background: #1b2140;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .30);
    overflow: hidden;
    display: flex;
}

.sv-anim-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #000;
}

.sv-anim-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    transition: background .2s;
}

.sv-anim-close .mat-icon {
    font-size: 20px;
    line-height: 1;
}

.sv-anim-close:hover {
    background: rgba(0, 0, 0, .8);
}

@media (max-width: 600px) {
    .sv-anim-modal {
        padding: 0;
    }
    .sv-anim-dialog {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .sv-anim-video {
        height: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    .sv-anim-close {
        top: 14px;
        right: 14px;
    }
}
