/* ---------------------------------------------------------
   VIDEO LIST – SPOTIFY STYLE PROFESSIONAL UI
--------------------------------------------------------- */

/* ---------------------------------------------------------
   VIDEO PANEL HEADER – Search & Toggle Redesign
--------------------------------------------------------- */

#panelVideo .episode-panel-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

#panelVideo .episode-panel-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

#panelVideo .episode-panel-title-row h5 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
}

#panelVideo .episode-count-badge {
    background: linear-gradient(135deg, #6f42c1, #1db954);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

#panelVideo .episode-panel-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

#panelVideo .episode-search-wrap {
    position: relative;
    flex: 0 1 280px;
    min-width: 150px;
}

#panelVideo .episode-search-wrap i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    pointer-events: none;
}

#panelVideo .episode-search {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#panelVideo .episode-search:focus {
    outline: none;
    border-color: rgba(111, 66, 193, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.15);
}

#panelVideo .episode-search::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#panelVideo #videoViewToggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#panelVideo #videoViewToggle:hover {
    background: rgba(111, 66, 193, 0.2);
    border-color: rgba(111, 66, 193, 0.4);
    color: #fff;
    transform: translateY(-1px);
}

#panelVideo #videoViewToggle:active {
    transform: translateY(0);
}

/* Responsive: stack on mobile */
@media (max-width: 480px) {
    #panelVideo .episode-panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    #panelVideo .episode-panel-controls {
        justify-content: stretch;
    }
    
    #panelVideo .episode-search-wrap {
        flex: 1;
        min-width: unset;
    }
}

/* Light mode overrides */
.light-mode #panelVideo .episode-panel-title-row h5,
html:not(.dark-mode) #panelVideo .episode-panel-title-row h5 {
    color: #0b1220;
}

.light-mode #panelVideo .episode-search-wrap i,
html:not(.dark-mode) #panelVideo .episode-search-wrap i {
    color: rgba(15, 23, 42, 0.4);
}

.light-mode #panelVideo .episode-search,
html:not(.dark-mode) #panelVideo .episode-search {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(16, 24, 40, 0.12);
    color: #0b1220;
}

.light-mode #panelVideo .episode-search::placeholder,
html:not(.dark-mode) #panelVideo .episode-search::placeholder {
    color: rgba(15, 23, 42, 0.4);
}

.light-mode #panelVideo #videoViewToggle,
html:not(.dark-mode) #panelVideo #videoViewToggle {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(16, 24, 40, 0.1);
    color: rgba(15, 23, 42, 0.7);
}

.light-mode #panelVideo #videoViewToggle:hover,
html:not(.dark-mode) #panelVideo #videoViewToggle:hover {
    background: rgba(111, 66, 193, 0.1);
    border-color: rgba(111, 66, 193, 0.3);
    color: #6f42c1;
}

/* ---------------------------------------------------------
   VIDEO LIST ITEMS
--------------------------------------------------------- */

.video-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

/* --- Video Item Wrapper (LIST VIEW - horizontal row) --- */
.video-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;

    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(10px);
    border-radius: 12px;

    transition: 0.25s ease;
    border: 1px solid rgba(255,255,255,0.05);
}

/* Responsive padding for smaller screens */
@media (max-width: 640px) {
    .video-item {
        gap: 10px;
        padding: 10px 12px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .video-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }
}

/* Hover Elevation */
.video-item:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
}

@media (max-width: 640px) {
    .video-item:hover {
        transform: none; /* Disable hover transform on touch devices */
    }
}

/* --- Thumbnail (LIST VIEW - fixed small size) --- */
.video-thumb-wrapper {
    position: relative;
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    height: 68px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #0a0f1a;
    box-shadow: 0 4px 12px rgba(3, 7, 18, 0.3);
}

.video-thumb-wrapper::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,0.6) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.video-item:hover .video-thumb-wrapper::after {
    opacity: 1;
}

.video-thumb-wrapper .video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.video-pill {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(8, 47, 73, 0.9);
    color: #cfe0ff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

@media (max-width: 640px) {
    .video-thumb-wrapper {
        width: 100px;
        min-width: 100px;
        max-width: 100px;
        height: 56px;
    }
}

@media (max-width: 480px) {
    .video-thumb-wrapper {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
        height: 45px;
        border-radius: 8px;
    }
    .video-pill {
        top: 4px;
        left: 4px;
        font-size: 9px;
        padding: 2px 5px;
    }
}

/* --- Metadata --- */
.video-meta {
    flex: 1;
    min-width: 0; /* Enable text truncation */
}

.video-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .video-title {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .video-title {
        font-size: 12px;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

.video-duration {
    font-size: 11px;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.65);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 480px) {
    .video-duration {
        font-size: 11px;
    }
}

.video-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.video-episode-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
}

.video-meta-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.video-tag {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}

.video-tag.video-platform {
    background: rgba(13,110,253,0.2);
    color: #8ec5ff;
}

.video-tag.video-quality {
    background: rgba(255,255,255,0.14);
    color: #f8fafc;
}

/* --- Play Button --- */
.video-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-actions .play-now {
    border-radius: 50%;
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #0066ff;
    border: none !important;
    color: #fff;

    transition: 0.2s ease;
}

@media (max-width: 640px) {
    .video-actions .play-now {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .video-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
    .video-actions .play-now {
        width: 32px;
        height: 32px;
    }
}

.video-actions .play-now:hover {
    background: #1d7aff;
    transform: scale(1.08);
}

@media (max-width: 640px) {
    .video-actions .play-now:hover {
        transform: none;
    }
}

/* --- Hidden State for tabs --- */
.hidden-tab {
    display: none !important;
}

/* --- Hidden video items (search filtering) --- */
.video-item.d-none,
.video-list .video-item.d-none,
.video-list.video-grid-view .video-item.d-none {
    display: none !important;
}

/* ---------------------------------------------------------
   VIDEO LIST – GRID VIEW MODE (5 per row on desktop)
--------------------------------------------------------- */

/* Grid view toggle - 5 columns on desktop */
.video-list.video-grid-view {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 14px;
    width: 100%;
}

/* Extra large desktop: 5 columns */
@media (min-width: 1200px) {
    .video-list.video-grid-view {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 16px;
    }
}

/* Large desktop: 5 columns */
@media (min-width: 992px) and (max-width: 1199px) {
    .video-list.video-grid-view {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 12px;
    }
}

/* Desktop/Tablet: 4 columns */
@media (min-width: 768px) and (max-width: 991px) {
    .video-list.video-grid-view {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px;
    }
}

/* Tablet: 3 columns */
@media (min-width: 576px) and (max-width: 767px) {
    .video-list.video-grid-view {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px;
    }
}

/* Mobile: 2 columns */
@media (max-width: 575px) {
    .video-list.video-grid-view {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
}

/* Video item in grid view - compact card for 5 per row */
.video-list.video-grid-view .video-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0 !important;
    gap: 0 !important;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.video-list.video-grid-view .video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
}

/* Thumbnail in grid view - 16:9 aspect ratio, full width */
.video-list.video-grid-view .video-thumb-wrapper {
    width: 100% !important;
    min-width: unset !important;
    max-width: none !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #0a0f1a;
}

/* Ensure thumbnail image covers the container properly */
.video-list.video-grid-view .video-thumb-wrapper .video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
}

/* Make wrapper position relative for absolute image */
.video-list.video-grid-view .video-thumb-wrapper {
    position: relative;
}

.video-list.video-grid-view .video-thumb-wrapper::after {
    opacity: 0.4;
}

/* Meta section in grid view - compact padding */
.video-list.video-grid-view .video-meta {
    padding: 8px 10px 10px;
    flex: unset;
}

/* Title in grid view - smaller for 5 columns */
.video-list.video-grid-view .video-title {
    font-size: 12px;
    font-weight: 600;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    margin-bottom: 0;
    overflow: hidden;
}

@media (max-width: 575px) {
    .video-list.video-grid-view .video-title {
        font-size: 10px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    .video-list.video-grid-view .video-meta {
        padding: 6px 8px 8px;
    }
}

/* Meta top row in grid - hide duration on small cards */
.video-list.video-grid-view .video-meta-top {
    display: none;
}

/* Meta bottom in grid - smaller tags */
.video-list.video-grid-view .video-meta-bottom {
    margin-top: 4px;
}

.video-list.video-grid-view .video-tag {
    font-size: 8px;
    padding: 2px 5px;
}

/* Hide pill on very small screens */
@media (max-width: 575px) {
    .video-list.video-grid-view .video-pill {
        font-size: 8px;
        padding: 2px 4px;
    }
}

/* Actions in grid view - overlay on hover */
.video-list.video-grid-view .video-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
    opacity: 0;
    transition: opacity 0.2s ease;
    width: auto;
    margin: 0;
    z-index: 5;
}

.video-list.video-grid-view .video-item {
    position: relative;
}

.video-list.video-grid-view .video-item:hover .video-actions {
    opacity: 1;
}

/* Play button in grid - smaller for 5 columns */
.video-list.video-grid-view .video-actions .play-now {
    width: 40px;
    height: 40px;
    font-size: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #1db954, #6f42c1);
    border: none !important;
}

.video-list.video-grid-view .video-actions .play-now:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(29, 185, 84, 0.4);
}

@media (max-width: 575px) {
    .video-list.video-grid-view .video-actions .play-now {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    /* Always show play button on mobile (no hover) */
    .video-list.video-grid-view .video-actions {
        opacity: 1;
    }
}

/* Thumbnail overlay gradient for grid view */
.video-list.video-grid-view .video-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.25), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1;
    border-radius: 12px 12px 0 0;
}

.video-list.video-grid-view .video-item:hover::before {
    opacity: 1;
}

@media (max-width: 480px) {
    .video-list.video-grid-view .video-item::before {
        opacity: 0.4;
    }
}

/* Tab buttons styling to match site theme */
/* Make sure the button group stretches to full width and centers its tabs */
.btn-group.episode-tabs,
.episode-tabs {
    display: flex;
    justify-content: center; /* center the tabs */
    align-items: center;
    gap: 18px; /* spacing between tabs */
    margin: 10px 0 18px 0;
    width: 100%;
}
.episode-tabs .tab-btn {
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
    background: transparent;
    padding: 8px 14px;
    border-radius: 999px;
    margin-right: 0; /* spacing controlled by gap */
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: transform 0.12s ease, background 120ms ease, color 120ms ease;
    min-width: 88px;
    text-align: center;
    font-size: 14px;
}
.episode-tabs .tab-btn.active {
    background: linear-gradient(90deg, rgba(111,66,193,0.95), rgba(29,185,84,0.95));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 28px rgba(29,185,84,0.07);
    transform: translateY(-2px);
}

/* Light mode: adjust tab colors for better contrast */
.light-mode .episode-tabs .tab-btn {
    border: 1px solid rgba(0,0,0,0.06);
    color: rgba(0,0,0,0.85);
    background: transparent;
}
.light-mode .episode-tabs .tab-btn.active {
    background: linear-gradient(90deg, rgba(111,66,193,0.95), rgba(29,185,84,0.95));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 28px rgba(29,185,84,0.06);
}




/* ---------------------------------------------------------
   FLOATING VIDEO PLAYER – FULLY RESPONSIVE REDESIGN
--------------------------------------------------------- */

#videoPlayerRoot {
    position: fixed;
    z-index: 9999;
    transition: transform 220ms ease, opacity 160ms ease;
    display: none;
}

/* Desktop: floating bottom-right */
@media (min-width: 769px) {
    #videoPlayerRoot {
        right: 22px;
        bottom: 22px;
        width: 480px;
        max-width: calc(100vw - 44px);
    }
}

/* Tablet: larger floating player */
@media (min-width: 641px) and (max-width: 768px) {
    #videoPlayerRoot {
        right: 16px;
        bottom: 16px;
        left: 16px;
        width: auto;
        max-width: 100%;
    }
}

/* Mobile: full-width bottom sheet style */
@media (max-width: 640px) {
    #videoPlayerRoot {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }
    #videoPlayerRoot .video-shell {
        border-radius: 16px 16px 0 0;
    }
}

#videoPlayerRoot .video-shell {
    background: #0b0f19;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0,0,0,0.7);
    position: relative;
}

#videoPlayerRoot[style*="display: block"] { opacity: 1; transform: translateY(0); }
#videoPlayerRoot[style*="display: none"] { opacity: 0; transform: translateY(12px); }

#videoPlayerRoot .video-stage {
    position: relative;
    width: 100%;
    background: #000;
    aspect-ratio: 16 / 9;
    min-height: 180px;
    max-height: 60vh;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 9) {
    #videoPlayerRoot .video-stage {
        padding-top: 56.25%; /* 16:9 ratio */
        height: 0;
    }
    #videoPlayerRoot .video-stage > video,
    #videoPlayerRoot .video-stage > iframe {
        position: absolute;
        top: 0;
        left: 0;
    }
}

#videoPlayerRoot video,
#videoPlayerRoot iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
    background: #000;
    pointer-events: auto;
    object-fit: contain;
}

/* Responsive max-height for video/iframe */
@media (max-width: 640px) {
    #videoPlayerRoot .video-stage {
        max-height: 45vh;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    #videoPlayerRoot .video-stage {
        max-height: 50vh;
    }
}

#videoPlayerRoot .big-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(29,185,84,1), rgba(111,66,193,1));
    border: none;
    color: #fff;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 8px 40px rgba(29,185,84,0.14), inset 0 -6px 18px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
    z-index: 2;
}

@media (min-width: 769px) {
    #videoPlayerRoot .big-play {
        width: 88px;
        height: 88px;
        font-size: 34px;
    }
}

@media (max-width: 480px) {
    #videoPlayerRoot .big-play {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
}

#videoPlayerRoot .big-play:hover { transform: translate(-50%, -50%) scale(1.04); }

#videoPlayerRoot .big-play::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 120px; height: 120px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(29,185,84,0.08), transparent 30%);
    z-index: -1;
}

@keyframes pulse {
    0% { box-shadow: 0 8px 24px rgba(29,185,84,0.12); transform: translate(-50%,-50%) scale(1); }
    50% { box-shadow: 0 16px 48px rgba(29,185,84,0.07); transform: translate(-50%,-50%) scale(1.04); }
    100% { box-shadow: 0 8px 24px rgba(29,185,84,0.12); transform: translate(-50%,-50%) scale(1); }
}

#videoPlayerRoot .big-play { animation: pulse 3s ease-in-out infinite; }

#videoPlayerRoot .video-controls {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: linear-gradient(180deg, rgba(11,15,25,0.5), rgba(11,15,25,0.95));
}

@media (max-width: 480px) {
    #videoPlayerRoot .video-controls {
        padding: 10px 12px;
    }
}

#videoPlayerRoot .controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

#videoPlayerRoot .progress-wrap { 
    flex: 1; 
    min-width: 100px;
}

#videoPlayerRoot .progress {
    position: relative;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}

@media (min-width: 769px) {
    #videoPlayerRoot .progress {
        height: 8px;
    }
}

#videoPlayerRoot .progress-buffer {
    position: absolute; left: 0; top: 0; bottom: 0; width: 0;
    background: rgba(255,255,255,0.08);
}

#videoPlayerRoot .progress-play {
    position: absolute; left: 0; top: 0; bottom: 0; width: 0;
    background: linear-gradient(90deg, rgba(29,185,84,0.9), rgba(111,66,193,0.9));
    box-shadow: 0 10px 30px rgba(29,185,84,0.05);
}

#videoPlayerRoot .time-labels {
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (min-width: 769px) {
    #videoPlayerRoot .time-labels {
        font-size: 13px;
    }
}

#videoPlayerRoot .ctrls { 
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

#videoPlayerRoot .ctrls .btn { margin-left: 0; }

#videoPlayerRoot .btn-ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}

#videoPlayerRoot .btn-ghost:hover { background: rgba(255,255,255,0.02); transform: translateY(-2px);} 

#videoPlayerRoot .btn-outline-light { 
    border: 1px solid rgba(255,255,255,0.12); 
    color: #fff; 
    background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.0)); 
    padding: 6px 10px; 
    border-radius: 8px; 
}
#videoPlayerRoot .btn-outline-light:hover { transform: translateY(-2px); }

/* Video header with title and nav buttons */
#videoPlayerRoot .video-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 40px 0 0; /* space for close button */
}

#videoPlayerRoot .video-title { 
    color: #fff; 
    font-weight: 600; 
    font-size: 13px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

/* Video navigation buttons (prev/next) */
#videoPlayerRoot .video-nav-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

#videoPlayerRoot .btn-video-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: background 150ms ease, opacity 150ms ease, transform 100ms ease;
}

#videoPlayerRoot .btn-video-nav:hover:not(:disabled) {
    background: rgba(255,255,255,0.15);
    transform: scale(1.05);
}

#videoPlayerRoot .btn-video-nav:active:not(:disabled) {
    transform: scale(0.95);
}

#videoPlayerRoot .btn-video-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#videoPlayerRoot .btn-video-nav svg {
    width: 16px;
    height: 16px;
}

@media (min-width: 769px) {
    #videoPlayerRoot .video-title {
        font-size: 14px;
    }
    #videoPlayerRoot .btn-video-nav {
        width: 34px;
        height: 34px;
    }
    #videoPlayerRoot .btn-video-nav svg {
        width: 18px;
        height: 18px;
    }
}

/* When an iframe embed is shown we hide interactive controls, but keep the close button visible */
#videoPlayerRoot.embed-mode .big-play,
#videoPlayerRoot.embed-mode .progress-play,
#videoPlayerRoot.embed-mode .progress-buffer,
#videoPlayerRoot.embed-mode .time-labels,
#videoPlayerRoot.embed-mode .progress-wrap {
    display: none !important;
}

/* Close button - always visible and accessible */
#videoPlayerRoot .video-close {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 10002;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

@media (min-width: 769px) {
    #videoPlayerRoot .video-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
        right: 12px;
        top: 12px;
    }
}

#videoPlayerRoot .video-close:hover { 
    background: rgba(255,255,255,0.1); 
    transform: scale(1.05); 
}

/* Hover and focus states for better accessibility */
.episode-tabs .tab-btn:hover, .episode-tabs .tab-btn:focus {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.03);
}

/* Dark mode explicit styles (default is dark but ensure contrast for all variants) */
.dark-mode .episode-tabs .tab-btn {
    border: 1px solid rgba(195, 13, 13, 0.06);
    color: rgba(255,255,255,0.92);
    background: transparent;
}
.episode-tabs .tab-btn.active,
.btn-group.episode-tabs .btn.tab-btn.active,
.light-mode .episode-tabs .tab-btn.active,
.dark-mode .episode-tabs .tab-btn.active {
    background: linear-gradient(90deg, rgba(111,66,193,0.95), rgba(29,185,84,0.95));
    background-image: linear-gradient(90deg, rgba(111,66,193,0.95), rgba(29,185,84,0.95));
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 8px 28px rgba(29,185,84,0.07);
    background-clip: padding-box; -webkit-background-clip: padding-box;
}
/* responsive tab layout */
@media (max-width: 640px) {
    .episode-tabs { gap: 8px; margin: 8px 0; }
    .episode-tabs .tab-btn { padding: 6px 10px; font-size: 13px; min-width: 64px; }
}

/* ---------------------------------------------------------
   VIDEO PLAYER BUFFERING INDICATOR
--------------------------------------------------------- */

#videoPlayerRoot.buffering .video-stage::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    margin-left: -24px;
    margin-top: -24px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #1db954;
    border-radius: 50%;
    animation: video-spin 0.8s linear infinite;
    z-index: 10;
}

#videoPlayerRoot.buffering .big-play {
    display: none !important;
}

@keyframes video-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}