/* ===== SWB Netflix-style custom controls ===== */
#swb-player-wrap {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 50;
}

#swb-controls {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 90px 24px 18px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.55) 45%, transparent 100%);
    font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #fff;
    opacity: 1;
    transition: opacity .25s ease;
    pointer-events: auto;
}

#swb-player-wrap.swb-idle #swb-controls,
#swb-player-wrap.swb-idle #swb-topbar {
    opacity: 0;
    pointer-events: none;
}

#swb-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
    transition: opacity .25s ease;
}

#swb-title {
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* Progress bar */
#swb-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

#swb-progress-track {
    position: relative;
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    cursor: pointer;
    transition: height .12s ease;
}
#swb-progress-track:hover { height: 6px; }

#swb-progress-buffered,
#swb-progress-played {
    position: absolute;
    top: 0; left: 0; height: 100%;
    border-radius: 2px;
}
#swb-progress-buffered { background: rgba(255,255,255,0.4); }
#swb-progress-played { background: #e50914; }

#swb-progress-handle {
    position: absolute;
    top: 50%;
    width: 13px; height: 13px;
    background: #e50914;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity .12s ease;
}
#swb-progress-track:hover #swb-progress-handle { opacity: 1; }

#swb-time {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: #d2d2d2;
    white-space: nowrap;
}

/* Control buttons row */
#swb-controls-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.swb-spacer { flex: 1; }

.swb-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity .15s ease, transform .1s ease;
}
.swb-btn:hover { opacity: 1; transform: scale(1.08); }
.swb-btn svg { width: 26px; height: 26px; fill: currentColor; display: block; }
.swb-btn.swb-btn-lg svg { width: 34px; height: 34px; }
.swb-btn:disabled { opacity: 0.3; cursor: default; transform: none; }

/* Volume */
#swb-volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
#swb-volume-track {
    width: 0;
    overflow: hidden;
    transition: width .18s ease;
}
#swb-volume-wrap:hover #swb-volume-track,
#swb-volume-wrap.swb-vol-active #swb-volume-track {
    width: 80px;
}
#swb-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 74px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
}
#swb-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

/* Menus (captions / quality) */
.swb-menu-wrap { position: relative; }
.swb-menu {
    position: absolute;
    bottom: 44px;
    right: -8px;
    background: rgba(20,20,20,0.95);
    border-radius: 6px;
    min-width: 160px;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px 0;
    box-shadow: 0 4px 18px rgba(0,0,0,0.5);
    display: none;
}
.swb-menu.swb-open { display: block; }
.swb-menu-item {
    padding: 9px 16px;
    font-size: 13.5px;
    cursor: pointer;
    color: #d2d2d2;
    white-space: nowrap;
}
.swb-menu-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.swb-menu-item.swb-active { color: #e50914; font-weight: 600; }

/* Skip Intro */
#swb-skip-intro {
    position: absolute;
    right: 28px;
    bottom: 110px;
    background: rgba(255,255,255,0.9);
    color: #111;
    border: none;
    border-radius: 4px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    z-index: 60;
    transition: background .15s ease;
}
#swb-skip-intro:hover { background: #fff; }
#swb-skip-intro.swb-show { display: block; }

/* Next Episode floating card (auto-advance countdown) */
#swb-next-card {
    position: absolute;
    right: 28px;
    bottom: 110px;
    background: #181818;
    border-radius: 6px;
    overflow: hidden;
    width: 260px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
    display: none;
    z-index: 60;
    cursor: pointer;
}
#swb-next-card.swb-show { display: block; }
#swb-next-card img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
#swb-next-card .swb-next-body { padding: 10px 12px; }
#swb-next-card .swb-next-label { font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: .5px; }
#swb-next-card .swb-next-title { font-size: 14px; font-weight: 600; margin-top: 2px; }

/* Episode selector panel */
#swb-episodes-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 380px;
    max-width: 88vw;
    background: rgba(15,15,15,0.97);
    z-index: 200;
    transform: translateX(100%);
    transition: transform .28s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    color: #fff;
    font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#swb-episodes-panel.swb-open { transform: translateX(0); }
#swb-episodes-panel h3 { margin: 0 0 4px; font-size: 18px; }
#swb-episodes-panel .swb-season-label { color: #999; font-size: 13px; margin: 18px 0 10px; text-transform: uppercase; letter-spacing: .5px; }
#swb-episodes-close {
    position: absolute;
    top: 18px; right: 18px;
    background: none; border: none; color: #fff;
    cursor: pointer; padding: 6px;
}
#swb-episodes-close svg { width: 22px; height: 22px; fill: currentColor; }

.swb-ep-row {
    display: flex;
    gap: 12px;
    padding: 10px 6px;
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
}
.swb-ep-row:hover { background: rgba(255,255,255,0.06); }
.swb-ep-row.swb-ep-current { background: rgba(229,9,20,0.15); }
.swb-ep-thumb {
    width: 100px; height: 56px;
    flex-shrink: 0;
    background: #333 center/cover no-repeat;
    border-radius: 4px;
    position: relative;
}
.swb-ep-current .swb-ep-thumb::after {
    content: "\25B6";
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #e50914; font-size: 18px;
    background: rgba(0,0,0,0.35);
    border-radius: 4px;
}
.swb-ep-num { font-size: 12px; color: #999; }
.swb-ep-title { font-size: 13.5px; margin-top: 2px; }

#swb-episodes-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    display: none;
}
#swb-episodes-overlay.swb-open { display: block; }

/* ===== Mobile ===== */
@media (max-width: 760px) {
    #swb-controls { padding: 60px 14px 14px; }
    #swb-topbar { padding: 14px; }
    #swb-title { font-size: 14px; }
    .swb-btn svg { width: 22px; height: 22px; }
    .swb-btn.swb-btn-lg svg { width: 30px; height: 30px; }
    #swb-volume-wrap { display: none; }
    #swb-skip-intro, #swb-next-card { right: 14px; bottom: 90px; }
    #swb-next-card { width: 200px; }
    #swb-episodes-panel { width: 100%; max-width: 100%; }
}

/* ===== Fullscreen wrapper ===== */
#swb-fullscreen-root {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
#swb-fullscreen-root:fullscreen,
#swb-fullscreen-root:-webkit-full-screen {
    width: 100%;
    height: 100%;
}
#swb-fullscreen-root.swb-pseudo-fullscreen {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 999999;
    background: #000;
}

/* ===== Center loading spinner ===== */
#swb-spinner {
    position: absolute;
    top: 50%; left: 50%;
    width: 54px; height: 54px;
    margin: -27px 0 0 -27px;
    border: 4px solid rgba(255,255,255,0.25);
    border-top-color: #e50914;
    border-radius: 50%;
    display: none;
    z-index: 55;
    pointer-events: none;
    animation: swb-spin 0.8s linear infinite;
}
#swb-spinner.swb-show { display: block; }
@keyframes swb-spin {
    to { transform: rotate(360deg); }
}
