/*
 * Project-wide video preview.
 *
 * Shared by every page shell (admin, login, share pages, public namecard and
 * organization profile, portal) and driven by assets/js/shared/video_preview.js,
 * which moves the clip into the dialog and builds it on first use - no view
 * carries markup for it.
 *
 * The dialog is a fixed box rather than a copy of the card: the moved <video>
 * keeps its position when the dialog is closed and reopened, which is what
 * makes the player resume instead of starting over.
 *
 * Colour comes from the admin token layer when it is present (theme.css) and
 * falls back to the dark values otherwise, because the share and public
 * surfaces do not load theme.css.
 */

.video-preview {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1090; /* above AdminLTE modals (1050) and SweetAlert2 (1060) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: rgba(9, 12, 16, 0.82);
}

/* `hidden` is the source of truth for the closed state, so the flex display
   above must not win over it. */
.video-preview[hidden] {
    display: none;
}

.video-preview__dialog {
    position: relative;
    display: flex;
    width: 92vw;
    max-width: 1100px;
    height: 86vh;
    max-height: 720px;
    overflow: hidden;
    border-radius: 0.75rem;
    background-color: #000000;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

/*
 * A page card may size its player for a small grid cell. The direct-child
 * selector beats those card rules while the clip is inside the dialog, and the
 * class is removed again when it moves back to the card.
 */
.video-preview .video-preview__dialog > .video-preview__video {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 0;
    background-color: #000000;
    object-fit: contain;
}

@media (max-width: 768px) {
    .video-preview {
        padding: 8px;
    }

    .video-preview__dialog {
        width: 96vw;
        height: 70vh;
    }
}

/* Sits over the clip, so it keeps its own dark surface and white glyph rather
   than the dialog tokens - a video can be any colour. */
.video-preview__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: rgba(17, 20, 24, 0.72);
    color: #ffffff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

@media (pointer: coarse) {
    .video-preview__close {
        width: 44px;
        height: 44px;
    }
}

.video-preview__close:hover {
    background-color: rgba(255, 255, 255, 0.22);
}

.video-preview__close:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

body.video-preview-open {
    overflow: hidden;
}
