/* ============================================
   AGC Dracin - Video Player Styles
   ============================================ */

/* Watch Section */
.watch-container {
    padding-top: 1rem;
}

.watch-header {
    padding: 1rem 2%;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.watch-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease;
}

.watch-back:hover {
    color: var(--primary);
}

.watch-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.watch-episode-label {
    color: var(--primary);
    font-weight: 600;
}

/* Player Container */
.player-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background: #000;
    border-radius: 0;
    overflow: hidden;
}

.player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    overflow: hidden;
}

.player-container video,
.player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* Player Overlay — background-image set via JS (poster) */
.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* gradient di atas poster image */
    background-color: #000;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    z-index: 10;
    cursor: pointer;
    transition: opacity 0.4s ease;
}

/* Dark overlay di atas background poster */
.player-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.3) 0%,
        rgba(0,0,0,0.5) 50%,
        rgba(0,0,0,0.75) 100%
    );
    z-index: 0;
}

.player-overlay > * {
    position: relative;
    z-index: 1;
}

.player-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Saat video sedang play, overlay tetap bisa dimunculkan saat pause */
.player-overlay.playing-state {
    /* tidak visible tapi hover akan show pause icon */
}

.player-big-play {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 30px rgba(231, 76, 60, 0.6), 0 0 0 12px rgba(231,76,60,0.15);
    margin-bottom: 1.5rem;
}

.player-big-play:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 40px rgba(231, 76, 60, 0.8), 0 0 0 16px rgba(231,76,60,0.2);
}

/* Info teks di overlay */
.player-overlay-info {
    text-align: center;
    color: white;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.player-overlay-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
    max-width: 600px;
    line-height: 1.3;
}

.player-overlay-ep {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 0.5rem;
}

.player-overlay-hint {
    font-size: 0.8rem;
    opacity: 0.55;
    letter-spacing: 0.03em;
}

/* Custom Controls */
.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    padding: 2rem 1rem 0.8rem;
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-container:hover .player-controls,
.player-controls.visible {
    opacity: 1;
}

/* Progress Bar */
.progress-container {
    position: relative;
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 0.6rem;
    transition: height 0.2s ease;
}

.progress-container:hover {
    height: 8px;
}

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

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
    transition: transform 0.2s ease;
}

.progress-container:hover .progress-bar::after {
    transform: translateY(-50%) scale(1);
}

.progress-tooltip {
    position: absolute;
    top: -30px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    transform: translateX(-50%);
    display: none;
    white-space: nowrap;
}

.progress-container:hover .progress-tooltip {
    display: block;
}

/* Control Buttons */
.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ctrl-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 50%;
    font-size: 1rem;
    transition: all 0.2s ease;
}

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

.ctrl-btn.active {
    color: var(--primary);
}

/* Volume Slider */
.volume-wrapper {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.volume-slider {
    width: 0;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: width 0.3s ease;
    overflow: hidden;
}

.volume-wrapper:hover .volume-slider {
    width: 80px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: -200px 0 0 195px var(--primary);
}

/* Time Display */
.time-display {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    padding: 0 0.5rem;
}

/* Playback Speed */
.speed-menu {
    position: absolute;
    bottom: 100%;
    right: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0;
    display: none;
    z-index: 20;
    box-shadow: var(--shadow-lg);
}

.speed-menu.visible {
    display: block;
}

.speed-option {
    padding: 0.5rem 1.5rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.speed-option:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--primary);
}

.speed-option.active {
    color: var(--primary);
    font-weight: 700;
}

/* Subtitle Styles */
.subtitle-display {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 12;
    pointer-events: none;
    width: 90%;
    max-width: 800px;
}

.subtitle-text {
    display: inline-block;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1.5;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.subtitle-text.chinese {
    font-family: 'Noto Sans SC', sans-serif;
    font-size: 0.95rem;
    color: #ffeb3b;
    display: block;
    margin-top: 0.3rem;
}

/* Subtitle Menu */
.subtitle-menu {
    position: absolute;
    bottom: 100%;
    right: 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0;
    display: none;
    z-index: 20;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
}

.subtitle-menu.visible {
    display: block;
}

.subtitle-menu-header {
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.3rem;
}

.subtitle-option {
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.subtitle-option:hover {
    background: rgba(231, 76, 60, 0.1);
}

.subtitle-option.active {
    color: var(--primary);
}

.subtitle-option.active::before {
    content: '✓';
    color: var(--primary);
    font-weight: 700;
}

/* Watch Bottom Section */
.watch-info {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2%;
}

.watch-info-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

.watch-drama-info h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.watch-drama-chinese {
    font-family: 'Noto Sans SC', sans-serif;
    color: var(--accent);
    margin-bottom: 0.8rem;
}

.watch-drama-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.watch-drama-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Episode List Sidebar */
.watch-episodes {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.watch-episodes h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.watch-ep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.4rem;
}

.watch-ep-btn {
    padding: 0.5rem;
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watch-ep-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.watch-ep-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Server Tabs */
.server-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.server-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.server-tab:hover {
    border-color: var(--primary);
}

.server-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Download Section */
.download-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2%;
}

.download-links {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover {
    border-color: #2ecc71;
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.download-btn i {
    color: #2ecc71;
}

/* Comments Section (Placeholder) */
.comments-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2%;
    border-top: 1px solid var(--border-color);
}

.comments-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.comment-form {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.comment-form input {
    flex: 1;
    padding: 0.8rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

.comment-form input:focus {
    border-color: var(--primary);
}

.comment-form button {
    padding: 0.8rem 1.5rem;
    background: var(--primary);
    color: white;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.comment-form button:hover {
    background: var(--primary-dark);
}

/* Double-Tap Feedback */
.skip-feedback {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 2rem;
    pointer-events: none;
    opacity: 0;
    animation: skipAnim 0.5s ease forwards;
    z-index: 20;
}

.skip-feedback.left { left: 15%; }
.skip-feedback.right { right: 15%; }

@keyframes skipAnim {
    0% { opacity: 1; transform: translateY(-50%) scale(1); }
    100% { opacity: 0; transform: translateY(-50%) scale(1.5); }
}


/* ══════════════════════════════════════════
   Server Control Panel & Status Styles
══════════════════════════════════════════ */
.server-control-panel {
    max-width: 1200px;
    margin: 0 auto 0.8rem;
    padding: 0.8rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.server-selector-tabs {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}

.server-selector-tabs .server-tab {
    padding: 0.55rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.server-selector-tabs .server-tab:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.server-selector-tabs .server-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.server-info-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ext-watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid rgba(255, 0, 0, 0.4);
    border-radius: 6px;
    color: #ff4d4d;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ext-watch-btn:hover {
    background: #ff0000;
    color: white;
    transform: translateY(-1px);
}

.server-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #2ecc71;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
    animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ============================================================
   IN-APP PERSISTENT MINI-PLAYER (PIP MODE)
   Keeps video playing continuously when navigating between pages
   ============================================================ */

/* When Watch page is minimized during background playback */
#page-watch.page-minimized-watch {
    display: block !important;
    position: static !important;
    min-height: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: visible !important;
    visibility: visible !important;
    pointer-events: none !important;
    animation: none !important;
}

#page-watch.page-minimized-watch #watchSection {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: visible !important;
}

#page-watch.page-minimized-watch .watch-container {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: visible !important;
}

/* Hide all watch page elements EXCEPT the floating player wrapper */
#page-watch.page-minimized-watch .watch-container > *:not(#playerWrapper) {
    display: none !important;
}

/* Floating Mini-Player Container */
.player-wrapper.player-floating-pip {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    width: 380px !important;
    max-width: calc(100vw - 32px) !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85), 0 0 0 2px rgba(231, 76, 60, 0.85) !important;
    background: #050508 !important;
    pointer-events: auto !important;
    z-index: 999999 !important;
    overflow: hidden !important;
    animation: pipPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.player-wrapper.player-floating-pip:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.95), 0 0 0 2px var(--primary) !important;
}

@keyframes pipPopIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.88);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Floating PiP Top Control Bar */
.floating-pip-bar {
    display: none;
}

.player-wrapper.player-floating-pip .floating-pip-bar {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 38px;
    background: linear-gradient(to bottom, rgba(10, 10, 16, 0.96) 0%, rgba(10, 10, 16, 0.75) 70%, transparent 100%);
    padding: 0 10px;
    align-items: center;
    justify-content: space-between;
    z-index: 200;
    backdrop-filter: blur(6px);
    pointer-events: auto;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.floating-pip-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.floating-pip-info:hover .floating-pip-title {
    color: var(--primary);
}

.floating-pip-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(231, 76, 60, 0.22);
    color: var(--primary);
    border: 1px solid rgba(231, 76, 60, 0.45);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pip-pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: pipPulse 1.4s infinite;
}

@keyframes pipPulse {
    0% {
        transform: scale(0.85);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(0.85);
        opacity: 0.7;
    }
}

.floating-pip-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.floating-pip-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pip-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.72rem;
    transition: background 0.2s, transform 0.15s;
}

.pip-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.pip-close-btn:hover {
    background: #e74c3c !important;
    color: #fff !important;
}

/* Adjust Back to Top button when Mini-Player is active so they don't overlap */
body.has-mini-player .back-to-top {
    bottom: 245px !important;
    right: 24px !important;
}

/* Responsiveness for small screens */
@media (max-width: 600px) {
    .player-wrapper.player-floating-pip {
        bottom: 16px !important;
        right: 12px !important;
        width: min(300px, 78vw) !important;
        max-width: none !important;
    }
    .floating-pip-title {
        max-width: 110px;
    }
    body.has-mini-player .back-to-top {
        bottom: 195px !important;
        right: 12px !important;
    }
}

/* ============================================================
   FULLSCREEN 300x250 POPUP WINDOW (IN-PLAYER OVERLAY)
   ============================================================ */
.fullscreen-popup-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 324px;
    max-width: 95vw;
    background: #0f1016;
    border: 2px solid rgba(231, 76, 60, 0.85);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 30px rgba(231, 76, 60, 0.45);
    z-index: 2147483647 !important;
    overflow: hidden;
    animation: popupWinIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

@keyframes popupWinIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.popup-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: linear-gradient(135deg, #1f2029 0%, #14151e 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.popup-window-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
}

.popup-badge {
    background: rgba(231, 76, 60, 0.25);
    color: var(--primary, #e74c3c);
    border: 1px solid rgba(231, 76, 60, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.popup-close-btn {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.5);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.popup-close-btn:hover {
    background: #e74c3c;
    color: #fff;
    transform: scale(1.05);
}

.popup-window-body {
    width: 300px;
    height: 250px;
    margin: 8px auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
    border-radius: 6px;
}

.fullscreen-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.4);
    border-radius: 6px;
    color: var(--primary, #e74c3c);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fullscreen-header-btn:hover {
    background: var(--primary, #e74c3c);
    color: #fff;
    transform: translateY(-1px);
}

/* Fullscreen player wrapper layout */
#playerWrapper:fullscreen,
#playerWrapper:-webkit-full-screen,
#playerWrapper.css-pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: #000 !important;
    z-index: 9999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#playerWrapper:fullscreen .player-container,
#playerWrapper:-webkit-full-screen .player-container,
#playerWrapper.css-pseudo-fullscreen .player-container {
    width: 100% !important;
    height: 100% !important;
    padding-top: 0 !important;
}

/* Posisi Default: Pojok Kanan Bawah (Ramah Penonton, Bebas Subtitle) */
#playerWrapper:fullscreen #fullscreenPopupAd,
#playerWrapper:-webkit-full-screen #fullscreenPopupAd,
#playerWrapper.css-pseudo-fullscreen #fullscreenPopupAd,
#playerWrapper:fullscreen #fullscreenPopupAd.pos-bottom-right,
#playerWrapper:-webkit-full-screen #fullscreenPopupAd.pos-bottom-right,
#playerWrapper.css-pseudo-fullscreen #fullscreenPopupAd.pos-bottom-right {
    position: fixed !important;
    top: auto !important;
    left: auto !important;
    bottom: 25px !important;
    right: 25px !important;
    transform: none !important;
    z-index: 2147483647 !important;
    animation: popupSlideInBR 0.35s ease-out !important;
}

/* Opsi Posisi Tengah Layar */
#playerWrapper:fullscreen #fullscreenPopupAd.pos-center,
#playerWrapper:-webkit-full-screen #fullscreenPopupAd.pos-center,
#playerWrapper.css-pseudo-fullscreen #fullscreenPopupAd.pos-center {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2147483647 !important;
    animation: popupWinIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes popupSlideInBR {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 640px) {
    #playerWrapper:fullscreen #fullscreenPopupAd,
    #playerWrapper:-webkit-full-screen #fullscreenPopupAd,
    #playerWrapper.css-pseudo-fullscreen #fullscreenPopupAd,
    #playerWrapper:fullscreen #fullscreenPopupAd.pos-bottom-right,
    #playerWrapper:-webkit-full-screen #fullscreenPopupAd.pos-bottom-right,
    #playerWrapper.css-pseudo-fullscreen #fullscreenPopupAd.pos-bottom-right {
        bottom: 12px !important;
        right: 12px !important;
        max-width: calc(100vw - 24px) !important;
    }
}

/* Floating Corner Fullscreen Button on Video */
.player-floating-fs-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(15, 16, 22, 0.88);
    border: 1px solid rgba(231, 76, 60, 0.65);
    border-radius: 8px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    transition: all 0.25s ease;
}

.player-floating-fs-btn:hover {
    background: #e74c3c;
    border-color: #e74c3c;
    transform: scale(1.05);
}

#playerWrapper:fullscreen .player-floating-fs-btn,
#playerWrapper:-webkit-full-screen .player-floating-fs-btn,
#playerWrapper.css-pseudo-fullscreen .player-floating-fs-btn {
    display: none;
}

/* ============================================================
   SUB-EPISODE SELECTOR & NAVIGATION CONTROLS
   ============================================================ */

/* Quick Episode Navigation Bar (Prev / Next under player) */
.watch-ep-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    margin: 0.8rem auto;
}

.ep-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ep-nav-btn:hover:not(.disabled):not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

.ep-nav-btn.disabled,
.ep-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.ep-nav-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
    justify-content: center;
}

.ep-nav-badge {
    background: rgba(231, 76, 60, 0.15);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.ep-nav-num {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.ep-nav-total {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Episode Card on Watch Page */
.watch-episodes-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.2rem;
}

.watch-episodes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.watch-episodes-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.watch-ep-count {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
}

.watch-episodes-progress {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Range Tabs (e.g. 1-25, 26-50) */
.ep-range-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
}

.ep-range-tab {
    padding: 0.35rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ep-range-tab:hover {
    color: var(--text-primary);
    border-color: var(--primary);
}

.ep-range-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Episode Grid Buttons */
.watch-ep-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 0.45rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.watch-ep-btn {
    position: relative;
    padding: 0.6rem 0.3rem;
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.watch-ep-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    background: rgba(231, 76, 60, 0.08);
}

.watch-ep-btn.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.watch-ep-btn.watched:not(.active) {
    background: rgba(46, 204, 113, 0.12);
    border-color: rgba(46, 204, 113, 0.5);
    color: #2ecc71;
}

.watch-ep-btn .ep-check {
    font-size: 0.65rem;
    margin-top: 2px;
    color: #2ecc71;
}

.watch-ep-btn.active .ep-check {
    color: #fff;
}

/* Episode Verification Dots & Badges */
.watch-ep-btn .ep-dot,
.episode-btn .ep-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    margin-top: 3px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.watch-ep-btn .ep-dot.verified,
.episode-btn .ep-dot.verified {
    background: #2ecc71;
    box-shadow: 0 0 5px rgba(46, 204, 113, 0.7);
}

.watch-ep-btn .ep-dot.vip,
.episode-btn .ep-dot.vip {
    background: #f39c12;
    box-shadow: 0 0 5px rgba(243, 156, 18, 0.7);
}

.watch-ep-btn.active .ep-dot,
.episode-btn.active .ep-dot {
    background: #fff !important;
    box-shadow: none !important;
}

.watch-ep-legend {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border-color);
    flex-wrap: wrap;
}

.watch-ep-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.watch-ep-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.watch-ep-legend-dot.verified {
    background: #2ecc71;
    box-shadow: 0 0 4px rgba(46, 204, 113, 0.5);
}

.watch-ep-legend-dot.vip {
    background: #f39c12;
    box-shadow: 0 0 4px rgba(243, 156, 18, 0.5);
}

.watch-ep-legend-dot.watched {
    background: var(--primary);
}

@media (max-width: 600px) {
    .watch-ep-nav-bar {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    .watch-ep-nav-bar .ep-nav-btn {
        width: 100%;
        justify-content: center;
    }
}
