/* Absolute Center Spinner */
.loading {
    position: fixed;
    z-index: 999;
    height: 2em;
    width: 2em;
    overflow: show;
    margin: auto;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

/* Transparent Overlay */
.loading:before {
    content: "";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(rgba(20, 20, 20, 0.8), rgba(0, 0, 0, 0.8));

    background: -webkit-radial-gradient(
        rgba(20, 20, 20, 0.8),
        rgba(0, 0, 0, 0.8)
    );
}

/* :not(:required) hides these rules from IE9 and below */
.loading:not(:required) {
    /* hide "loading..." text */
    font: 0/0 a;
    color: transparent;
    text-shadow: none;
    background-color: transparent;
    border: 0;
}

.loading:not(:required):after {
    content: "";
    display: block;
    font-size: 10px;
    width: 1em;
    height: 1em;
    margin-top: -0.5em;
    -webkit-animation: spinner 150ms infinite linear;
    -moz-animation: spinner 150ms infinite linear;
    -ms-animation: spinner 150ms infinite linear;
    -o-animation: spinner 150ms infinite linear;
    animation: spinner 150ms infinite linear;
    border-radius: 0.5em;
    -webkit-box-shadow:
        rgba(255, 255, 255, 0.75) 1.5em 0 0 0,
        rgba(255, 255, 255, 0.75) 1.1em 1.1em 0 0,
        rgba(255, 255, 255, 0.75) 0 1.5em 0 0,
        rgba(255, 255, 255, 0.75) -1.1em 1.1em 0 0,
        rgba(255, 255, 255, 0.75) -1.5em 0 0 0,
        rgba(255, 255, 255, 0.75) -1.1em -1.1em 0 0,
        rgba(255, 255, 255, 0.75) 0 -1.5em 0 0,
        rgba(255, 255, 255, 0.75) 1.1em -1.1em 0 0;
    box-shadow:
        rgba(255, 255, 255, 0.75) 1.5em 0 0 0,
        rgba(255, 255, 255, 0.75) 1.1em 1.1em 0 0,
        rgba(255, 255, 255, 0.75) 0 1.5em 0 0,
        rgba(255, 255, 255, 0.75) -1.1em 1.1em 0 0,
        rgba(255, 255, 255, 0.75) -1.5em 0 0 0,
        rgba(255, 255, 255, 0.75) -1.1em -1.1em 0 0,
        rgba(255, 255, 255, 0.75) 0 -1.5em 0 0,
        rgba(255, 255, 255, 0.75) 1.1em -1.1em 0 0;
}

/* Animation */

@-webkit-keyframes spinner {
    0% {
        -webkit-transform: rotate(0deg);
        -moz-transform: rotate(0deg);
        -ms-transform: rotate(0deg);
        -o-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        -moz-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
        -o-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}
@-moz-keyframes spinner {
    0% {
        -webkit-transform: rotate(0deg);
        -moz-transform: rotate(0deg);
        -ms-transform: rotate(0deg);
        -o-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        -moz-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
        -o-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}
@-o-keyframes spinner {
    0% {
        -webkit-transform: rotate(0deg);
        -moz-transform: rotate(0deg);
        -ms-transform: rotate(0deg);
        -o-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        -moz-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
        -o-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}
@keyframes spinner {
    0% {
        -webkit-transform: rotate(0deg);
        -moz-transform: rotate(0deg);
        -ms-transform: rotate(0deg);
        -o-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        -moz-transform: rotate(360deg);
        -ms-transform: rotate(360deg);
        -o-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

body {
    margin: 0;
    background-color: black;
}
html,
body,
#player {
    width: 100%;
    height: 100%;
}
.jw-stretch-uniform video {
    object-fit: contain;
}
.jw-stretch-none video {
    object-fit: none;
}
.jw-stretch-fill video {
    object-fit: cover;
}
.jw-stretch-exactfit video {
    object-fit: fill;
}
.video-dimensions {
    width: 100%;
    height: 100%;
}
.jw-icon-rewind {
    display: none !important;
}

/* ── Resume Dialog ─────────────────────────────────────── */
#avs-resume-overlay {
    position: absolute;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: avs-fade-in 0.2s ease;
}
#avs-resume-box {
    background: linear-gradient(
        145deg,
        rgba(28, 28, 28, 0.96) 0%,
        rgba(40, 40, 40, 0.96) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 22px 28px 20px;
    max-width: 320px;
    width: 85%;
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.3),
        0 12px 32px rgba(0, 0, 0, 0.5);
    animation: avs-slide-up 0.35s cubic-bezier(0.22, 0.68, 0, 1.15);
    text-align: center;
    color: #f1f1f1;
    font-family: Arial, sans-serif;
}
#avs-resume-box .avs-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #e62117;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    line-height: 1;
    box-shadow: 0 4px 16px rgba(230, 33, 23, 0.4);
}
#avs-resume-box .avs-title {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
    line-height: 1.4;
}
#avs-resume-box .avs-time {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #e62117;
    margin-bottom: 18px;
}
#avs-resume-box .avs-btns {
    display: flex;
    gap: 10px;
}
#avs-resume-box button {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        transform 0.12s,
        opacity 0.12s;
}
#avs-resume-box button:active {
    transform: scale(0.96);
}
#avs-resume-btn-yes {
    background: #e62117;
    color: #fff;
    box-shadow: 0 3px 12px rgba(230, 33, 23, 0.35);
}
#avs-resume-btn-yes:hover {
    opacity: 0.9;
}
#avs-resume-btn-no {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
#avs-resume-btn-no:hover {
    background: rgba(255, 255, 255, 0.12);
}
@keyframes avs-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes avs-slide-up {
    from {
        transform: translateY(24px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ── Buffer Progress % ───────────────────────────────────── */
#avs-buffer-pct {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    font-family: Arial, sans-serif;
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    margin-top: 4px;
    pointer-events: none;
}
#avs-buffer-pct.avs-bp0,
#avs-buffer-pct.avs-bp1 {
    font-size: 11px;
}

/* ── Next Episode Toast ─────────────────────────────────── */
#avs-next-toast {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 9999;
    background: linear-gradient(
        145deg,
        rgba(28, 28, 28, 0.94) 0%,
        rgba(40, 40, 40, 0.94) 100%
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 14px 18px;
    max-width: 280px;
    box-shadow:
        0 0 24px rgba(0, 0, 0, 0.2),
        0 8px 24px rgba(0, 0, 0, 0.4);
    animation: avs-slide-right 0.35s cubic-bezier(0.22, 0.68, 0, 1.15);
    font-family: Arial, sans-serif;
    color: #f1f1f1;
}
#avs-next-toast .avs-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
#avs-next-toast .avs-toast-icon {
    font-size: 16px;
    margin-right: 8px;
}
#avs-next-toast .avs-toast-title {
    flex: 1;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}
#avs-next-toast .avs-toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    cursor: pointer;
    padding: 0 0 0 8px;
    line-height: 1;
}
#avs-next-toast .avs-toast-close:hover {
    color: #fff;
}
#avs-next-toast .avs-toast-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #e62117;
}
#avs-next-toast .avs-toast-btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: #e62117;
    color: #fff;
    box-shadow: 0 3px 10px rgba(230, 33, 23, 0.3);
    transition:
        transform 0.12s,
        opacity 0.12s;
}
#avs-next-toast .avs-toast-btn:hover {
    opacity: 0.9;
}
#avs-next-toast .avs-toast-btn:active {
    transform: scale(0.96);
}
@keyframes avs-slide-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ── Banner Overlay (top, YouTube-style) ───────────────── */
#avs-banner-overlay {
    position: absolute;
    top: 12px; /* top of player */
    left: 50%;
    transform: translateX(-50%);
    z-index: 8;
    display: flex;
    align-items: flex-start;
    max-width: calc(100% - 24px);
    animation: avs-banner-in 0.3s ease;
    pointer-events: auto;
    overflow: visible;
}
.avs-banner-img-link {
    display: block;
    line-height: 0;
}
.avs-banner-img {
    display: block;
    max-height: 80px;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}
.avs-banner-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #e50914;
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 44px;
    min-height: 44px;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.avs-banner-close:hover {
    background: #b0060f;
}
@keyframes avs-banner-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
/* Compact on small breakpoints */
.jw-breakpoint-2 #avs-banner-overlay {
    max-width: calc(100% - 20px);
}
.jw-breakpoint-2 .avs-banner-img {
    max-height: 60px;
}
/* Mobile: tighter top margin, smaller image */
.jw-breakpoint-0 #avs-banner-overlay,
.jw-breakpoint-1 #avs-banner-overlay {
    top: 8px;
    max-width: calc(100% - 16px);
}
.jw-breakpoint-0 .avs-banner-img,
.jw-breakpoint-1 .avs-banner-img {
    max-height: 42px;
}
/* Mobile: nút đóng nhỏ hơn để không chiếm không gian */
.jw-breakpoint-0 .avs-banner-close,
.jw-breakpoint-1 .avs-banner-close {
    width: 20px;
    height: 20px;
    font-size: 10px;
    top: -6px;
    right: -6px;
}

/* ── Pause Ad Overlay (YouTube-style center) ──────────── */
#avs-pause-ad {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    animation: avs-pause-ad-in 0.25s ease;
}
.avs-pause-ad-box {
    position: relative;
    max-width: 80%;
    max-height: 70%;
    text-align: center;
}
.avs-pause-ad-link {
    display: block;
    line-height: 0;
}
.avs-pause-ad-img {
    display: block;
    max-width: 100%;
    max-height: 50vh;
    border-radius: 6px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
    cursor: pointer;
}
.avs-pause-ad-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-family: Arial, sans-serif;
    margin-top: 6px;
    letter-spacing: 0.3px;
}
.avs-pause-ad-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #e50914;
    color: #fff;
    font-size: 14px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    z-index: 1;
    min-width: 44px;
    min-height: 44px;
    transition: background 0.15s;
}
.avs-pause-ad-close:hover {
    background: #b0060f;
}
@keyframes avs-pause-ad-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
/* Compact on small breakpoints */
.jw-breakpoint-0 .avs-pause-ad-box,
.jw-breakpoint-1 .avs-pause-ad-box {
    max-width: 90%;
}
.jw-breakpoint-0 .avs-pause-ad-img,
.jw-breakpoint-1 .avs-pause-ad-img {
    max-height: 35vh;
}

/* ── Ad Cue Markers on Seekbar (YouTube-style yellow dots) ── */
.jw-slider-time .jw-cue,
.jw-slider-time .jw-cue-type-ads {
    background-color: #ffd000 !important;
    width: 4px;
    height: 100%;
    border-radius: 1px;
    opacity: 0.95;
    z-index: 1;
    position: relative;
    cursor: pointer;
}
/* Expand hover hit-area — marker is only 4px wide */
.jw-slider-time .jw-cue::before,
.jw-slider-time .jw-cue-type-ads::before {
    content: "";
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: -6px;
    right: -6px;
}
/* Floating tooltip for ad cue markers (appended to body) */
.avs-cue-tooltip {
    position: fixed;
    background: rgba(0,0,0,0.85);
    color: #ffd000;
    font-size: 11px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.15s;
}
.avs-cue-tooltip.avs-cue-tooltip-visible {
    opacity: 1;
}

/* ── Processing / Error Overlay ──────────────────────────── */
#avs-processing,
#avs-error {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: radial-gradient(ellipse at center, rgba(15,15,15,0.95) 0%, rgba(0,0,0,0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: avs-fade-in 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    box-sizing: border-box;
}
.avs-processing-box {
    text-align: center;
    padding: clamp(20px, 5vw, 32px) clamp(16px, 5vw, 28px);
    max-width: min(340px, 100%);
    width: 100%;
    box-sizing: border-box;
}
.avs-processing-spinner {
    width: clamp(36px, 10vw, 48px);
    height: clamp(36px, 10vw, 48px);
    margin: 0 auto clamp(12px, 4vw, 20px);
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: #e62117;
    border-radius: 50%;
    animation: avs-spin 0.8s linear infinite;
}
.avs-processing-title {
    font-family: Arial, sans-serif;
    font-size: clamp(13px, 3.5vw, 16px);
    font-weight: 700;
    color: #f1f1f1;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}
.avs-processing-msg {
    font-family: Arial, sans-serif;
    font-size: clamp(11px, 3vw, 13px);
    color: rgba(255,255,255,0.5);
    line-height: 1.5;
}
.avs-error-icon {
    width: clamp(36px, 10vw, 48px);
    height: clamp(36px, 10vw, 48px);
    margin: 0 auto clamp(10px, 3vw, 16px);
    border-radius: 50%;
    background: #e62117;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 5vw, 22px);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(230,33,23,0.4);
}
.avs-error-title {
    color: #e62117;
}
.avs-processing-elapsed {
    font-family: Arial, sans-serif;
    font-size: clamp(16px, 5vw, 20px);
    font-weight: 700;
    color: #e62117;
    margin-top: 12px;
    letter-spacing: 1px;
}
.avs-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-top: 14px;
    overflow: hidden;
}
.avs-progress-fill {
    height: 100%;
    width: 0%;
    background: #e62117;
    border-radius: 2px;
    transition: width 0.5s ease;
}
.avs-processing-percent {
    font-family: Arial, sans-serif;
    font-size: clamp(11px, 3vw, 13px);
    color: rgba(255,255,255,0.5);
    margin-top: 6px;
}
@keyframes avs-spin {
    to { transform: rotate(360deg); }
}
