:root {
    --bg: #141414;
    --bg-secondary: #1a1a2e;
    --surface: rgba(30, 30, 46, 0.85);
    --text: #ffffff;
    --text-muted: #b3b3b3;
    --primary: #e50914;
    --primary-hover: #f40612;
    --accent: #46d369;
    --border: rgba(255,255,255,0.1);
    --glass: rgba(20, 20, 30, 0.75);
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --radius: 8px;
    --header-h: 64px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f5f5f5;
    --bg-secondary: #ffffff;
    --surface: rgba(255,255,255,0.9);
    --text: #141414;
    --text-muted: #666;
    --glass: rgba(255,255,255,0.85);
    --border: rgba(0,0,0,0.1);
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

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

.glass {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-h);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
}
.site-logo-img { max-height: 36px; max-width: 160px; object-fit: contain; }

.main-nav { display: flex; gap: 20px; }
.main-nav a { color: var(--text); font-weight: 500; }
.main-nav a:hover { color: var(--primary); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.search-box { position: relative; }
.search-box input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--text);
    width: 220px;
    transition: width var(--transition);
}
.search-box input:focus { width: 280px; outline: none; border-color: var(--primary); }

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 4px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow);
}
.search-dropdown.active { display: block; }
.search-result-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.search-result-item:hover { background: var(--surface); }
.search-result-item img { width: 40px; border-radius: 4px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; transform: scale(1.02); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; font-size: 1.2rem; cursor: pointer; }

/* Hero Slider */
.hero-slider {
    position: relative;
    height: 70vh;
    min-height: 400px;
    overflow: hidden;
}

.hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    opacity: 0;
    transition: opacity 1s ease;
}
.hero-slide.active { opacity: 1; }
.hero-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg) 0%, transparent 50%, rgba(0,0,0,0.3) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 80px;
}

.hero-content h1 { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 12px; text-shadow: 2px 2px 8px rgba(0,0,0,0.8); }
.hero-content p { max-width: 600px; color: var(--text-muted); margin-bottom: 16px; }
.hero-meta { display: flex; gap: 12px; margin-bottom: 20px; }
.hero-actions { display: flex; gap: 12px; }

.hero-dots {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}
.hero-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
}
.hero-dot.active { background: var(--primary); }

.badge {
    background: var(--primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Content Rows */
.content-row { margin: 32px 0; padding: 0 24px; }
.row-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.row-header h2 { font-size: 1.4rem; }
.see-all { color: var(--text-muted); font-size: 0.9rem; }

.row-slider { position: relative; }
.row-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 8px 0;
}
.row-track::-webkit-scrollbar { display: none; }

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    width: 40px;
    height: 80px;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
}
.row-slider:hover .slider-btn { opacity: 1; }
.slider-btn.prev { left: 0; border-radius: 0 4px 4px 0; }
.slider-btn.next { right: 0; border-radius: 4px 0 0 4px; }

/* Movie Cards */
.movie-card { flex: 0 0 180px; transition: transform var(--transition); }
.movie-card:hover { transform: scale(1.08); z-index: 2; }

.card-poster {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 2/3;
}
.card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.movie-card:hover .card-poster img { transform: scale(1.1); }

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.card-title {
    font-size: 0.85rem;
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-link { color: var(--text); }

/* Grid */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding: 24px 0;
}

/* Filters */
.quick-filters, .filter-bar, .filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    margin: 24px 0;
    align-items: center;
}

.quick-filters select, .filter-bar select, .filter-form select,
.quick-filters input, .filter-bar input, .filter-form input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: var(--radius);
}

.az-filter { margin: 16px 0; overflow-x: auto; }
.az-letters { display: flex; gap: 4px; flex-wrap: wrap; }
.az-letter {
    display: inline-flex;
    width: 36px; height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    font-weight: 600;
    transition: all var(--transition);
}
.az-letter:hover { background: var(--primary); color: #fff; }

/* Detail Page */
.detail-hero {
    position: relative;
    min-height: 500px;
    background-size: cover;
    background-position: center;
}
.detail-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, var(--bg) 30%, transparent 70%),
                linear-gradient(to top, var(--bg), transparent 50%);
}
.detail-hero-content {
    position: relative;
    display: flex;
    gap: 32px;
    padding: 120px 24px 48px;
    align-items: flex-end;
}
.detail-poster img { border-radius: var(--radius); box-shadow: var(--shadow); max-width: 280px; }
.detail-info h1 { font-size: 2.5rem; margin-bottom: 12px; }
.detail-meta { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.genre-tags { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tag {
    background: var(--surface);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text);
    border: 1px solid var(--border);
}
.overview { color: var(--text-muted); max-width: 700px; margin-bottom: 20px; }
.detail-actions { display: flex; gap: 12px; }

.detail-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
    padding: 32px 24px;
}
.detail-main section { margin-bottom: 32px; }
.detail-main h2 { margin-bottom: 16px; font-size: 1.3rem; }

.downloads-section { padding: 24px; }
.download-grid { display: flex; flex-direction: column; gap: 16px; }
.download-quality h3 { margin-bottom: 8px; color: var(--primary); }
.download-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.dl-count { color: var(--text-muted); font-size: 0.85rem; margin-left: auto; }

.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
}
.cast-card { text-align: center; }
.cast-card img { width: 100%; border-radius: 50%; aspect-ratio: 1; object-fit: cover; }

.season-block { padding: 20px; margin-bottom: 16px; }
.episode-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.ep-num { font-weight: 700; color: var(--primary); min-width: 30px; }

.info-box { padding: 20px; }
.info-box p { margin-bottom: 8px; font-size: 0.9rem; }

/* Comments */
.comment-form textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    resize: vertical;
}
.comment { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-date { color: var(--text-muted); font-size: 0.8rem; margin-left: 8px; }

/* Auth */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-h));
    padding: 24px;
}
.auth-form {
    width: 100%;
    max-width: 400px;
    padding: 32px;
}
.auth-form h1 { margin-bottom: 24px; text-align: center; }
.auth-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
}
.auth-form p { text-align: center; margin-top: 16px; font-size: 0.9rem; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-success { background: rgba(70,211,105,0.2); border: 1px solid var(--accent); }
.alert-error { background: rgba(229,9,20,0.2); border: 1px solid var(--primary); }

/* Popup Ad */
.popup-ad {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.popup-ad.active { display: flex; }
.popup-content { padding: 24px; max-width: 600px; position: relative; }
.popup-close {
    position: absolute;
    top: 8px; right: 12px;
    background: none; border: none;
    color: var(--text); font-size: 1.5rem;
    cursor: pointer;
}

/* Footer */
.site-footer {
    padding: 32px 0;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

.ad-slot { text-align: center; padding: 8px; overflow: hidden; }

.page-header { padding: 32px 0 16px; }
.page-header h1 { font-size: 2rem; }
.empty-state { text-align: center; padding: 48px; color: var(--text-muted); }
.load-more-wrap { text-align: center; padding: 24px; }
.error-page { text-align: center; padding: 80px 0; }
.error-page h1 { font-size: 6rem; color: var(--primary); }

.profile-card { padding: 32px; max-width: 500px; }

.download-wait { text-align: center; padding: 80px 24px; }
.download-wait h1 { margin-bottom: 16px; }

/* Trailer & Screenshots */
.trailer-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); }
.trailer-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.tagline { font-style: italic; color: var(--text-muted); margin-bottom: 12px; font-size: 1.1rem; }
.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.info-box h3 { margin-bottom: 16px; font-size: 1.1rem; color: var(--text); }
.screenshots-section { margin-bottom: 32px; }
.screenshots-section h2 { margin-bottom: 16px; }
.screenshots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.screenshot-item { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; display: block; transition: transform var(--transition); }
.screenshot-item:hover { transform: scale(1.03); }
.screenshot-item img { width: 100%; height: 100%; object-fit: cover; }
.cast-card small { display: block; color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }
.cast-card strong { display: block; font-size: 0.85rem; margin-top: 8px; }

/* Responsive */
@media (max-width: 768px) {
    .main-nav { display: none; }
    .search-box input { width: 140px; }
    .detail-hero-content { flex-direction: column; align-items: center; text-align: center; padding-top: 80px; }
    .detail-body { grid-template-columns: 1fr; }
    .hero-slider { height: 50vh; }
    .movie-card { flex: 0 0 140px; }
    .header-actions .btn-ghost { display: none; }
}