/* ===== Variables & Base ===== */
:root {
    --pvw-primary-color: #3498db;
    --pvw-glass-bg: rgba(255, 255, 255, 0.15);
    --pvw-glass-blur: blur(10px);
}

.pvw-player-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pvw-player-container iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.pvw-player-container.pvw-private-mode::after {
    content: '';
    position: absolute;
    top: 60px;
    bottom: 60px;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 5;
    /* This can be used to add a subtle pattern or more protection if needed */
}

/* Obfuscation Layers for Private Mode */
.pvw-obfuscator-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 10;
    pointer-events: auto;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.4) 70%, transparent);
}

.pvw-obfuscator-bottom {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 150px;
    height: 55px;
    z-index: 30;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.01);
    /* Keep mostly transparent but block clicks over logo */
}

/* Specific cover for YouTube Pause Overlay "More Videos" footer area */
.pvw-private-mode .pvw-obfuscator-bottom {
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
    z-index: 30;
    pointer-events: auto;
    display: none;
}

.pvw-player-container.pvw-private-mode:not(.pvw-is-playing) .pvw-obfuscator-bottom {
    display: block;
    /* Show very dark overlay when paused to hide recommendations */
}

.pvw-private-mode .pvw-video-iframe {
    transform: scale(1.05);
    /* Slight scale to hide edges if needed */
}

/* ===== Protection Overlays ===== */
.pvw-protection-overlay-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
    pointer-events: none;
}

.pvw-protection-overlay-bottom {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 150px;
    height: 45px;
    z-index: 10;
    pointer-events: none;
}

.pvw-full-overlay {
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    height: calc(100% - 120px);
    z-index: 5;
    cursor: pointer;
}

/* ===== Custom Controls ===== */
.pvw-custom-player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7) 60%, transparent);
    padding: 40px 15px 12px;
    z-index: 110;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pvw-custom-player-controls.show,
.pvw-player-container:hover .pvw-custom-player-controls,
.pvw-player-container:hover .pvw-player-top-bar {
    opacity: 1;
}

/* ===== Player Top Bar & Watermark (Hidden by User Request) ===== */
.pvw-player-top-bar,
.pvw-watermark {
    display: none !important;
}

.pvw-player-container.pvw-theme-modern_glass .pvw-custom-player-controls {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    margin: 10px;
    border-radius: 12px;
    padding: 30px 15px 12px;
}

.pvw-player-container.pvw-theme-modern_glass .pvw-big-play-btn {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pvw-player-container.pvw-theme-modern_glass .pvw-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

/* ===== Progress Bar ===== */
.pvw-progress-container {
    position: relative;
    margin-bottom: 10px;
    padding: 5px 0;
    cursor: pointer;
}

.pvw-progress-bar {
    position: relative;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: visible;
}

.pvw-progress-loaded {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    width: 0;
}

.pvw-progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--pvw-primary-color);
    border-radius: 3px;
    width: 0;
}

.pvw-progress-handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 14px;
    height: 14px;
    background: var(--pvw-primary-color);
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

.pvw-progress-container:hover .pvw-progress-handle {
    opacity: 1;
}

.pvw-progress-container:hover .pvw-progress-bar {
    height: 7px;
}

/* ===== Controls Row ===== */
.pvw-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pvw-controls-left,
.pvw-controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Control Buttons ===== */
.pvw-ctrl-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pvw-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.pvw-ctrl-btn svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

/* ===== Volume Control ===== */
.pvw-volume-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pvw-volume-slider-wrap {
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
}

.pvw-volume-control:hover .pvw-volume-slider-wrap {
    width: 70px;
}

.pvw-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 65px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
}

.pvw-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

/* ===== Time Display ===== */
.pvw-time-display {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 0 8px;
    white-space: nowrap;
}

.pvw-time-sep {
    margin: 0 4px;
    opacity: 0.7;
}

/* ===== Speed & Quality Controls ===== */
.pvw-speed-control,
.pvw-quality-control {
    position: relative;
}

.pvw-speed-btn,
.pvw-quality-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
}

.pvw-speed-value,
.pvw-quality-value {
    font-size: 12px;
}

/* ===== Dropdown Menus ===== */
.pvw-dropdown-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
    background: rgba(28, 28, 28, 0.95);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 120px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.pvw-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pvw-menu-item {
    padding: 10px 16px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: right;
}

.pvw-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pvw-menu-item.active {
    color: var(--pvw-primary-color);
    font-weight: 600;
}

.pvw-menu-item.active::before {
    content: '✓ ';
}

/* ===== Big Play Button ===== */
.pvw-big-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    border: 3px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

.pvw-big-play-btn:hover {
    background: rgba(255, 71, 87, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
    border-color: #fff;
}

.pvw-big-play-btn svg {
    width: 30px;
    height: 30px;
    fill: #fff;
    margin-left: 4px;
}

/* ===== Loading Spinner ===== */
.pvw-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 101;
}

.pvw-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--pvw-primary-color);
    border-radius: 50%;
    animation: pvw-spin 0.8s linear infinite;
}

@keyframes pvw-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Watermark ===== */
.pvw-watermark {
    position: absolute;
    z-index: 25;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.5);
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    border-radius: 4px;
    pointer-events: none;
    user-select: none;
}

.pvw-watermark-top-left {
    top: 70px;
    left: 15px;
}

.pvw-watermark-top-right {
    top: 70px;
    right: 15px;
}

.pvw-watermark-bottom-left {
    bottom: 70px;
    left: 15px;
}

.pvw-watermark-bottom-right {
    bottom: 70px;
    right: 15px;
}

.pvw-watermark-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
}

/* ===== Screen Protection ===== */
.pvw-screen-protection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
}

.pvw-screen-warning {
    text-align: center;
    color: #fff;
}

.pvw-screen-warning p {
    font-size: 16px;
    margin-top: 10px;
}

/* ===== Protection States ===== */
.pvw-player-container.pvw-page-hidden iframe,
.pvw-player-container.pvw-window-blur iframe,
.pvw-player-container.pvw-devtools-open iframe,
.pvw-player-container.pvw-screenshot-block iframe {
    filter: blur(30px) brightness(0.3);
    transition: filter 0.3s;
}

/* ===== End Screen (Hides Suggested Videos) ===== */
.pvw-end-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pvw-end-screen-content {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.pvw-end-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #00d2d3, #54a0ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 20px;
    animation: pvw-pulse 2s ease-in-out infinite;
}

@keyframes pvw-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 210, 211, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px 10px rgba(0, 210, 211, 0.3);
    }
}

.pvw-end-screen-content h3 {
    font-size: 28px;
    margin: 0 0 10px;
    font-weight: 600;
}

.pvw-end-screen-content p {
    font-size: 16px;
    opacity: 0.8;
    margin: 0 0 25px;
}

.pvw-replay-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--pvw-primary-color);
    color: #fff;
    border: none;
    padding: 14px 30px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.pvw-replay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.pvw-replay-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ===== Download Warning ===== */
.pvw-download-warning {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pvw-warning-content {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.pvw-warning-content svg {
    width: 60px;
    height: 60px;
    color: var(--pvw-primary-color);
    margin-bottom: 20px;
}

.pvw-warning-content h3 {
    font-size: 24px;
    margin: 0 0 10px;
    color: var(--pvw-primary-color);
}

.pvw-warning-content p {
    font-size: 16px;
    opacity: 0.8;
}

/* ===== Error Message ===== */
.pvw-error {
    background: var(--pvw-primary-color);
    color: #fff;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
}

/* ===== Fullscreen ===== */
.pvw-player-container:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
}

.pvw-player-container:fullscreen iframe {
    height: 100vh;
}

.pvw-player-container:fullscreen .pvw-end-screen,
.pvw-player-container:fullscreen .pvw-custom-player-controls {
    border-radius: 0;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .pvw-ctrl-btn svg {
        width: 18px;
        height: 18px;
    }

    .pvw-time-display {
        font-size: 11px;
    }

    .pvw-big-play-btn {
        width: 55px;
        height: 55px;
    }

    .pvw-big-play-btn svg {
        width: 24px;
        height: 24px;
    }

    .pvw-controls-row {
        gap: 4px;
    }

    .pvw-rewind-btn,
    .pvw-forward-btn {
        display: none;
    }

    .pvw-end-screen-content h3 {
        font-size: 22px;
    }

    .pvw-end-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
}

/* ===== Custom Poster ===== */
.pvw-custom-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.4s ease, visibility 0.4s;
    background-color: #000;
}

.pvw-player-container.pvw-video-started .pvw-custom-poster {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.pvw-poster-play-btn {
    width: 80px;
    height: 80px;
    background: var(--pvw-primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pvw-custom-poster:hover .pvw-poster-play-btn {
    transform: scale(1.1);
}

.pvw-poster-play-btn svg {
    width: 40px;
    height: 40px;
    fill: #fff;
    margin-left: 5px;
}