/* ==========================================================================
   PVD PLAYER SKIN - MODERN VARIABLES & YOUTUBE V3
   ========================================================================== */

body {
    margin: 0;
    padding: 0;
    background: #000;
}

/* Hide unnecessary controls */
button.vjs-seek-to-live-control.vjs-control,
button.vjs-picture-in-picture-control.vjs-control.vjs-button,
.vjs-subs-caps-button {
    display: none;
}

/* Loading state */
.video-js.loading {
    pointer-events: none;
}

.video-js.loading .vjs-big-play-button {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

.vjs-poster img {
    -o-object-fit: cover;
    object-fit: cover;
}

/* Debug panel */
div#debug {
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    bottom: 50px;
    z-index: 999;
    color: red;
    padding-left: 10px;
    overflow-y: auto;
    scrollbar-width: thin;
}

#debug::-webkit-scrollbar {
    width: 0.2em;
}

#debug::-webkit-scrollbar-thumb {
    background: transparent;
}

/* Quality menu scrollbar */
.vjs-menu-content {
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 #666;
}

.vjs-menu-content::-webkit-scrollbar {
    width: 10px;
}

.vjs-menu-content::-webkit-scrollbar-thumb {
    background-color: #666;
}

.vjs-menu-content::-webkit-scrollbar-track {
    background-color: #333;
}

/* Watermark */
#wm {
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0.6;
    width: 60px;
    height: 60px;
    pointer-events: none;
}

:root {
    /* --- COLOR PALETTE VARIABLES (Customizable) --- */
    --pvd-primary: #3ea6ff;
    /* Modern Blue (YouTube Dark Mode Link Color) - User can change to #f00 */
    --pvd-icon: #f1f1f1;
    /* Soft White */
    --pvd-icon-hover: #ffffff;
    /* Bright White */
    --pvd-bg-glass: rgba(15, 15, 15, 0.85);
    /* Dark Glass */
    --pvd-bg-hover: rgba(255, 255, 255, 0.1);

    /* --- SIZES --- */
    --pvd-control-height: 48px;
    --pvd-progress-height: 3px;
    --pvd-progress-hover: 5px;
}

/* --- Base & Typography --- */
.video-js {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--pvd-icon);
}

/* --- Control Bar --- */
.video-js .vjs-control-bar {
    height: var(--pvd-control-height);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 0 10px;
    display: flex;
    align-items: center;
    width: 100%;
}

.video-js .vjs-button {
    color: var(--pvd-icon);
    width: 36px;
    height: 100%;
    cursor: pointer;
}

.video-js .vjs-button:hover {
    color: var(--pvd-icon-hover);
}

.video-js .vjs-button>.vjs-icon-placeholder:before {
    font-size: 22px;
    line-height: var(--pvd-control-height);
}

/* --- Skip Buttons (Restored) --- */
.video-js .vjs-skip-backward-5 .vjs-icon-placeholder:before,
.video-js .vjs-skip-forward-5 .vjs-icon-placeholder:before {
    font-size: 20px;
    /* Slightly smaller than play */
}

/* --- Time Display (Unified & Compact) --- */
/* YouTube Style: "1:00 / 5:00" compacted */
.video-js .vjs-current-time,
.video-js .vjs-time-control,
.video-js .vjs-duration,
.video-js .vjs-time-divider {
    display: block;
    padding: 0;
    min-width: unset;
    line-height: var(--pvd-control-height);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* Group them visually */
.video-js .vjs-current-time {
    margin-left: 8px;
}

.video-js .vjs-time-divider {
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    line-height: var(--pvd-control-height);
}

.video-js .vjs-duration {
    margin-right: 10px;
    color: rgba(255, 255, 255, 0.7);
}

/* Hide remaining time */
.video-js .vjs-remaining-time {
    display: none;
}


/* --- Progress Bar (Slim / Modern) --- */
.video-js .vjs-progress-control {
    position: absolute;
    bottom: var(--pvd-control-height);
    left: 10px;
    /* Slight inset like YouTube mobile or floating */
    right: 10px;
    width: auto;
    height: 10px;
    display: flex;
    align-items: flex-end;
    margin-bottom: 0px;
    transition: all 0.2s;
    z-index: 2;
}

/* Optional: Full width mode if preferred */
.video-js .vjs-progress-control {
    left: 0;
    right: 0;
    bottom: calc(var(--pvd-control-height) - 1px);
}

.video-js .vjs-progress-holder {
    height: var(--pvd-progress-height);
    background: rgba(255, 255, 255, 0.2);
    margin: 0 10px;
    border-radius: 2px;
    transition: height 0.1s linear;
}

.video-js .vjs-progress-control:hover .vjs-progress-holder {
    height: var(--pvd-progress-hover);
    margin: 0;
    /* Expand full width */
}

.video-js .vjs-play-progress {
    background-color: var(--pvd-primary);
}

.video-js .vjs-play-progress:before {
    content: "";
    /* Scrubber DOT */
    font-size: 0;
    position: absolute;
    right: -6px;
    top: 50%;
    margin-top: -6px;
    width: 12px;
    height: 12px;
    background: var(--pvd-primary);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.1s;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.video-js .vjs-progress-control:hover .vjs-play-progress:before {
    transform: scale(1);
}

/* --- Big Play Button (Modern Glass) --- */
.video-js .vjs-big-play-button {
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    line-height: 64px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.video-js .vjs-big-play-button .vjs-icon-placeholder:before {
    font-size: 32px;
    /* Optically center triangle */
}

.video-js:hover .vjs-big-play-button {
    background: var(--pvd-primary);
    transform: translate(-50%, -50%) scale(1.1);
}

/* --- Speed & Quality Menus --- */
.vjs-menu-button-popup .vjs-menu {
    bottom: -5px;
    /* Position above control bar */
    border-top: none;
    width: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

/* Fix for menu cutoff "lên quá hỏm" - Add max-height and overflow */
.vjs-menu-content {
    background: var(--pvd-bg-glass);
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    max-height: 250px;
    /* Prevent it from being too tall */
    overflow-y: auto;
}

.vjs-menu-item {
    font-size: 13px;
    padding: 8px 12px;
    text-align: center;
    color: #ddd;
    text-transform: capitalize;
}

.vjs-menu-item:hover,
.vjs-menu-item.vjs-selected:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    outline: none;
}

.vjs-menu-item.vjs-selected {
    color: var(--pvd-primary);
    background: transparent;
    font-weight: 700;
}

/* Speed button specific text */
.video-js .vjs-playback-rate .vjs-playback-rate-value {
    line-height: var(--pvd-control-height);
    font-size: 13px;
    font-weight: 600;
}

/* --- Volume Panel --- */
.video-js .vjs-volume-panel {
    margin-right: auto;
    /* Push Time/Scrubber? No, Time pushes Right controls */
    margin-right: 0;
}

/* Hover reveal volume */
.video-js .vjs-volume-panel .vjs-volume-control {
    opacity: 0;
    width: 0;
    transition: opacity 0.2s, width 0.2s;
}

.video-js .vjs-volume-panel:hover .vjs-volume-control {
    opacity: 1;
    width: 50px;
}

/* --- Spacer --- */
.video-js .vjs-custom-control-spacer {
    flex: 1;
    /* This takes up all available space between Left and Right controls */
    display: block;
}

/* --- Mobile Tweaks --- */
@media (max-width: 600px) {
    :root {
        --pvd-control-height: 44px;
    }

    .video-js .vjs-time-divider,
    .video-js .vjs-duration {
        display: none !important;
    }

    .video-js .vjs-current-time {
        margin-left: 0;
        font-size: 11px;
    }
}

/* --- Status Overlay (Bezel / Toast) --- */
.vjs-pvd-toast {
    position: absolute;
    top: 15%;
    /* Position at top center */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(28, 28, 28, 0.9);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    /* Let clicks pass through */
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vjs-pvd-toast.vjs-toast-active {
    opacity: 1;
    transform: translateX(-50%) translateY(10px);
}