/* ========================================
   STREAMFLIX - Netflix Clone Styles
   ======================================== */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    --bg-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #6d6d6d;
    --accent-red: #e50914;
    --accent-red-hover: #f40612;
    --accent-gold: #f5c518;
    --gradient-hero: linear-gradient(0deg, var(--bg-primary) 0%, rgba(20,20,20,0.7) 40%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0.6) 100%);
    --gradient-card: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.9) 100%);
    --shadow-card: 0 8px 32px rgba(0,0,0,0.6);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.8);
    --transition-fast: 0.1s ease;
    --transition-medium: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
    --navbar-height: 68px;
    --row-gap: 3vw;
}

/* ========================================
   Reset & Base
   ======================================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Performance optimizations */
img {
    content-visibility: auto;
}

/* Global touch optimization */
button, a, .card {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

img {
    display: block;
    max-width: 100%;
}

/* ========================================
   Navigation
   ======================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    z-index: 1000;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
    transition: background var(--transition-medium);
}

.navbar.scrolled {
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(10px);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    font-family: var(--font-display);
    font-size: 2.2rem;
    letter-spacing: 3px;
    color: var(--accent-red);
    text-shadow: 0 0 30px rgba(229, 9, 20, 0.5);
}

/* Mobile Menu Button - Hidden by default */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    margin-right: 8px;
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 24px;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-red);
    transition: width var(--transition-medium);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a.active::after {
    width: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-container {
    display: flex;
    align-items: center;
    position: relative;
}

.search-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: transform var(--transition-fast);
}

.search-btn:hover {
    transform: scale(1.1);
}

.search-btn svg {
    width: 22px;
    height: 22px;
}

.search-input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-medium);
    opacity: 0;
}

.search-container.active .search-input {
    width: 240px;
    padding: 10px 16px;
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--text-muted);
    opacity: 1;
    margin-left: 8px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.profile {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.profile:hover {
    transform: scale(1.05);
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
    position: relative;
    height: 90vh;
    min-height: 650px;
    display: flex;
    align-items: center;
    padding-top: var(--navbar-height);
}

.hero-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    transition: background-image var(--transition-slow);
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
}

.hero-content {
    position: relative;
    z-index: 10;
    padding: 0 4%;
    padding-top: 60px;
    max-width: 600px;
    animation: fadeSlideUp 0.8s ease forwards;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 6vw, 5rem);
    letter-spacing: 2px;
    line-height: 1;
    margin-bottom: 16px;
    text-shadow: 2px 2px 20px rgba(0,0,0,0.8);
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 1px 1px 10px rgba(0,0,0,0.8);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.hero-meta .rating {
    color: var(--accent-gold);
    font-weight: 600;
}

.hero-meta .year,
.hero-meta .duration {
    color: var(--text-secondary);
}

.hero-meta .maturity {
    padding: 2px 8px;
    border: 1px solid var(--text-secondary);
    font-size: 0.85rem;
}

.hero-buttons {
    display: flex;
    gap: 12px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn svg {
    width: 24px;
    height: 24px;
}

.btn-play {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.btn-play:hover {
    background: rgba(255,255,255,0.85);
    transform: scale(1.02);
}

.btn-play:active {
    transform: scale(0.98);
}

.btn-info {
    background: rgba(109, 109, 109, 0.7);
    color: var(--text-primary);
}

.btn-info:hover {
    background: rgba(109, 109, 109, 0.5);
}

.btn-info:active {
    transform: scale(0.98);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    color: var(--text-primary);
}

.btn-icon:hover {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.btn-icon.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

/* ========================================
   Main Content & Rows
   ======================================== */

.main-content {
    position: relative;
    z-index: 10;
    margin-top: -180px;
    padding-bottom: 60px;
}

.content-row {
    margin-bottom: var(--row-gap);
    padding: 0 4%;
    overflow: visible;
}

.row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.row-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.row-see-all {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-fast);
}

.row-see-all:hover {
    color: var(--text-primary);
}

.row-slider-container {
    position: relative;
}

.row-slider {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 10px 0;
    margin: -10px 0;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.row-slider::-webkit-scrollbar {
    display: none;
}

/* Scroll Arrows */
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, var(--bg-primary) 0%, transparent 100%);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.row-slider-container:hover .scroll-arrow {
    opacity: 1;
}

.scroll-arrow:hover {
    color: var(--accent-red);
}

.scroll-arrow svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.scroll-arrow-left {
    left: -20px;
    background: linear-gradient(90deg, var(--bg-primary) 0%, transparent 100%);
}

.scroll-arrow-right {
    right: -20px;
    background: linear-gradient(-90deg, var(--bg-primary) 0%, transparent 100%);
}

.scroll-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Scroll hint indicator */
.row-slider::after {
    content: '';
    flex-shrink: 0;
    width: 20px;
}

/* ========================================
   Cards
   ======================================== */

.card {
    flex-shrink: 0;
    width: 220px;
    aspect-ratio: 2/3;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    transform-origin: center;
}

@media (hover: hover) {
    .card:hover {
        transform: scale(1.05);
        z-index: 100;
        box-shadow: var(--shadow-card);
    }
}

.card:active {
    transform: scale(0.98);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

@media (hover: hover) {
    .card-overlay {
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    .card:hover .card-overlay {
        opacity: 1;
    }
}

@media (hover: none) {
    /* On touch devices, always show title */
    .card-overlay {
        background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 60%);
    }
    
    .card-actions {
        display: none;
    }
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-meta .rating {
    color: var(--accent-gold);
}

.card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.card-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.card-btn svg {
    width: 16px;
    height: 16px;
}

.card-btn-play {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.card-btn-play:hover {
    transform: scale(1.1);
}

.card-btn-add,
.card-btn-info {
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
}

.card-btn-add:hover,
.card-btn-info:hover {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

/* Wide Card (for Latest) */
.card-wide {
    width: 350px;
    aspect-ratio: 16/9;
}

.card-wide .card-overlay {
    padding: 20px;
}

.card-wide .card-title {
    font-size: 1.2rem;
}

/* ========================================
   Full Page Watch View
   ======================================== */

.watch-page {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg-primary);
    display: none;
    flex-direction: column;
    overflow-y: auto;
}

.watch-page.active {
    display: flex;
}

.watch-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    background: linear-gradient(180deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.back-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.watch-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watch-video-container {
    width: 100%;
    height: calc(100vh - 120px);
    min-height: 400px;
    background: #000;
    position: relative;
}

.watch-video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    touch-action: manipulation; /* Allow touch interactions inside iframe */
}

/* Ensure fullscreen works properly */
.watch-video-container:fullscreen,
.watch-video-container:-webkit-full-screen,
.watch-video-container:-moz-full-screen {
    width: 100vw;
    height: 100vh;
    max-height: none;
}

/* Protected Player */
.protected-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.protected-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto;
}


/* Server Selector */
.server-selector {
    background: var(--bg-card);
    padding: 16px 4%;
    border-bottom: 1px solid var(--bg-hover);
}

.server-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.server-selector-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.server-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.server-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.server-btn {
    padding: 8px 16px;
    background: var(--bg-hover);
    border: 2px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.server-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.server-btn.active {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.server-btn.active:hover {
    background: var(--accent-red-hover);
    border-color: var(--accent-red-hover);
}

.server-btn:active {
    transform: scale(0.95);
}

.server-btn .server-quality {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
    text-transform: uppercase;
}

.server-loading {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 10px 0;
}

.server-error {
    color: var(--accent-red);
    font-size: 0.9rem;
    padding: 10px 0;
}

.watch-info {
    padding: 30px 4%;
    background: var(--bg-secondary);
    flex: 1;
}

.watch-details h2 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.watch-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 1rem;
    color: var(--text-secondary);
}

.watch-meta .rating {
    color: var(--accent-gold);
    font-weight: 600;
}

.watch-description {
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 800px;
    font-size: 1.05rem;
}

/* Episode Selector */
.episode-selector {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--bg-hover);
}

.episode-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.episode-selector-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.season-select-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.season-select-container label {
    font-weight: 600;
}

.season-select {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.season-select:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.episode-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.episode-item:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

.episode-item.active {
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.episode-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.episode-item.active .episode-number {
    color: var(--text-primary);
}

.episode-info {
    flex: 1;
}

.episode-info h4 {
    font-size: 1rem;
    margin-bottom: 6px;
    font-weight: 600;
}

.episode-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* ========================================
   Full Page Detail View
   ======================================== */

.detail-page {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: var(--bg-primary);
    overflow-y: auto;
    display: none;
}

.detail-page.active {
    display: block;
}

.detail-back-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 100;
}

.detail-content {
    max-width: 1200px;
    margin: 0 auto;
}

.detail-hero {
    position: relative;
    height: 70vh;
    min-height: 500px;
    max-height: 700px;
    background-size: cover;
    background-position: center top;
}

.detail-hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--bg-secondary) 0%, transparent 60%, rgba(0,0,0,0.3) 100%);
}

.detail-hero-content {
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: 30px;
}

.detail-hero-content h1 {
    font-family: var(--font-display);
    font-size: 3rem;
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.8);
}

.detail-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-info {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    padding: 30px 4%;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 1rem;
}

.detail-meta .match {
    color: #46d369;
    font-weight: 600;
}

.detail-meta .rating {
    color: var(--accent-gold);
}

.detail-description {
    color: var(--text-secondary);
    line-height: 1.7;
}

.detail-sidebar {
    font-size: 0.9rem;
}

.detail-sidebar p {
    margin-bottom: 8px;
}

.detail-sidebar .label {
    color: var(--text-muted);
}

/* Detail Episodes */
.detail-episodes {
    padding: 0 4% 40px;
}

.episodes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.episodes-header h3 {
    font-size: 1.4rem;
}

.episodes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.episode-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.episode-card:hover {
    background: var(--bg-hover);
}

.episode-thumb {
    width: 160px;
    height: 90px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: var(--bg-primary);
}

.episode-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.episode-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.episode-card:hover .episode-play-icon {
    opacity: 1;
}

.episode-play-icon svg {
    width: 40px;
    height: 40px;
    color: var(--text-primary);
}

.episode-content {
    flex: 1;
}

.episode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.episode-header h4 {
    font-size: 1rem;
}

.episode-header span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.episode-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Similar Titles */
.detail-similar {
    padding: 0 4% 60px;
}

.detail-similar h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.similar-card {
    aspect-ratio: 2/3;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.similar-card:hover {
    transform: scale(1.05);
}

.similar-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   Loading Overlay
   ======================================== */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-slow);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loader-ring {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-hover);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader span {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 4px;
    color: var(--accent-red);
}

/* ========================================
   Search Results
   ======================================== */

.search-results {
    padding-top: calc(var(--navbar-height) + 40px);
}

.search-results-header {
    padding: 0 4%;
    margin-bottom: 30px;
}

.search-results-header h2 {
    font-size: 1.6rem;
    font-weight: 400;
}

.search-results-header span {
    color: var(--text-secondary);
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 0 4%;
}

/* ========================================
   My List Section
   ======================================== */

.my-list-empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.my-list-empty svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.my-list-empty h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1200px) {
    .card {
        width: 180px;
    }
    
    .card-wide {
        width: 300px;
    }
}

@media (max-width: 992px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
    }
    
    .nav-links {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        flex-direction: column;
        padding: 20px;
        gap: 0;
        z-index: 999;
        border-bottom: 1px solid var(--bg-card);
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links li {
        border-bottom: 1px solid var(--bg-card);
    }
    
    .nav-links a {
        display: block;
        padding: 16px 0;
        font-size: 1.1rem;
    }
    
    .hero {
        height: 75vh;
        min-height: 500px;
    }
    
    .hero-content {
        max-width: 100%;
        padding-top: 40px;
    }
    
    .detail-info {
        grid-template-columns: 1fr;
    }
    
    .detail-hero {
        height: 50vh;
        min-height: 350px;
    }
    
    .watch-video-container {
        height: calc(100vh - 140px);
        min-height: 350px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }
    
    .logo {
        font-size: 1.6rem;
    }
    
    .hero {
        height: 70vh;
        min-height: 450px;
    }
    
    .hero-content {
        padding-top: 30px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
        -webkit-line-clamp: 2;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .card {
        width: 140px;
    }
    
    .card-wide {
        width: 260px;
    }
    
    .row-title {
        font-size: 1.2rem;
    }
    
    .main-content {
        margin-top: -100px;
    }
    
    /* Watch Page Mobile */
    .watch-page {
        padding-top: 0;
    }
    
    .watch-header {
        padding: 10px 12px;
        position: relative;
        background: var(--bg-primary);
    }
    
    .watch-title {
        font-size: 0.9rem;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .back-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .back-btn span {
        display: none;
    }
    
    .watch-video-container {
        height: 56.25vw; /* 16:9 aspect ratio */
        min-height: 220px;
    }
    
    .server-selector {
        padding: 12px 16px;
    }
    
    .server-selector-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-bottom: 10px;
    }
    
    .server-selector-header h3 {
        font-size: 0.9rem;
    }
    
    .server-hint {
        font-size: 0.75rem;
    }
    
    .server-list {
        gap: 6px;
    }
    
    .server-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .watch-info {
        padding: 16px;
    }
    
    .watch-details h2 {
        font-size: 1.3rem;
    }
    
    .watch-meta {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }
    
    .watch-description {
        font-size: 0.9rem;
    }
    
    .episode-selector {
        margin-top: 24px;
        padding-top: 20px;
    }
    
    .episode-selector-header h3 {
        font-size: 1.1rem;
    }
    
    .watch-details h2 {
        font-size: 1.5rem;
    }
    
    .episodes-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .episode-item {
        padding: 12px;
        gap: 12px;
    }
    
    .episode-number {
        font-size: 1.4rem;
        min-width: 40px;
    }
    
    .episode-info h4 {
        font-size: 0.9rem;
    }
    
    .episode-info p {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }
    
    /* Detail Page Mobile */
    .detail-hero {
        height: 45vh;
        min-height: 280px;
    }
    
    .detail-hero-content h1 {
        font-size: 1.8rem;
    }
    
    .detail-back-btn {
        top: 16px;
        left: 16px;
    }
    
    .detail-content {
        padding: 0 16px;
    }
    
    .episode-thumb {
        width: 120px;
        height: 68px;
    }
}

@media (max-width: 480px) {
    .hero-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .card {
        width: 110px;
    }
    
    .card-wide {
        width: 200px;
    }
    
    .search-container.active .search-input {
        width: 160px;
    }
    
    /* Hide scroll arrows on mobile - use touch instead */
    .scroll-arrow {
        display: none;
    }
    
    .row-slider {
        padding-left: 4%;
        margin-left: -4%;
        padding-right: 4%;
        gap: 8px;
    }
    
    .row-title {
        font-size: 1rem;
    }
    
    .content-row {
        margin-bottom: 24px;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .card {
        width: 100px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .logo {
        font-size: 1.4rem;
    }
}

/* ========================================
   Loading Skeletons
   ======================================== */

.loading-rows {
    padding: 0 4%;
}

.loading-row {
    margin-bottom: var(--row-gap);
}

.loading-title {
    height: 28px;
    width: 200px;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.loading-cards {
    display: flex;
    gap: 8px;
    overflow: hidden;
}

.loading-card {
    flex-shrink: 0;
    width: 220px;
    aspect-ratio: 2/3;
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Load More Button
   ======================================== */

.load-more-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 4% 60px;
    gap: 16px;
}

.btn-load-more {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--accent-red), #b20710);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-medium);
    box-shadow: 0 8px 30px rgba(229, 9, 20, 0.3);
}

.btn-load-more:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(229, 9, 20, 0.4);
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-load-more svg {
    width: 20px;
    height: 20px;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.catalog-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Infinite Scroll Loading Indicator */
.infinite-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.infinite-loading .loader-ring {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-hover);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.catalog-warning {
    background: rgba(229, 9, 20, 0.2);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 16px 24px;
    margin: 20px 4%;
    text-align: center;
}

.catalog-warning p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========================================
   Browse All Page
   ======================================== */

.browse-header {
    padding: calc(var(--navbar-height) + 40px) 4% 30px;
    text-align: center;
    background: linear-gradient(180deg, rgba(229, 9, 20, 0.1) 0%, transparent 100%);
}

.browse-header h1 {
    font-family: var(--font-display);
    font-size: 3rem;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.browse-header > p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.browse-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--accent-red);
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.browse-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    background: var(--bg-card);
    border: 1px solid var(--text-muted);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 0 4% 60px;
}

.browse-grid .card {
    width: 100%;
}

.browse-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px;
    color: var(--text-secondary);
}

.browse-loading .loader-ring {
    width: 40px;
    height: 40px;
}

@media (max-width: 768px) {
    .browse-header h1 {
        font-size: 2rem;
    }
    
    .browse-stats {
        gap: 40px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .browse-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-row {
    animation: fadeIn 0.3s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
    .content-row {
        animation: none;
    }
}

/* Card Focus State */
.card:focus-visible {
    outline: 2px solid var(--accent-red);
    outline-offset: 2px;
}

/* Focus States */
.card:focus,
.btn:focus,
.search-input:focus {
    outline: 2px solid var(--accent-red);
    outline-offset: 2px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
