/**
 * DeepTube Base Styles
 * Theme variables, components, and utilities
 */

/* ==========================================================================
   Page Loading States
   ========================================================================== */

/* Page loading is handled by individual page loaders */

.page-ready {
    opacity: 1;
    transition: opacity 0.2s ease;
}

/* ==========================================================================
   Theme Variables
   ========================================================================== */

/* Dark theme (default) */
:root,
.dark {
    /* Background colors */
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --bg-tertiary: #27272a;

    /* Text colors */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Accent colors */
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-muted: rgba(249, 115, 22, 0.15);

    /* Border colors */
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    /* Glass */
    --glass-bg: rgba(24, 24, 27, 0.85);

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
}

/* Light theme - Warm & Calming */
.light {
    /* Background colors - Warm cream/ivory tones instead of harsh white */
    --bg-primary: #faf9f7;
    --bg-secondary: #f5f4f1;
    --bg-tertiary: #eae8e4;

    /* Text colors - Warm dark tones, not pure black */
    --text-primary: #2c2a27;
    --text-secondary: #5c5955;
    --text-muted: #8a8680;

    /* Accent colors - Softer, warmer orange/terracotta */
    --accent: #d97449;
    --accent-hover: #c4613a;
    --accent-muted: rgba(217, 116, 73, 0.12);

    /* Border colors - Subtle warm borders */
    --border: rgba(44, 42, 39, 0.07);
    --border-hover: rgba(44, 42, 39, 0.12);

    /* Glass - Warm tinted glass */
    --glass-bg: rgba(250, 249, 247, 0.92);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

.light::-webkit-scrollbar-thumb:hover {
    background: #d5d3ce;
}

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ==========================================================================
   Glass Effect - Frosted with Ambient Glow
   ========================================================================== */

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ==========================================================================
   Gradient Text
   ========================================================================== */

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

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

/* ==========================================================================
   Button Premium Gradient - Subtle left-to-right
   ========================================================================== */

button:not(:disabled),
a.bg-accent,
a.bg-white\/10,
a.bg-white\/15,
a.hover\:bg-accent-hover,
.sort-btn,
.filter-btn,
.filter-option,
.category-chip {
    background-image: linear-gradient(90deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0) 100%);
}

/* Light theme */
.light button:not(:disabled),
.light a.bg-accent,
.light a.bg-white\/10,
.light a.bg-white\/15,
.light a.hover\:bg-accent-hover,
.light .sort-btn,
.light .filter-btn,
.light .filter-option,
.light .category-chip {
    background-image: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 100%);
}

/* ==========================================================================
   Card Components
   ========================================================================== */

.video-card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ==========================================================================
   Channel Banner (when filtering by channel)
   ========================================================================== */

#channel-banner {
    background: linear-gradient(to right, var(--bg-secondary), var(--bg-primary));
    border-color: var(--border);
}

#channel-banner h2 {
    color: var(--text-primary);
}

#channel-banner .text-zinc-400 {
    color: var(--text-secondary);
}

#channel-banner .text-zinc-500 {
    color: var(--text-muted);
}

#channel-banner .text-zinc-500:hover {
    color: var(--text-primary);
}

/* YouTube button - dark theme: black text, light theme: white text */
#channel-banner .bg-red-600 {
    color: #000;
}

#channel-banner .bg-red-600 svg {
    color: #000;
}

/* ==========================================================================
   Loader / Spinner - Logo Style
   ========================================================================== */

.loader {
    width: 48px;
    height: 48px;
    position: relative;
}

.loader::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-radius: 10px;
    animation: loaderPulse 1.2s ease-in-out infinite;
}

.loader::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-40%, -50%);
    border: 8px solid transparent;
    border-left: 12px solid white;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    animation: loaderPlay 1.2s ease-in-out infinite;
}

@keyframes loaderPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.92);
        opacity: 0.8;
    }
}

@keyframes loaderPlay {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Alternative spinner style */
.loader-spin {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Logo-style loader animations */
.animate-logo-pulse {
    animation: logoPulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 4px 20px rgba(249, 115, 22, 0.4));
}

.light .animate-logo-pulse {
    filter: drop-shadow(0 4px 16px rgba(217, 116, 73, 0.35));
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.animate-play-pulse {
    animation: playPulse 1.5s ease-in-out infinite;
    transform-origin: center;
}

@keyframes playPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.2s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.2s ease-out;
}

/* ==========================================================================
   Theme Toggle Switch
   ========================================================================== */

.theme-toggle {
    position: relative;
    width: 56px;
    height: 28px;
    background: var(--bg-tertiary);
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border);
}

.theme-toggle:hover {
    border-color: var(--border-hover);
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--bg-primary);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.light .theme-toggle-slider {
    transform: translateX(28px);
}

.theme-toggle-icon {
    width: 14px;
    height: 14px;
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.theme-toggle .sun-icon {
    color: #d4a064;
    opacity: 0;
    transform: rotate(-90deg);
}

.theme-toggle .moon-icon {
    color: #a1a1aa;
    opacity: 1;
    transform: rotate(0deg);
}

.light .theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.light .theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(90deg);
}

/* ==========================================================================
   Light Theme - Base
   ========================================================================== */

.light body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ==========================================================================
   Light Theme - Tailwind Class Overrides
   ========================================================================== */

.light .text-zinc-100 {
    color: var(--text-primary);
}

.light .text-zinc-400 {
    color: var(--text-secondary);
}

.light .text-zinc-500 {
    color: var(--text-muted);
}

.light .text-zinc-600 {
    color: #71717a;
}

.light .text-white {
    color: var(--text-primary);
}

.light .hover\:text-white:hover {
    color: var(--text-primary);
}

.light .bg-white\/10 {
    background-color: rgba(0, 0, 0, 0.06);
}

.light .bg-white\/5 {
    background-color: rgba(0, 0, 0, 0.03);
}

.light .bg-white\/20 {
    background-color: rgba(0, 0, 0, 0.08);
}

.light .hover\:bg-white\/5:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.light .hover\:bg-white\/10:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.light .hover\:bg-white\/15:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.light .hover\:bg-white\/20:hover {
    background-color: rgba(0, 0, 0, 0.12);
}

.light .border-white\/5 {
    border-color: var(--border);
}

.light .border-white\/10 {
    border-color: rgba(0, 0, 0, 0.1);
}

.light .bg-surface-raised {
    background-color: var(--bg-secondary);
}

.light .bg-surface-overlay {
    background-color: var(--bg-tertiary);
}

.light .placeholder-zinc-500::placeholder {
    color: var(--text-muted);
}

.light .focus\:border-accent\/50:focus {
    border-color: rgba(217, 116, 73, 0.5);
}

/* ==========================================================================
   Light Theme - Navigation
   ========================================================================== */

.light nav.glass {
    background: rgba(250, 249, 247, 0.92);
    border-color: rgba(44, 42, 39, 0.08);
}

.light nav .text-accent {
    color: var(--accent);
}

/* Logo text in nav */
.light nav span.text-white {
    color: var(--text-primary);
}

/* Navigation links */
.light nav a.text-zinc-400 {
    color: var(--text-secondary);
}

.light nav a.text-zinc-400:hover {
    color: var(--text-primary);
}

/* Active nav link */
.light nav a.bg-white\/10 {
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

/* Search input in nav */
.light #global-search,
.light #mobile-search-input {
    background-color: var(--bg-tertiary);
    border-color: rgba(44, 42, 39, 0.1);
    color: var(--text-primary);
}

.light #global-search::placeholder,
.light #mobile-search-input::placeholder {
    color: var(--text-muted);
}

.light #global-search:focus,
.light #mobile-search-input:focus {
    border-color: rgba(217, 116, 73, 0.5);
}

/* Search icon */
.light nav .text-zinc-500 {
    color: var(--text-muted);
}

/* Mobile menu */
.light #mobile-menu {
    background-color: var(--bg-secondary);
}

.light #mobile-search-bar {
    background-color: var(--bg-secondary);
}

/* ==========================================================================
   Light Theme - Card & Component Overrides
   ========================================================================== */

.light .bg-zinc-900 {
    background-color: var(--bg-secondary);
}

/* Keep dark backgrounds in hero and channel header sections */
.light #hero-section > .bg-zinc-900,
.light .channel-header-section > .bg-zinc-900 {
    background-color: #18181b !important;
}

.light .bg-zinc-800 {
    background-color: var(--bg-tertiary);
}

.light .bg-zinc-900\/50 {
    background-color: rgba(244, 244, 245, 0.5);
}

.light .bg-zinc-800\/50 {
    background-color: rgba(228, 228, 231, 0.5);
}

.light .hover\:bg-zinc-800:hover {
    background-color: var(--bg-tertiary);
}

.light .border-zinc-800 {
    border-color: var(--border);
}

.light .border-zinc-700 {
    border-color: rgba(0, 0, 0, 0.1);
}

.light .ring-zinc-700 {
    --tw-ring-color: rgba(0, 0, 0, 0.1);
}

.light .text-zinc-300 {
    color: var(--text-secondary);
}

.light .text-zinc-200 {
    color: var(--text-primary);
}

/* ==========================================================================
   Light Theme - Surface Colors
   ========================================================================== */

.light .bg-surface {
    background-color: var(--bg-primary);
}

.light .bg-surface-raised {
    background-color: var(--bg-secondary);
}

.light .bg-surface-overlay {
    background-color: var(--bg-tertiary);
}

.light .hover\:bg-surface-overlay:hover {
    background-color: var(--bg-tertiary);
}

.light .from-surface-raised {
    --tw-gradient-from: var(--bg-secondary);
}

.light .to-surface {
    --tw-gradient-to: var(--bg-primary);
}

/* ==========================================================================
   Light Theme - Hero Section
   ========================================================================== */

.light #hero-section {
    background: linear-gradient(135deg, #faf9f7 0%, #f0ece6 100%);
}

.light #hero-section .from-black\/80 {
    --tw-gradient-from: rgba(0, 0, 0, 0.65);
}

.light #hero-section .via-black\/50 {
    --tw-gradient-stops: var(--tw-gradient-from), rgba(0, 0, 0, 0.4), var(--tw-gradient-to);
}

/* Hero stats boxes in light mode - translucent with blur */
.light #hero-section .bg-white\/5 {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Stats text should remain light for contrast over dark hero overlay */
.light #hero-section .bg-white\/5 .text-zinc-500 {
    color: rgba(255, 255, 255, 0.7);
}

.light #hero-section .bg-white\/5 .gradient-text {
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero featured text should remain white for contrast over image */
.light #hero-section #featured-video .text-zinc-400 {
    color: rgba(255, 255, 255, 0.8);
}

.light #hero-section #featured-title {
    color: #fff;
}

.light #hero-section #featured-channel {
    color: rgba(255, 255, 255, 0.75);
}

/* Featured label */
.light #hero-section .text-accent {
    color: var(--accent);
}

/* Watch button - stays orange with white text */
.light #hero-section #featured-link {
    background-color: var(--accent);
    color: #fff;
}

.light #hero-section #featured-link:hover {
    background-color: var(--accent-hover);
}

/* ==========================================================================
   Light Theme - Category Chips
   ========================================================================== */

/* Active category chip - uses bg-white inline class */
.light .category-chip.bg-white {
    background-color: var(--accent) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(217, 116, 73, 0.3);
}

.light .category-chip.bg-white .text-black\/60,
.light .category-chip.bg-white span {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Inactive category chips */
.light .category-chip.bg-surface-raised {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid rgba(44, 42, 39, 0.1);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.05);
}

.light .category-chip.bg-surface-raised:hover {
    background-color: var(--bg-tertiary);
    border-color: rgba(44, 42, 39, 0.15);
    box-shadow: 0 2px 6px rgba(44, 42, 39, 0.08);
}

.light .category-chip .text-zinc-300 {
    color: var(--text-secondary);
}

/* ==========================================================================
   Light Theme - Sort & Filter Buttons
   ========================================================================== */

.light .sort-btn:not(.active) {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: rgba(44, 42, 39, 0.08);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.06);
}

.light .sort-btn:not(.active):hover {
    background-color: var(--bg-tertiary);
    border-color: rgba(44, 42, 39, 0.12);
    box-shadow: 0 2px 6px rgba(44, 42, 39, 0.1);
}

.light .sort-btn.active {
    background-color: rgba(217, 116, 73, 0.15) !important;
    color: var(--accent) !important;
    border-color: rgba(217, 116, 73, 0.3) !important;
    box-shadow: 0 2px 8px rgba(217, 116, 73, 0.15);
}

/* Sort button text */
.light .sort-btn .text-zinc-300,
.light .sort-btn:not(.active) {
    color: var(--text-secondary);
}

/* Reset button */
.light #reset-filters-btn {
    color: var(--text-muted);
    border-color: rgba(44, 42, 39, 0.1);
}

.light #reset-filters-btn:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.05);
}

.light .filter-menu {
    background-color: var(--bg-primary);
    border-color: rgba(44, 42, 39, 0.1);
    box-shadow: 0 4px 6px rgba(44, 42, 39, 0.05), 0 10px 30px rgba(44, 42, 39, 0.12);
}

.light .filter-option:hover {
    background-color: var(--bg-secondary);
}

.light .filter-option.bg-accent\/20 {
    background-color: rgba(217, 116, 73, 0.12);
}

.light .filter-option.text-accent {
    color: var(--accent);
}

.light .filter-btn {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.08);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.06);
}

.light .filter-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: rgba(44, 42, 39, 0.12);
    box-shadow: 0 2px 6px rgba(44, 42, 39, 0.1);
}

.light .filter-btn.border-accent\/50 {
    border-color: rgba(217, 116, 73, 0.4);
}

.light .filter-btn.text-accent {
    color: var(--accent);
}

/* Filter chevron icons */
.light .filter-chevron,
.light #filters-chevron {
    color: var(--text-muted);
}

/* Filter button label text */
.light .filter-btn-text {
    color: var(--text-secondary);
}

.light .filter-btn.text-accent .filter-btn-text {
    color: var(--accent);
}

/* ==========================================================================
   Light Theme - Video Card
   ========================================================================== */

.light .video-card {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.06);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.04);
}

.light .video-card:hover {
    border-color: rgba(44, 42, 39, 0.1);
    box-shadow: 0 4px 16px rgba(44, 42, 39, 0.08);
}

/* Language badge - ensure visibility in light mode */
.light .video-card .bg-black\/70,
.light .video-card .bg-black\/80 {
    background-color: rgba(61, 58, 54, 0.85);
    color: #faf9f7;
}

/* Channel link in video card */
.light .video-card a.hover\:text-accent:hover {
    color: var(--accent);
}

/* Results title */
.light #results-title {
    color: var(--text-primary);
}

.light #results-count {
    color: var(--text-muted);
}

/* Skeleton loaders */
.light .animate-pulse {
    background-color: rgba(44, 42, 39, 0.08);
}

/* ==========================================================================
   Light Theme - Form Elements
   ========================================================================== */

.light select,
.light input[type="text"],
.light input[type="email"],
.light input[type="password"] {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border-color: rgba(44, 42, 39, 0.1) !important;
}

.light select:focus,
.light input[type="text"]:focus,
.light input[type="email"]:focus,
.light input[type="password"]:focus {
    border-color: rgba(217, 116, 73, 0.5) !important;
    box-shadow: 0 0 0 3px rgba(217, 116, 73, 0.08) !important;
}

.light select option {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.light input::placeholder {
    color: var(--text-muted) !important;
}

/* ==========================================================================
   Light Theme - Login/Register Forms
   ========================================================================== */

/* Form container */
.light .bg-surface-raised.border {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.1);
    box-shadow: 0 4px 20px rgba(44, 42, 39, 0.08);
}

/* Form headers */
.light h1.text-white {
    color: var(--text-primary);
}

/* Form labels */
.light label.text-zinc-300 {
    color: var(--text-secondary);
}

/* Form links */
.light p.text-zinc-400 {
    color: var(--text-muted);
}

.light a.text-accent {
    color: var(--accent);
}

.light a.text-accent:hover {
    color: var(--accent-hover);
}

/* Accent buttons - keep orange but adjust */
.light .bg-accent {
    background-color: var(--accent);
}

.light .bg-accent:hover,
.light .hover\:bg-accent-hover:hover {
    background-color: var(--accent-hover);
}

/* Button text stays white on accent buttons */
.light button.bg-accent,
.light a.bg-accent {
    color: #fff !important;
}

/* Mobile icons and buttons */
.light #mobile-menu-btn,
.light #mobile-search-btn {
    color: var(--text-secondary);
}

.light #mobile-menu-btn:hover,
.light #mobile-search-btn:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   Light Theme - Channel List Page
   ========================================================================== */

/* Channel list hero section */
.light section.bg-gradient-to-br {
    background: linear-gradient(to bottom right, var(--bg-secondary), var(--bg-primary));
    border-color: rgba(44, 42, 39, 0.08);
}

/* Channel stats boxes and backdrop-blur elements */
.light section .bg-white\/5.backdrop-blur,
.light .bg-white\/5.backdrop-blur {
    background-color: rgba(250, 249, 247, 0.95);
    border-color: rgba(44, 42, 39, 0.08);
    box-shadow: 0 2px 12px rgba(44, 42, 39, 0.06);
}

/* Filters section on channel list */
.light section.bg-surface-raised {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.08);
}

/* Selects on channel page */
.light #ordering,
.light #min_subscribers,
.light #search {
    background-color: var(--bg-primary);
    border-color: rgba(44, 42, 39, 0.1);
    color: var(--text-primary);
}

.light #ordering:focus,
.light #min_subscribers:focus,
.light #search:focus {
    border-color: rgba(217, 116, 73, 0.5);
}

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

/* Labels */
.light label.text-zinc-400 {
    color: var(--text-muted);
}

/* Main headers */
.light h1,
.light h2.text-base {
    color: var(--text-primary);
}

/* Description text */
.light p.text-zinc-400 {
    color: var(--text-secondary);
}

/* ==========================================================================
   Light Theme - Channel Card
   ========================================================================== */

.light .channel-card {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.06);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.03);
}

.light .channel-card:hover {
    border-color: rgba(44, 42, 39, 0.1);
    box-shadow: 0 4px 12px rgba(44, 42, 39, 0.06);
}

.light #channel-grid > a,
.light #channel-grid > div {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.06);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.03);
}

.light #channel-grid > a:hover,
.light #channel-grid > div:hover {
    border-color: var(--accent) !important;
    box-shadow: 0 4px 16px rgba(44, 42, 39, 0.08);
}

.light #channel-grid .border-surface-raised {
    border-color: var(--bg-secondary);
}

.light #channel-grid .border-white\/5 {
    border-color: rgba(0, 0, 0, 0.06);
}

/* Channel card badge */
.light #channel-grid .bg-accent\/90 {
    background-color: rgba(217, 116, 73, 0.95);
}

/* Keep badge text white */
.light #channel-grid .bg-accent\/90 .text-white {
    color: #fff;
}

/* Channel avatar border */
.light #channel-grid .border-surface-raised {
    border-color: var(--bg-secondary);
}

/* Channel card inner gradient */
.light #channel-grid .from-surface-raised {
    --tw-gradient-from: var(--bg-secondary);
}

.light #channel-grid .via-surface-raised\/80 {
    --tw-gradient-stops: var(--tw-gradient-from), rgba(244, 244, 245, 0.8), var(--tw-gradient-to);
}

/* ==========================================================================
   Light Theme - Text Colors
   ========================================================================== */

.light .text-gray-300 {
    color: var(--text-secondary);
}

.light .text-gray-500 {
    color: var(--text-muted);
}

/* ==========================================================================
   Light Theme - Pagination
   ========================================================================== */

.light #pagination button {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.08);
}

.light #pagination button:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
    border-color: rgba(44, 42, 39, 0.12);
}

.light #pagination .text-zinc-400 {
    color: var(--text-muted);
}

.light #pagination .text-white,
.light #pagination .font-semibold {
    color: var(--text-primary);
}

/* ==========================================================================
   Light Theme - Mobile Filters Toggle
   ========================================================================== */

.light #mobile-filters-toggle {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.1);
    color: var(--text-secondary);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.06);
}

.light #mobile-filters-toggle:hover {
    background-color: var(--bg-tertiary);
    box-shadow: 0 2px 6px rgba(44, 42, 39, 0.1);
}

.light #channel-filters-toggle {
    background-color: var(--bg-secondary);
    border-color: rgba(44, 42, 39, 0.1);
    color: var(--text-secondary);
    box-shadow: 0 1px 3px rgba(44, 42, 39, 0.06);
}

.light #channel-filters-toggle:hover {
    background-color: var(--bg-tertiary);
    box-shadow: 0 2px 6px rgba(44, 42, 39, 0.1);
}

/* ==========================================================================
   Light Theme - Gradients & Accents
   ========================================================================== */

.light .from-accent\/20 {
    --tw-gradient-from: rgba(217, 116, 73, 0.12);
}

.light .to-amber-500\/20 {
    --tw-gradient-to: rgba(212, 160, 100, 0.12);
}

/* Gradient text stays the same in light mode */
.light .gradient-text {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.light .hover\:border-accent\/30:hover {
    border-color: rgba(217, 116, 73, 0.35) !important;
}

.light .bg-accent\/20 {
    background-color: rgba(217, 116, 73, 0.1);
}

.light .border-accent\/30 {
    border-color: rgba(217, 116, 73, 0.25);
}

/* ==========================================================================
   Light Theme - Error States
   ========================================================================== */

.light .bg-red-500\/10 {
    background-color: rgba(239, 68, 68, 0.08);
}

.light .border-red-500\/20 {
    border-color: rgba(239, 68, 68, 0.2);
}

.light .text-red-400 {
    color: #dc2626;
}

/* ==========================================================================
   Light Theme - Loading State
   ========================================================================== */

.light #loading {
    background-color: var(--bg-primary);
}

.light #loading p {
    color: var(--text-muted);
}

/* Loading overlay (video list page) */
.light #loading-overlay {
    background: linear-gradient(135deg, #faf9f7 0%, #f0ece6 50%, #faf9f7 100%) !important;
}

.light #loading-overlay .brand-text .white {
    color: var(--text-primary) !important;
}

.light #loading-overlay .loading-logo {
    filter: drop-shadow(0 4px 16px rgba(217, 116, 73, 0.35));
}

/* ==========================================================================
   Light Theme - Video Modal
   ========================================================================== */

.light #video-modal #modal-backdrop {
    background-color: rgba(0, 0, 0, 0.75);
}

.light #video-modal #modal-title {
    color: #fff;
}

.light #video-modal #modal-channel {
    color: rgba(255, 255, 255, 0.7);
}

.light #video-modal #modal-close {
    background-color: rgba(255, 255, 255, 0.15);
}

.light #video-modal #modal-close:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Light Theme - Footer
   ========================================================================== */

.light footer {
    border-color: rgba(44, 42, 39, 0.06);
    background-color: var(--bg-secondary);
}

/* ==========================================================================
   Light Theme - Channel Detail Page
   ========================================================================== */

/* Channel header - keep white text over dark background */
.light .channel-header-section h1 {
    color: #fff;
}

.light .channel-header-section .text-zinc-400 {
    color: rgba(255, 255, 255, 0.75);
}

.light .channel-header-section .text-zinc-500 {
    color: rgba(255, 255, 255, 0.6);
}

.light .channel-header-section .text-zinc-500:hover {
    color: var(--accent);
}

/* YouTube button - keep white text */
.light .channel-header-section .bg-red-600 {
    color: #fff !important;
}

/* Channel avatar border */
.light .channel-header-section .border-accent\/30 {
    border-color: rgba(249, 115, 22, 0.4);
}

/* Channel detail page title */
.light h2.text-lg {
    color: var(--text-primary);
}

/* ==========================================================================
   Light Theme - Channel Banner (when filtering by channel)
   ========================================================================== */

.light #channel-banner {
    background: linear-gradient(to right, var(--bg-secondary), var(--bg-primary));
    border-color: rgba(44, 42, 39, 0.08);
}

.light #channel-banner .bg-accent\/10 {
    background-color: rgba(217, 116, 73, 0.1);
}

/* Channel title */
.light #channel-banner h2 {
    color: var(--text-primary);
}

/* Channel stats */
.light #channel-banner .text-zinc-400 {
    color: var(--text-secondary);
}

/* Clear filter link */
.light #channel-banner .text-zinc-500 {
    color: var(--text-muted);
}

.light #channel-banner .text-zinc-500:hover {
    color: var(--text-primary);
}

/* YouTube button - keep white text on red background */
.light #channel-banner .bg-red-600 {
    color: #fff !important;
}

.light #channel-banner .bg-red-600 svg {
    color: #fff;
}

/* ==========================================================================
   Light Theme - Links
   ========================================================================== */

.light a.text-accent:hover {
    color: var(--accent-hover);
}

/* Channel link hover in cards */
.light .video-card .text-zinc-500 a:hover {
    color: var(--accent);
}

/* ==========================================================================
   Theme Transitions
   ========================================================================== */

body,
.glass,
nav,
footer,
.video-card,
.channel-card,
#hero-section,
.bg-surface-raised,
.bg-surface-overlay,
.filter-menu,
.filter-btn,
.sort-btn,
.category-chip,
#channel-grid > div,
input,
select,
button {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* ==========================================================================
   Mobile & Touch Optimizations
   ========================================================================== */

/* Safe area for iPhone notch */
.safe-area-inset {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Better touch targets */
.touch-manipulation {
    touch-action: manipulation;
}

/* Prevent text selection on buttons and interactive elements */
button,
.category-chip,
.sort-btn,
.filter-btn,
.video-card {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Improve touch scrolling */
.overflow-x-auto,
.overflow-y-auto {
    -webkit-overflow-scrolling: touch;
}

/* Mobile menu animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

#mobile-menu:not(.hidden) {
    max-height: 500px;
}

#mobile-search-bar {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

#mobile-search-bar:not(.hidden) {
    max-height: 80px;
}

/* Mobile filters animation */
#filters-content {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (max-width: 1023px) {
    #filters-content.hidden {
        display: none;
    }

    #filters-content:not(.hidden) {
        animation: slideDown 0.2s ease;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chevron rotation */
#filters-chevron.rotate-180,
#channel-filters-chevron.rotate-180 {
    transform: rotate(180deg);
}

/* Channel filters animation */
#channel-filters-content {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (max-width: 639px) {
    #channel-filters-content.hidden {
        display: none;
    }

    #channel-filters-content:not(.hidden) {
        animation: slideDown 0.2s ease;
    }
}

/* ==========================================================================
   Mobile Breakpoint Utilities
   ========================================================================== */

/* Extra small devices (phones, less than 480px) */
@media (max-width: 479px) {
    /* Smaller text on very small screens */
    .video-card h3 {
        font-size: 0.8125rem;
    }

    /* Compact pagination */
    #pagination {
        gap: 0.5rem;
    }

    #pagination button {
        padding: 0.375rem 0.75rem;
    }

    /* Smaller stats on hero */
    #hero-section .gradient-text {
        font-size: 0.875rem;
    }
}

/* Tablet and up */
@media (min-width: 640px) {
    .xs\:inline {
        display: inline;
    }
}

/* ==========================================================================
   Mobile Video Grid
   ========================================================================== */

@media (max-width: 639px) {
    /* Single column video grid on very small screens */
    #video-grid {
        gap: 0.75rem;
    }

    /* Slightly smaller card padding */
    .video-card > div:last-child {
        padding: 0.625rem;
    }
}

/* ==========================================================================
   Mobile Channel Grid
   ========================================================================== */

@media (max-width: 639px) {
    #channel-grid {
        gap: 0.75rem;
    }
}

/* ==========================================================================
   Mobile Modal Fixes
   ========================================================================== */

@media (max-width: 639px) {
    /* Full screen modal on mobile */
    #video-modal .absolute {
        border-radius: 0;
    }

    /* Better aspect ratio for video on mobile */
    #video-modal .flex-1 {
        min-height: 50vh;
    }
}

/* Landscape mode optimization for modal */
@media (max-height: 500px) and (orientation: landscape) {
    #video-modal .absolute {
        inset: 0;
    }

    #video-modal .flex-1 {
        min-height: 0;
    }

    /* Hide header/footer in landscape to maximize video */
    #video-modal .p-3.bg-black\/50 {
        padding: 0.5rem;
    }
}

/* ==========================================================================
   Mobile Form Inputs
   ========================================================================== */

/* Larger tap targets for inputs on mobile */
@media (max-width: 639px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Prevent zoom on focus */
    input:focus,
    select:focus {
        font-size: 16px;
    }
}

/* ==========================================================================
   Mobile Navigation
   ========================================================================== */

/* Ensure nav stays above content */
nav.sticky {
    z-index: 50;
}

/* Mobile menu items larger tap targets */
#mobile-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   Print Styles (hide interactive elements)
   ========================================================================== */

@media print {
    nav,
    #mobile-menu,
    #mobile-search-bar,
    #video-modal,
    #pagination,
    .filter-dropdown,
    #mobile-filters-toggle {
        display: none !important;
    }
}

/* ==========================================================================
   Touch Feedback States
   ========================================================================== */

/* Active states for touch feedback */
@media (hover: none) {
    .video-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    .category-chip:active,
    .sort-btn:active,
    .filter-btn:active,
    #mobile-menu-btn:active,
    #mobile-search-btn:active,
    #mobile-filters-toggle:active,
    #channel-filters-toggle:active {
        opacity: 0.7;
    }

    /* Better button press feedback */
    button:active:not(:disabled),
    a.bg-accent:active {
        transform: scale(0.97);
        transition: transform 0.1s ease;
    }
}

/* Prevent double-tap zoom on buttons */
button,
a,
.video-card,
.category-chip,
.sort-btn,
.filter-btn {
    touch-action: manipulation;
}

/* Smoother scrolling on touch devices */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   iOS Specific Fixes
   ========================================================================== */

/* Fix for iOS momentum scrolling */
.overflow-x-auto,
.overflow-y-auto,
#video-grid,
#channel-grid {
    -webkit-overflow-scrolling: touch;
}

/* Prevent iOS from highlighting tapped elements */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Fix for iOS input styling */
input[type="text"],
input[type="email"],
input[type="password"],
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: var(--radius-md);
}
