/* 
   SEVEN TV - Modern Dark IPTV Player
   ================================
*/

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-elevated: #1c1c28;
    --bg-hover: #22222e;
    --bg-active: #6366f1;
    --border: #2a2a3a;
    --border-light: #1e1e2e;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --green: #22c55e;
    --red: #ef4444;
    --scrollbar-track: #111118;
    --scrollbar-thumb: #2a2a3a;
    --scrollbar-hover: #3a3a4a;
    --radius: 8px;
    --header-height: 56px;
}

/* --- Global Reset --- */
*, *::before, *::after { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- BOPLAY Header --- */
#boplay-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.boplay-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #fff;
    user-select: none;
}

.boplay-logo-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.boplay-logo img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.brand-name {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.1;
}

.brand-whatsapp {
    font-size: 0.72rem;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    line-height: 1.1;
}

.boplay-logo-text {
    background: linear-gradient(135deg, #6366f1, #818cf8, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.boplay-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-now-playing {
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Google Cast Button --- */
.cast-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
    position: relative;
}

.cast-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.cast-btn.casting {
    color: var(--accent);
    animation: cast-pulse 2s infinite;
}

@keyframes cast-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.4); }
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    margin-right: 6px;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

/* --- TV Fullscreen mode --- */
/* Early TV detection (applied from <head> before body renders) */
html.tv-mode #boplay-header {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}
html.tv-mode body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}
html.tv-mode #app-container {
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.tv-fullscreen {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}
body.tv-fullscreen #boplay-header {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}
body.tv-fullscreen #app-container {
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
}
body.tv-fullscreen #video-container {
    width: 100vw !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999;
    margin: 0 !important;
    padding: 0 !important;
}
body.tv-fullscreen #videoPlayer {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}
body.tv-fullscreen #videoPlayer::-webkit-media-controls {
    display: none !important;
}
body.tv-fullscreen #videoPlayer::-webkit-media-controls-enclosure {
    display: none !important;
}
body.tv-fullscreen #quality-indicator {
    display: none !important;
}

/* Sidebar hidden by default in fullscreen */
body.tv-fullscreen #playlist-container {
    display: none !important;
}

/* TV Overlay sidebar */
body.tv-fullscreen.tv-overlay-visible #playlist-container {
    display: flex !important;
    position: fixed !important;
    top: 0;
    left: 0;
    width: min(72vw, 980px);
    height: 100vh;
    z-index: 10000;
    background: linear-gradient(to right, rgba(10,10,15,0.95) 0%, rgba(10,10,15,0.85) 85%, rgba(10,10,15,0) 100%) !important;
    border-left: none !important;
    border-right: none !important;
    animation: tvSlideIn 0.25s ease-out;
    padding-top: 10px;
}
body.tv-fullscreen.tv-overlay-visible #playlist-container #playlist-controls {
    background: transparent !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
body.tv-fullscreen.tv-overlay-visible #playlist-container #filter-container {
    background: transparent !important;
}
body.tv-fullscreen.tv-overlay-visible #playlist-container #channels-list {
    background: transparent !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
    padding: 12px;
}
body.tv-fullscreen.tv-overlay-visible .channel-item {
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 10px;
    padding: 12px 10px;
    background: rgba(22,22,31,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}
body.tv-fullscreen.tv-overlay-visible .channel-item:focus {
    background-color: rgba(99,102,241,0.4) !important;
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
body.tv-fullscreen.tv-overlay-visible .channel-item.active {
    background: linear-gradient(135deg, rgba(99,102,241,0.6), rgba(124,58,237,0.6)) !important;
}
body.tv-fullscreen.tv-overlay-visible #searchInput:focus,
body.tv-fullscreen.tv-overlay-visible #playlistSelector:focus,
body.tv-fullscreen.tv-overlay-visible #categoryFilter:focus,
body.tv-fullscreen.tv-overlay-visible .category-chip:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background-color: rgba(99,102,241,0.25) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.3);
}

@keyframes tvSlideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Main Layout --- */
#app-container {
    display: flex;
    height: calc(100vh - var(--header-height));
    width: 100vw;
    background-color: var(--bg-primary);
}

/* --- Video Area --- */
#video-container {
    flex-grow: 1;
    display: flex;
    background-color: #000;
    position: relative;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    background: #000;
}

.vod-audio-picker {
    position: absolute;
    right: 16px;
    top: 16px;
    z-index: 20;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
}

.vod-audio-picker label {
    font-size: 12px;
    color: #cbd5e1;
    font-weight: 600;
}

.vod-audio-picker select {
    min-width: 180px;
    max-width: 260px;
    padding: 6px 10px;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 8px;
    font-size: 12px;
}

body.vod-player-active .vod-audio-picker {
    display: inline-flex;
}

body:not(.vod-player-active) .vod-audio-picker {
    display: none !important;
}

/* --- Next Episode Overlay (Netflix-style) --- */
.vod-next-episode {
    position: absolute;
    bottom: 80px;
    right: 16px;
    z-index: 100;
    animation: vodNextSlideIn 0.4s ease-out;
}
@keyframes vodNextSlideIn {
    from { opacity: 0; transform: translateX(60px); }
    to   { opacity: 1; transform: translateX(0); }
}
.vod-next-episode-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    max-width: 420px;
}
.vod-next-ep-thumb {
    width: 100px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #1a1a2e;
}
.vod-next-ep-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.vod-next-ep-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 13px;
}
.vod-next-ep-info {
    flex: 1;
    min-width: 0;
}
.vod-next-ep-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 2px;
}
.vod-next-ep-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vod-next-ep-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}
.vod-next-ep-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.vod-next-ep-play {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e50914;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.vod-next-ep-play:hover { background: #f40612; }
.vod-next-ep-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.vod-next-ep-cancel {
    background: rgba(255,255,255,0.1);
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.vod-next-ep-cancel:hover { background: rgba(255,255,255,0.2); color: #fff; }

body:not(.vod-player-active) .vod-next-episode {
    display: none !important;
}

@media (max-width: 600px) {
    .vod-next-episode {
        left: 8px;
        right: 8px;
        bottom: 70px;
    }
    .vod-next-episode-inner {
        max-width: 100%;
    }
    .vod-next-ep-thumb {
        width: 70px;
        height: 42px;
    }
}

/* --- Playlist Sidebar --- */
#playlist-container {
    width: 360px;
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

body.vod-player-active #playlist-container {
    display: none !important;
}

body.vod-player-active #video-container {
    width: 100%;
    height: 100%;
}

body.vod-player-active #videoPlayer {
    object-fit: contain;
}

/* --- Controls --- */
#playlist-controls {
    padding: 16px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#playlist-controls label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#filter-container {
    padding: 12px 16px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

.category-chips {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    overflow-x: auto;
}

.category-chip {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.category-chip:hover,
.category-chip:focus {
    color: var(--text-primary);
    border-color: var(--accent);
    outline: none;
}

.category-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* --- Inputs & Selects --- */
#searchInput, #playlistSelector, #categoryFilter {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchInput:focus, #playlistSelector:focus, #categoryFilter:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- Custom Select Wrapper --- */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-wrapper::after {
    content: '▾';
    font-size: 14px;
    color: var(--text-muted);
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

#playlistSelector, #categoryFilter {
    padding-right: 30px;
    cursor: pointer;
}

#playlistSelector option, #categoryFilter option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* --- Channel List --- */
#channels-list {
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

#channels-list p {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.15s ease;
    gap: 12px;
}

.channel-item:hover,
.channel-item:focus {
    background-color: var(--bg-hover);
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.channel-item:last-child {
    border-bottom: none;
}

.channel-item.active {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.channel-item.active:hover {
    background: linear-gradient(135deg, var(--accent-hover), #8b5cf6);
}

.channel-item.active .channel-info strong {
    color: #fff;
}

.channel-item.active .channel-info small {
    color: rgba(255,255,255,0.7);
}

.channel-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background-color: var(--bg-elevated);
    flex-shrink: 0;
    object-fit: contain;
    border: 1px solid var(--border);
}

body.tv-fullscreen.tv-overlay-visible .channel-logo {
    width: 56px;
    height: 56px;
}

body.tv-fullscreen.tv-overlay-visible .channel-info strong {
    white-space: normal;
    line-height: 1.25;
}

.channel-info {
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.channel-info strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.channel-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

/* --- Quality Indicator --- */
.quality-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    z-index: 1000;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.quality-indicator:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

.quality-details {
    margin-top: 4px;
    font-size: 11px;
    opacity: 0.8;
    line-height: 1.3;
}

@keyframes qualityPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.quality-indicator.pulse {
    animation: qualityPulse 2s ease-in-out infinite;
}

/* --- Loading Modal --- */
#loadingModal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10, 10, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

#loadingModal.show {
    opacity: 1;
    visibility: visible;
}

#loadingModal p {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    padding: 20px 32px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

/* --- Error Modal --- */
#errorModal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(10, 10, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

/* --- Toast --- */
#quality-toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-left: 4px solid var(--accent);
}

/* =============================================
   RESPONSIVE MOBILE 
   ============================================= */
@media (max-width: 800px) {
    :root {
        --header-height: 48px;
    }

    .boplay-logo {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }

    .boplay-logo img {
        height: 28px;
    }

    .boplay-header-right {
        display: none;
    }

    #app-container {
        flex-direction: column;
        height: calc(100vh - var(--header-height));
        overflow: hidden;
    }

    #tv-section {
        flex-direction: column;
        height: 100%;
        overflow: hidden;
    }

    #video-container {
        flex-shrink: 0;
        height: auto;
        aspect-ratio: 16/9;
        width: 100%;
    }

    #playlist-container {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        flex-grow: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #playlist-controls, #filter-container {
        position: sticky;
        top: 0;
        z-index: 10;
        flex-shrink: 0;
    }

    #playlist-controls {
        padding: 10px 12px;
    }

    #filter-container {
        padding: 8px 12px;
    }

    /* Grid View for Channels */
    #channels-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
        padding: 10px;
        overflow-y: auto;
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        max-height: calc(100vh - 200px);
    }

    .channel-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 12px 8px;
        background-color: var(--bg-card);
        border-bottom: none;
        gap: 8px;
    }

    .channel-item:hover,
    .channel-item:focus {
        border-color: var(--accent);
        background: var(--bg-hover);
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
    }

    .channel-item.active {
        border-color: transparent;
    }

    .channel-logo {
        width: 56px;
        height: 56px;
        margin: 0;
    }

    .channel-info strong {
        font-size: 0.8rem;
        white-space: normal;
        line-height: 1.3;
    }

    .channel-info small {
        display: none;
    }
}

/* --- Mobile Fullscreen (when channel selected on phone/tablet) --- */
body.mobile-fullscreen #boplay-header {
    display: none !important;
    height: 0 !important;
}

body.mobile-fullscreen #app-container {
    height: 100vh !important;
    flex-direction: column !important;
}

body.mobile-fullscreen #tv-section {
    width: 100vw !important;
    height: 100vh !important;
}

body.mobile-fullscreen #video-container {
    width: 100vw !important;
    height: 100vh !important;
    aspect-ratio: unset !important;
    flex-grow: 1 !important;
    flex-shrink: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9998 !important;
}

body.mobile-fullscreen #videoPlayer {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

body.mobile-fullscreen #playlist-container {
    display: none !important;
}

body.mobile-fullscreen #quality-indicator {
    display: none !important;
}

/* --- Mobile Back / Channel List Button --- */
.mobile-back-btn {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 22px;
    border: none;
    cursor: pointer;
    z-index: 10001;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
    transition: opacity 0.3s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-back-btn:active {
    transform: scale(0.9);
}

.mobile-back-btn.faded {
    opacity: 0.25;
}

/* ============================
   VOD — Section Tabs (removed, replaced by home screen)
   ============================ */

/* ============================
   HOME SCREEN
   ============================ */
.home-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.home-cards {
    display: flex;
    gap: 32px;
    padding: 40px;
}
.home-card {
    width: 280px;
    height: 220px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    padding: 24px;
}
.home-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.home-card:active { transform: scale(0.97); }
.home-card-tv {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}
.home-card-vod {
    background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
}
.home-card-icon { font-size: 56px; margin-bottom: 12px; }
.home-card-title {
    font-size: 22px;
    font-weight: 800;
    color: white;
    margin-bottom: 6px;
}
.home-card-desc {
    font-size: 14px;
    color: rgba(255,255,255,0.75);
}

/* Home button in header */
.home-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #e2e8f0;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.home-btn:hover { background: rgba(255,255,255,0.18); }

/* TV section layout (same as old app-container inner) */
#tv-section {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ============================
   VOD — Navigation
   ============================ */
.vod-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    flex-shrink: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky;
    top: 0;
    z-index: 50;
}
.vod-back-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}
.vod-back-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.2);
    transform: translateX(-2px);
}
.vod-search {
    max-width: 340px;
    min-width: 200px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #f1f5f9;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}
.vod-search::placeholder { color: #64748b; }
.vod-search:focus {
    border-color: var(--accent, #818cf8);
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.vod-library-select {
    min-width: 210px;
    max-width: 260px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #f1f5f9;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    cursor: pointer;
}
.vod-library-select:focus {
    border-color: var(--accent, #818cf8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ============================
   VOD — Netflix-style Layout
   ============================ */
.vod-fullscreen {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0a0f1e 0%, #0f172a 30%, #111827 100%);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.vod-home {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow: visible;
    padding: 8px 0 40px;
}
.vod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 24px;
    padding: 8px 32px 32px;
    overflow: visible;
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    align-content: start;
    justify-content: start;
    align-items: start;
    grid-auto-rows: max-content;
}

/* Genre filter pills */
.vod-genre-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 4px;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
}
.vod-genre-filter::-webkit-scrollbar { display: none; }
.vod-pill {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #cbd5e1;
    padding: 7px 18px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}
.vod-pill:hover {
    background: var(--accent, #6366f1);
    border-color: var(--accent, #6366f1);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

/* Netflix-style horizontal rows */
.nf-row {
    margin-bottom: 36px;
}
.nf-row-title {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 14px 32px;
    padding: 0;
    letter-spacing: -0.01em;
}
.nf-row-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 32px 12px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nf-row-scroll::-webkit-scrollbar { display: none; }
.nf-row-scroll .vod-card {
    flex: 0 0 154px;
    min-width: 154px;
}

/* Cards */
.vod-card {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: #1a2236;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.vod-card:hover {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.08);
    z-index: 2;
}

/* Item cards */
.vod-item-card { display: flex; flex-direction: column; }
.vod-grid .vod-item-card {
    width: 100%;
    min-width: 0;
    max-width: none;
}
.vod-grid .vod-poster-wrap {
    width: 100%;
    height: 0;
    padding-top: 150%;
}
.vod-poster-wrap {
    position: relative;
    width: 100%;
    padding-top: 150%;
    overflow: hidden;
    background: #0f172a;
}
.vod-poster-wrap img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.vod-card:hover .vod-poster-wrap img {
    transform: scale(1.04);
}
.vod-progress-bar {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.vod-progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f97316, #ef4444);
    border-radius: inherit;
    transition: width 0.3s ease;
}
.vod-no-poster {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
}
.vod-no-poster span {
    font-size: 13px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    line-height: 1.4;
    word-break: break-word;
    letter-spacing: 0.01em;
}
.vod-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(99, 102, 241, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 1;
}
.vod-item-info {
    padding: 10px 10px 12px;
    background: linear-gradient(180deg, #1a2236 0%, #151d30 100%);
}
.vod-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.vod-item-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
    font-weight: 500;
}

.vod-load-more {
    grid-column: 1 / -1;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 12px 28px;
    min-height: 48px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}
.vod-load-more:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.vod-home-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    margin: 6px 18px 28px;
    border: 1px dashed rgba(255,255,255,0.14);
    border-radius: 14px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    background: rgba(15,23,42,0.35);
}

/* ============================
   VOD — Detail Modal
   ============================ */
.vod-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: vodModalFadeIn 0.25s ease;
}
@keyframes vodModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.vod-modal-content {
    background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
    border-radius: 18px;
    max-width: 860px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
    animation: vodModalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes vodModalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.vod-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 22px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.vod-modal-close:hover {
    background: rgba(255,255,255,0.15);
    transform: rotate(90deg);
}
.vod-modal-backdrop {
    width: 100%;
    height: 260px;
    background-size: cover;
    background-position: center 20%;
    border-radius: 18px 18px 0 0;
    position: relative;
}
.vod-modal-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 20%, rgba(17, 24, 39, 0.6) 60%, #111827 100%);
    border-radius: 18px 18px 0 0;
}
.vod-modal-body {
    display: flex;
    gap: 24px;
    padding: 0 28px 28px;
    margin-top: -80px;
    position: relative;
    z-index: 1;
}
.vod-modal-poster {
    width: 160px;
    height: auto;
    border-radius: 14px;
    flex-shrink: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.08);
}
.vod-modal-info { flex: 1; min-width: 0; }
.vod-modal-info h2 {
    font-size: 26px;
    font-weight: 800;
    color: #f8fafc;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.vod-modal-meta {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 14px;
    font-weight: 500;
}
.vod-modal-overview {
    font-size: 14px;
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 18px;
}
.vod-modal-actions {
    margin-bottom: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.vod-play-btn {
    background: linear-gradient(135deg, var(--accent, #6366f1), #818cf8);
    color: white;
    border: none;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}
.vod-play-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}
.vod-play-btn-secondary {
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: none;
    margin-right: 0;
}
.vod-play-btn-secondary:hover {
    background: rgba(148, 163, 184, 0.2);
    box-shadow: none;
}
.vod-play-btn.vod-loading {
    pointer-events: none;
    opacity: 0.7;
}
.vod-play-btn.vod-loading::after {
    content: '';
    display: inline-block;
    width: 14px; height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vodSpin .6s linear infinite;
    vertical-align: middle;
}
.vod-card.vod-loading {
    pointer-events: none;
    opacity: 0.6;
}
.vod-card.vod-loading .vod-poster-wrap::after {
    content: 'Cargando...';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: inherit;
}
@keyframes vodSpin { to { transform: rotate(360deg); } }

/* Seasons */
.vod-modal-seasons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.vod-season-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #cbd5e1;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    max-width: 280px;
}
.vod-season-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}
.vod-season-btn.active {
    background: var(--accent, #6366f1);
    border-color: var(--accent, #6366f1);
    color: white;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}
.vod-season-name {
    font-size: 13px;
    font-weight: 600;
}
.vod-season-meta {
    font-size: 11px;
    color: #94a3b8;
}
.vod-season-btn.active .vod-season-meta {
    color: rgba(255,255,255,0.85);
}
.vod-season-overview {
    font-size: 11px;
    color: #cbd5e1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    margin-top: 2px;
}
.vod-season-btn.active .vod-season-overview {
    color: rgba(255,255,255,0.92);
}

/* Episodes */
.vod-modal-episodes {
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.vod-modal-episodes::-webkit-scrollbar { width: 4px; }
.vod-modal-episodes::-webkit-scrollbar-track { background: transparent; }
.vod-modal-episodes::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}
.vod-episode {
    display: flex;
    gap: 14px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 10px;
    margin-bottom: 2px;
}
.vod-episode:hover {
    background: rgba(255,255,255,0.06);
    transform: translateX(2px);
}
.vod-episode-thumb {
    width: 130px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}
.vod-episode-thumb img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}
.vod-no-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-weight: 700;
    font-size: 16px;
    border-radius: 8px;
}
.vod-episode-info { flex: 1; min-width: 0; }
.vod-episode-title {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}
.vod-episode-meta {
    font-size: 12px;
    color: #64748b;
    margin-top: 3px;
    font-weight: 500;
}
.vod-episode-overview {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* ============================
   VOD — Responsive
   ============================ */
@media (max-width: 600px) {
    .vod-home,
    .vod-grid {
        max-height: none;
        height: auto;
    }
    .vod-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        padding: 4px 14px 24px;
    }
    .vod-grid .vod-item-card {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
    .vod-grid .vod-poster-wrap {
        width: 100%;
        height: 0;
        padding-top: 150%;
    }
    .nf-row { margin-bottom: 28px; }
    .nf-row-title { font-size: 17px; margin-left: 16px; }
    .nf-row-scroll { padding: 4px 16px 8px; gap: 10px; }
    .nf-row-scroll .vod-card { flex: 0 0 120px; min-width: 120px; }
    .vod-genre-filter { padding: 0; }
    .vod-nav { padding: 10px 14px; gap: 8px; }
    .vod-library-select {
        min-width: 150px;
        max-width: 170px;
        padding: 8px 10px;
    }
    .vod-modal { padding: 10px; }
    .vod-modal-content { border-radius: 14px; }
    .vod-modal-backdrop { height: 180px; border-radius: 14px 14px 0 0; }
    .vod-modal-backdrop::after { border-radius: 14px 14px 0 0; }
    .vod-modal-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 16px 20px;
        margin-top: -50px;
    }
    .vod-modal-poster { width: 110px; border-radius: 12px; }
    .vod-modal-info h2 { font-size: 20px; }
    .vod-modal-actions { justify-content: center; }
    .vod-episode-thumb { width: 90px; }
    .home-cards {
        flex-direction: column;
        gap: 20px;
        padding: 24px;
    }
    .home-card {
        width: 100%;
        height: 160px;
    }
    .home-card-icon { font-size: 40px; }
    .home-card-title { font-size: 18px; }
}
@media (min-width: 601px) and (max-width: 900px) {
    .vod-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 18px;
        padding: 8px 24px 28px;
    }
    .nf-row-scroll .vod-card { flex: 0 0 140px; min-width: 140px; }
}
