/* ============================================================
   ON+ PLAY — PREMIUM POST-LOGIN UI
   Design: Dark streaming app (Apple TV+ / Disney+ inspired)
   Palette: Deep black + Crimson accent + Warm whites
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --bg-void:       #080810;
    --bg-deep:       #0d0d18;
    --bg-surface:    #13131f;
    --bg-elevated:   #1a1a2e;
    --bg-card:       #16162a;
    --bg-card-hover: #1e1e35;

    --accent:        #e50914;
    --accent-dim:    rgba(229, 9, 20, 0.15);
    --accent-glow:   rgba(229, 9, 20, 0.35);

    --text-primary:   #f0f0f5;
    --text-secondary: #9090a8;
    --text-muted:     #5a5a72;

    --border-subtle:  rgba(255,255,255,0.06);
    --border-active:  rgba(229, 9, 20, 0.5);

    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  16px;

    --sidebar-w:  300px;
    --header-h:   60px;

    --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in:    cubic-bezier(0.7, 0, 0.84, 0);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-void);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Player Screen Layout ───────────────────────────────────── */
#playerScreen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-h);
    background: linear-gradient(180deg, rgba(8,8,16,0.98) 0%, rgba(8,8,16,0.85) 100%);
    backdrop-filter: blur(24px) saturate(1.5);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 1px 0 rgba(255,255,255,0.03), 0 4px 24px rgba(0,0,0,0.4);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 24px;
}

.header-logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo-image {
    height: 28px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.header-logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.logo-accent {
    color: var(--accent);
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.user-info::before {
    content: '';
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #ff4d4d 100%);
    display: inline-flex;
    flex-shrink: 0;
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-logout {
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    letter-spacing: 0.02em;
}

.btn-logout:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-dim);
    box-shadow: 0 0 16px var(--accent-glow);
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--header-h));
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-deep);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px 12px 12px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.sidebar-header h3 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* ── Category Tabs ───────────────────────────────────────────── */
.category-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 3px;
}

.category-tab {
    flex: 1;
    padding: 6px 4px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.category-tab:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
}

.category-tab.active,
.category-tab[aria-selected="true"] {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

/* ── Search Box ──────────────────────────────────────────────── */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 9px 36px 9px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s var(--ease-out);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box input:focus {
    outline: none;
    border-color: var(--border-active);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Channel List ────────────────────────────────────────────── */
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-elevated) transparent;
}

.channel-list::-webkit-scrollbar { width: 4px; }
.channel-list::-webkit-scrollbar-track { background: transparent; }
.channel-list::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 2px;
}
.channel-list::-webkit-scrollbar-thumb:hover { background: var(--bg-card-hover); }

/* ── Channel Items ───────────────────────────────────────────── */
.channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin-bottom: 2px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.18s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.channel-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.2s var(--ease-out);
    border-radius: 0 2px 2px 0;
}

.channel-item:hover {
    background: var(--bg-card);
    border-color: var(--border-subtle);
}

.channel-item:hover::before { transform: scaleY(1); }

.channel-item.active {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    box-shadow: 0 0 0 1px var(--accent-dim) inset;
}

.channel-item.active::before { transform: scaleY(1); }

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

.channel-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-card) 100%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    border: 1px solid var(--border-subtle);
    text-transform: uppercase;
}

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

.channel-item h4 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.channel-item.active h4 { color: #fff; font-weight: 600; }

.channel-item p {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

/* ── Loading Spinner ─────────────────────────────────────────── */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 16px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--bg-elevated);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loading-spinner p {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

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

/* ── Player Container ────────────────────────────────────────── */
.player-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-void);
    overflow: hidden;
    position: relative;
}

/* ── Video Wrapper ───────────────────────────────────────────── */
.video-wrapper {
    position: relative;
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Subtle vignette on video edges */
.video-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

/* ── Player Placeholder ──────────────────────────────────────── */
.player-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    color: var(--text-muted);
    text-align: center;
    padding: 48px;
    animation: fadeIn 0.5s var(--ease-out);
}

.placeholder-icon {
    opacity: 0.15;
    filter: drop-shadow(0 0 20px var(--accent-glow));
    animation: breathe 3s ease-in-out infinite;
}

.player-placeholder p {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

@keyframes breathe {
    0%, 100% { opacity: 0.15; transform: scale(1); }
    50% { opacity: 0.25; transform: scale(1.05); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Video Player ────────────────────────────────────────────── */
.video-player {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Now Playing Bar ─────────────────────────────────────────── */
.now-playing {
    display: none;
    padding: 14px 24px;
    background: linear-gradient(180deg, rgba(13,13,24,0.95) 0%, var(--bg-deep) 100%);
    border-top: 1px solid var(--border-subtle);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.now-playing-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.live-badge {
    padding: 3px 10px;
    background: var(--accent);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 12px var(--accent-glow);
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
    50% { box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(229,9,20,0.15); }
}

#channelName {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Error Display ───────────────────────────────────────────── */
#playerError {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid rgba(229, 9, 20, 0.4);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 0.85rem;
    color: #ff6b6b;
    z-index: 50;
    backdrop-filter: blur(8px);
    max-width: 80%;
    text-align: center;
    animation: slideUp 0.3s var(--ease-out);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Category Navigation (pills/breadcrumb) ──────────────────── */
.category-section-header {
    padding: 10px 10px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.category-pill-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px;
}

.category-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s var(--ease-out);
    text-align: left;
    width: 100%;
}

.category-pill:hover {
    background: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}

.category-pill-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s;
    width: 100%;
    text-align: left;
}

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

.back-btn svg { flex-shrink: 0; }

/* ── Series Cards ────────────────────────────────────────────── */
.series-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 2px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s var(--ease-out);
}

.series-card:hover {
    background: var(--bg-card);
    border-color: var(--border-subtle);
}

.series-thumb {
    width: 48px;
    height: 68px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--bg-elevated);
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
}

.series-info { flex: 1; min-width: 0; }

.series-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.series-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ── Season Buttons ──────────────────────────────────────────── */
.season-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.15s var(--ease-out);
}

.season-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
}

/* ── Episode Items ───────────────────────────────────────────── */
.episode-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 2px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s var(--ease-out);
}

.episode-item:hover {
    background: var(--bg-card);
    border-color: var(--border-subtle);
}

.episode-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.episode-title {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Favorites ───────────────────────────────────────────────── */
.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s, transform 0.15s;
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
}

.fav-btn:hover { color: #ffd700; transform: scale(1.2); }
.fav-btn.active { color: #ffd700; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    :root { --sidebar-w: 260px; }
}

@media (max-width: 768px) {
    body { overflow: auto; }

    #playerScreen { height: auto; min-height: 100vh; }

    .main-content {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .player-container { min-height: 56vw; }

    .video-wrapper { aspect-ratio: 16/9; flex: none; }

    .user-info { display: none; }

    .header-content { padding: 0 16px; }
}

@media (max-width: 480px) {
    :root { --sidebar-w: 100%; }
    .category-tab { font-size: 0.65rem; padding: 5px 2px; }
}
