/* GAM Video preroll skin — port từ adsconex player (prefix aio-gam-video).
 * Responsive 16:9 (thay vì fix 640x360); sticky 260x145 bottom-right.
 */

.aio-gam-video-wrapper {
    width: 100%;
    max-width: 640px;
    aspect-ratio: 16 / 9;
    margin: 1em auto;
}

#aio-gam-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-width: 640px;
    margin: 0 auto;
    background: #222;
    display: flex;
    justify-content: center;
    align-items: center;
}

#aio-gam-video-container.aio-gam-video-container__sticky {
    position: fixed !important;
    width: 260px !important;
    height: 145px !important;
    aspect-ratio: auto !important;
    bottom: 110px !important;
    right: 20px !important;
    z-index: 9999 !important;
    max-width: 66% !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    background: #f0f0f0 !important;
    overflow: visible;
    animation: aio-gam-video-fade-in-up 0.6s ease-in-out forwards;
}

@keyframes aio-gam-video-fade-in-up {
    0% { opacity: 0; }
    100% { opacity: 1; transform: translateY(0); }
}

#aio-gam-video-container .aio-gam-video-container__btn-close {
    position: absolute;
    top: -28px;
    right: 0;
    width: 28px;
    height: 28px;
    background: black;
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    line-height: 28px;
    cursor: pointer;
    display: none;
    z-index: 2147483640;
}

/* ===== Adsofic watermark =====
 * A lockup, not a bare symbol: the strokes alone read as noise over a busy
 * frame, so the name is set next to them as text (system stack — no webfont for
 * a 7-letter word) and the pair sits on a dark translucent pill. The pill is
 * what makes the brand survive an arbitrary video frame; opacity alone cannot,
 * because the failure case is a *bright* background, not a dim one. It stays a
 * watermark and not an ad unit by being small, low-contrast at rest (.9) and
 * only fully opaque on hover/focus.
 *
 * The whole thing is the <a> to adsofic.com, so the hit area is the pill.
 *
 * Bottom-right, clear of the control bar (62px, 54px when sticky or on mobile)
 * plus the 9px the progress bar grows upward into on container hover.
 *
 * Hidden the moment a VAST creative takes over: `visibility` and not opacity
 * alone, so the mark is out of the paint order whatever z-index the IMA ad
 * container claims — nothing of ours may sit on a paid creative. Since it is a
 * link now, that also has to mean un-clickable and un-tabbable: `visibility:
 * hidden` already removes it from hit-testing and the tab order, and
 * `pointer-events: none` is restated below so no later rule can hand back a
 * live invisible link over a paid ad. Never swap this for an opacity-0 state.
 * Hiding is instant; only the way back in fades.
 *
 * The SVG keeps the brand's 100-unit grid: the strokes span 81x75 and the rest
 * is clear space (13.5 left, 5.5 right, 13.5 top, 11.5 bottom), so the box runs
 * ~1.25x the visible mark. 26px / 22px / 20px boxes put the visible strokes at
 * 21 / 17.8 / 16.2px — above the 16px brand minimum in every layout.
 */
#aio-gam-video-container .aio-gam-video-container__watermark {
    position: absolute;
    right: 14px;
    bottom: 78px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px 5px 8px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: rgba(10, 12, 18, .55);
    backdrop-filter: blur(6px) saturate(140%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    font: 700 14px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: .01em;
    white-space: nowrap;
    color: #F7F8FA;
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
    opacity: .9;
    pointer-events: auto;
    z-index: 2;
    transition: opacity .2s ease-out, background-color .2s ease-out;
}

#aio-gam-video-container .aio-gam-video-container__watermark::before {
    content: '';
    flex: none;
    width: 26px;
    height: 26px;
    background: url('../image/adsofic-symbol-reverse.svg') center / contain no-repeat;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45));
}

#aio-gam-video-container .aio-gam-video-container__watermark:hover,
#aio-gam-video-container .aio-gam-video-container__watermark:focus-visible {
    opacity: 1;
    background: rgba(10, 12, 18, .72);
    text-decoration: none;
    color: #F7F8FA;
}

/* Focus ring in brand Orange, doubled with a dark halo so it is visible over a
 * light frame as well as a dark one. */
#aio-gam-video-container .aio-gam-video-container__watermark:focus-visible {
    outline: 2px solid #FF6A2A;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(10, 12, 18, .65);
}

#aio-gam-video-container .aio-gam-video-container__watermark.aio-gam-video-container__watermark--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: none;
}

/* Sticky is 260x145 — the lockup is kept rather than dropped back to the bare
 * symbol, because that is the mode where the player is most visible and least
 * explained, so the name has to come with it. Scaled down instead: 20px symbol
 * (16.2px strokes, at the brand floor) and 11px text put the pill at ~80px,
 * under a third of the 260px width. */
#aio-gam-video-container.aio-gam-video-container__sticky .aio-gam-video-container__watermark {
    right: 10px;
    bottom: 70px;
    gap: 5px;
    padding: 3px 8px 3px 6px;
    font-size: 11px;
}

#aio-gam-video-container.aio-gam-video-container__sticky .aio-gam-video-container__watermark::before {
    width: 20px;
    height: 20px;
}

@media (prefers-reduced-motion: reduce) {
    #aio-gam-video-container .aio-gam-video-container__watermark {
        transition: none;
    }
}

/* ===== Video.js ===== */
#aio-gam-video-container .video-js {
    width: 100%;
    height: 100%;
    background: #000;
}

#aio-gam-video-container.aio-gam-video-container__sticky .video-js {
    max-width: 100%;
}

/* Big play */
#aio-gam-video-container .vjs-big-play-button {
    width: 100px;
    height: 60px;
    line-height: 60px;
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(0, 0, 0, .45) !important;
    transition: .25s ease;
}

#aio-gam-video-container:hover .vjs-big-play-button {
    transform: scale(1.08);
    background: rgba(255, 61, 61, .92) !important;
    border-color: rgba(255, 255, 255, .2);
    box-shadow: 0 10px 35px rgba(255, 61, 61, .45);
}

/* Control bar */
#aio-gam-video-container .vjs-control-bar {
    height: 62px;
    padding: 0 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .2), rgba(0, 0, 0, .92)) !important;
    backdrop-filter: blur(10px);
}

#aio-gam-video-container.aio-gam-video-container__sticky .vjs-control-bar {
    height: 54px;
}

#aio-gam-video-container .vjs-button {
    width: 42px;
}

#aio-gam-video-container .vjs-button > .vjs-icon-placeholder:before {
    line-height: 62px;
    font-size: 1.7em;
}

#aio-gam-video-container .vjs-time-control {
    line-height: 62px;
    font-size: 12px;
    color: rgba(255, 255, 255, .82);
}

/* Progress bar */
#aio-gam-video-container .vjs-progress-control {
    padding-left: 10px;
    padding-right: 10px;
    position: absolute;
    top: -5px;
    left: 0;
    width: 100%;
    height: 5px;
    transition: .2s ease;
}

#aio-gam-video-container:hover .vjs-progress-control {
    height: 9px;
    top: -9px;
}

#aio-gam-video-container .vjs-progress-holder {
    margin: 0;
    height: 100%;
    border-radius: 999px;
}

#aio-gam-video-container .vjs-load-progress {
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
}

#aio-gam-video-container .vjs-play-progress {
    border-radius: 999px;
}

#aio-gam-video-container .vjs-play-progress:before {
    display: none;
}

/* Menu */
#aio-gam-video-container .vjs-menu-content {
    background: rgba(15, 17, 23, .95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .06);
}

/* Mobile */
@media (max-width: 768px) {
    #aio-gam-video-container {
        border-radius: 5px;
    }

    #aio-gam-video-container .vjs-big-play-button {
        width: 80px;
        height: 50px;
        line-height: 50px;
        font-size: 2em;
    }

    #aio-gam-video-container .vjs-control-bar {
        height: 54px;
    }

    #aio-gam-video-container .vjs-button > .vjs-icon-placeholder:before {
        line-height: 54px;
        font-size: 1.5em;
    }

    #aio-gam-video-container .vjs-time-control {
        line-height: 54px;
    }

    /* Control bar drops to 54px here, so the 70px offset keeps the same ~7px of
     * air above the hover-grown progress bar as the desktop 78px does. */
    #aio-gam-video-container .aio-gam-video-container__watermark {
        right: 10px;
        bottom: 70px;
        gap: 6px;
        padding: 5px 10px 5px 8px;
        font-size: 12px;
    }

    #aio-gam-video-container .aio-gam-video-container__watermark::before {
        width: 22px;
        height: 22px;
    }
}

@media screen and (max-width: 767px) {
    #aio-gam-video-container.aio-gam-video-container__sticky {
        bottom: 115px !important;
    }
}
