/* ═══════════════════════════════════════════════════════════════
   WASIF TV PLAYER - MAIN STYLESHEET
   ═══════════════════════════════════════════════════════════════
   Developed by: WASIF ALI
   Version:      1.0
   Design:       Dark · Modern · Premium · Mobile-first
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   1. ROOT VARIABLES
   ═══════════════════════════════════════════════════════════════ */
:root {
    /* Colors */
    --bg-primary:      #0a0a0f;
    --bg-secondary:    #13131a;
    --bg-card:         #1a1a24;
    --bg-elevated:     #22222e;
    --bg-hover:        #2a2a38;

    --text-primary:    #f5f5f7;
    --text-secondary:  #a0a0b0;
    --text-muted:      #6b6b7b;

    --accent:          #e50914;
    --accent-hover:    #f6121d;
    --accent-soft:     rgba(229, 9, 20, 0.15);
    --accent-glow:     rgba(229, 9, 20, 0.4);

    --gold:            #ffb800;
    --success:         #22c55e;
    --error:           #ef4444;
    --warning:         #f59e0b;

    --border:          rgba(255, 255, 255, 0.08);
    --border-strong:   rgba(255, 255, 255, 0.15);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl:  0 20px 60px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 40px var(--accent-glow);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Inter', 'Segoe UI', sans-serif;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle radial background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 10%, rgba(229, 9, 20, 0.08), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(59, 130, 246, 0.06), transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* Selection */
::selection {
    background: var(--accent);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-secondary);
}
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Buttons */
button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════
   3. HEADER
   ═══════════════════════════════════════════════════════════════ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) var(--space-lg);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.brand:hover { transform: scale(1.02); }

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.brand-text {
    background: linear-gradient(135deg, #fff 0%, #ffd6d9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-highlight {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}

/* Search box */
.search-wrap {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.92rem;
    transition: all var(--transition-base);
}

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

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

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1rem;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.search-input:not(:placeholder-shown) ~ .search-clear {
    display: flex;
}

.search-clear:hover {
    background: var(--accent);
    color: #fff;
}

/* Header nav */
.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-link.accent {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-link.accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════
   4. PLAYER SECTION
   ═══════════════════════════════════════════════════════════════ */
.player-section {
    position: relative;
    z-index: 1;
    padding: var(--space-lg) var(--space-md);
    background: linear-gradient(180deg, var(--bg-primary) 0%, transparent 100%);
}

.player-container {
    max-width: 1400px;
    margin: 0 auto;
}

.player-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    aspect-ratio: 16 / 9;
    max-height: 78vh;
    margin: 0 auto;
    border: 1px solid var(--border);
}

.player-wrapper:fullscreen {
    border-radius: 0;
    max-height: 100vh;
    aspect-ratio: auto;
    height: 100vh;
}

#video {
    width: 100%;
    height: 100%;
    background: #000;
    display: block;
    object-fit: contain;
}

/* Placeholder (before any channel) */
.player-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-lg);
}

.player-placeholder-icon {
    font-size: 3.5rem;
    opacity: 0.4;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.player-placeholder h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.player-placeholder p {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 400px;
}

/* Loading overlay */
.player-loading {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-md);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10;
}

.player-loading.active { display: flex; }

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.player-loading-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Error overlay */
.player-error {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-md);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
    z-index: 11;
    text-align: center;
    padding: var(--space-lg);
}

.player-error.active { display: flex; }

.player-error-icon {
    font-size: 3rem;
    color: var(--error);
}

.player-error-msg {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 400px;
}

.retry-btn {
    padding: 10px 28px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.retry-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

/* Now playing bar */
.now-playing {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-top: var(--space-md);
    border: 1px solid var(--border);
}

.now-playing-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    padding: 6px;
    flex-shrink: 0;
}

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

.now-playing-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.now-playing-category {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.now-playing-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    animation: pulseLive 2s infinite;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseLive {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50%      { box-shadow: 0 0 0 8px transparent; }
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* Custom video controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-base);
    z-index: 5;
}

.player-wrapper:hover .video-controls,
.video-controls:focus-within {
    opacity: 1;
    transform: translateY(0);
}

.video-controls-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.ctrl-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.ctrl-btn:hover {
    background: var(--accent);
    transform: scale(1.05);
}

.volume-slider {
    width: 90px;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.volume-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
}

.progress-bar {
    width: 100%;
    height: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: height var(--transition-fast);
}

.progress-bar:hover { height: 6px; }

.progress-bar::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
}

.progress-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
}

.time-display {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    min-width: 80px;
    text-align: center;
}

.ctrl-spacer { flex: 1; }

/* Quality selector */
.quality-container {
    position: relative;
}

.quality-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition-fast);
}

.quality-btn:hover { background: var(--accent); }

.quality-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 130px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--transition-base);
    z-index: 20;
}

.quality-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quality-opt {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.quality-opt:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.quality-opt.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   5. CATEGORIES SECTION
   ═══════════════════════════════════════════════════════════════ */
.categories-section {
    position: relative;
    z-index: 1;
    padding: var(--space-lg) var(--space-md) 0;
    max-width: 1400px;
    margin: 0 auto;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding: 0 var(--space-sm);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--accent);
    border-radius: var(--radius-full);
}

.channel-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.category-tabs {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding: var(--space-sm) var(--space-sm) var(--space-md);
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
}

.category-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cat-tab:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.cat-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.cat-tab .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
}

.cat-tab.active .count { background: rgba(255, 255, 255, 0.25); }

/* ═══════════════════════════════════════════════════════════════
   6. CHANNEL GRID
   ═══════════════════════════════════════════════════════════════ */
.channels-section {
    position: relative;
    z-index: 1;
    padding: var(--space-md) var(--space-md) var(--space-2xl);
    max-width: 1400px;
    margin: 0 auto;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-md);
    padding: var(--space-sm);
}

.channel-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    overflow: hidden;
    user-select: none;
}

.channel-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: 0;
}

.channel-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(229, 9, 20, 0.25);
}

.channel-card:hover::before { opacity: 1; }

.channel-card.playing {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft), 0 8px 24px var(--accent-glow);
    background: linear-gradient(135deg, rgba(229, 9, 20, 0.15) 0%, var(--bg-card) 100%);
}

.channel-card:active { transform: translateY(-2px) scale(0.98); }

/* Favorite button */
.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition-base);
    z-index: 3;
}

.channel-card:hover .fav-btn { opacity: 1; }

.fav-btn.active {
    opacity: 1;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.7);
}

.fav-btn:hover {
    background: var(--gold);
    color: #000;
    transform: scale(1.15);
}

/* Channel logo */
.channel-logo-wrap {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 8px;
    position: relative;
    z-index: 1;
    transition: all var(--transition-base);
}

.channel-card:hover .channel-logo-wrap { background: rgba(255, 255, 255, 0.05); }

.channel-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition-base);
}

.channel-card:hover .channel-logo { transform: scale(1.05); }

/* Channel info */
.channel-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    position: relative;
    z-index: 1;
}

.channel-category {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Playing badge */
.playing-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    border-radius: var(--radius-full);
    animation: pulseLive 2s infinite;
    z-index: 3;
}

/* Empty state */
.empty-state {
    display: none;
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    color: var(--text-muted);
}

.empty-state.show { display: block; }

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Error state */
.error-state {
    grid-column: 1 / -1;
    padding: var(--space-xl);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--error);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-md);
}

.error-state .retry-btn {
    display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════
   7. TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */
#toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 9999;
    pointer-events: none;
    max-width: 320px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateX(100px);
    transition: all var(--transition-base);
    pointer-events: auto;
    backdrop-filter: blur(12px);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* ═══════════════════════════════════════════════════════════════
   8. FOOTER
   ═══════════════════════════════════════════════════════════════ */
.site-footer {
    position: relative;
    z-index: 1;
    margin-top: var(--space-2xl);
    padding: var(--space-xl) var(--space-lg);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    text-align: center;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.footer-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.footer-brand-icon {
    color: var(--accent);
    font-size: 1.3rem;
}

.footer-dev {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.footer-dev strong {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.footer-links {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.footer-link:hover { color: var(--accent); }

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* ═══════════════════════════════════════════════════════════════
   9. RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .channel-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .channel-logo-wrap { width: 60px; height: 60px; }
    .player-wrapper { max-height: 65vh; }
}

@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
        --space-2xl: 32px;
    }

    .site-header { padding: var(--space-sm) var(--space-md); }
    .header-inner { gap: var(--space-sm); flex-wrap: wrap; }

    .brand { font-size: 1.1rem; }
    .brand-icon { width: 30px; height: 30px; font-size: 0.9rem; }

    .search-wrap { order: 3; flex-basis: 100%; max-width: 100%; }
    .header-nav { order: 2; gap: var(--space-xs); }
    .nav-link { padding: 6px 12px; font-size: 0.8rem; }

    .player-section { padding: var(--space-md) var(--space-sm); }
    .player-wrapper { border-radius: var(--radius-md); max-height: 60vh; }

    .now-playing { padding: var(--space-sm) var(--space-md); flex-wrap: wrap; }
    .now-playing-logo { width: 44px; height: 44px; }
    .now-playing-name { font-size: 0.95rem; }

    .section-title { font-size: 1.15rem; }
    .section-title::before { height: 18px; }

    .category-tabs { gap: 6px; padding: var(--space-xs); }
    .cat-tab { padding: 8px 14px; font-size: 0.8rem; }

    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: var(--space-sm);
    }

    .channel-card { padding: var(--space-sm) 6px; }
    .channel-logo-wrap { width: 52px; height: 52px; padding: 6px; }
    .channel-name { font-size: 0.75rem; }
    .channel-category { font-size: 0.62rem; }

    .video-controls { padding: var(--space-sm); }
    .ctrl-btn { width: 34px; height: 34px; font-size: 0.9rem; }
    .volume-slider { width: 60px; }
    .time-display { font-size: 0.72rem; min-width: 60px; }

    #toast-container { bottom: var(--space-md); right: var(--space-md); left: var(--space-md); max-width: none; }
    .toast { font-size: 0.82rem; }

    .footer-links { gap: var(--space-md); }
}

@media (max-width: 480px) {
    .brand { font-size: 1rem; }
    .brand-text { display: none; }
    .brand-icon { width: 32px; height: 32px; }

    .header-nav { flex: 1; justify-content: flex-end; }

    .channel-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .channel-card { padding: 10px 4px; gap: 6px; }
    .channel-logo-wrap { width: 46px; height: 46px; padding: 5px; }
    .channel-name { font-size: 0.7rem; -webkit-line-clamp: 1; }
    .channel-category { display: none; }

    .fav-btn { width: 24px; height: 24px; font-size: 0.75rem; top: 4px; right: 4px; }

    .player-wrapper { max-height: 50vh; }
    .now-playing-name { font-size: 0.88rem; }

    .cat-tab { padding: 6px 12px; font-size: 0.75rem; }

    .quality-btn { padding: 4px 8px; font-size: 0.72rem; }
}

/* ═══════════════════════════════════════════════════════════════
   10. ANIMATIONS & UTILITIES
   ═══════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.channel-card {
    animation: fadeIn var(--transition-base) backwards;
}

.channel-card:nth-child(n)   { animation-delay: calc(var(--index, 0) * 20ms); }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print */
@media print {
    .site-header, .player-section, .site-footer, #toast-container { display: none; }
    body { background: #fff; color: #000; }
}

/* Focus visible (a11y) */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}