:root {
    /* Colors - Modern Blue & Dark Palette */
    --primary: #0077B6;
    --primary-hover: #023E8A;
    --secondary: #90E0EF;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 12px;
}

[data-theme="dark"] {
    --bg-main: #0a0a0a;
    --bg-card: #1a1a1a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #262626;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

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

ul { list-style: none; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header & Nav */
header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.logo span { color: var(--text-primary); }

.search-wrapper {
    flex-grow: 1;
    max-width: 450px;
}

.search-form {
    position: relative;
    width: 100%;
}

.search-form input {
    width: 100%;
    padding: 0.75rem 1.25rem 0.75rem 3rem;
    border: 1px solid var(--border);
    border-radius: 50px;
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.search-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 119, 182, 0.1);
    background: var(--bg-card);
}

.search-form button {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: var(--transition);
}

.search-form button:hover {
    color: var(--primary);
}

.search-form i {
    width: 18px;
    height: 18px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-links {
    display: flex;
    gap: 1.25rem;
}

.nav-links a {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.nav-links a:hover { color: var(--primary); }

.lang-switcher { position: relative; }
.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.lang-btn:hover { border-color: var(--primary); }

.lang-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    display: none;
    padding: 0.5rem;
    z-index: 1001;
}

.lang-dropdown.show { display: block; animation: fadeIn 0.2s ease-out; }
.lang-dropdown a {
    display: block;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.lang-dropdown a:hover { background: var(--bg-main); color: var(--primary); }
.lang-dropdown a.active { color: var(--primary); font-weight: 700; background: rgba(0, 119, 182, 0.05); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition);
}

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

/* Grid layout */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.section-header h2 { font-size: 1.75rem; font-weight: 700; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
    position: relative;
}

.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }

.card-img {
    aspect-ratio: 2/3;
    position: relative;
    overflow: hidden;
    background: var(--border);
}

.card-img img { width: 100%; height: 100%; object-fit: cover; }

.card-info { padding: 1rem; }
.card-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.85rem; color: var(--text-muted); }

.score-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fbbf24;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
}

/* Details Page */
.movie-hero {
    position: relative;
    min-height: 500px;
    display: flex;
    align-items: center;
    color: white;
    padding: 4rem 0;
    background-size: cover;
    background-position: center;
}

.movie-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.7) 100%);
}

.movie-hero-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    align-items: start;
}

.movie-poster {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
}

.movie-poster img { width: 100%; display: block; }

.movie-info h1 { font-size: 3rem; font-weight: 800; margin-bottom: 1rem; }
.movie-meta { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 2rem; color: rgba(255,255,255,0.8); }
.movie-meta span { display: flex; align-items: center; gap: 0.5rem; }

.genre-pills { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 2rem; }
.genre-pill {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.85rem;
    font-weight: 600;
}

.movie-overview { font-size: 1.15rem; line-height: 1.8; color: rgba(255,255,255,0.9); margin-bottom: 2rem; max-width: 800px; }

/* Watch Providers Section */
.watch-providers-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 2rem 0;
}

.watch-providers-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: white;
}

.provider-group {
    margin-bottom: 1rem;
}

.provider-group:last-child { margin-bottom: 0; }

.provider-type {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.provider-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.provider-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: var(--transition);
}

.provider-logo:hover {
    transform: scale(1.1);
}

/* Seasons Section */
.seasons-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.season-card {
    display: flex;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    transition: var(--transition);
}

.season-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.season-poster { width: 80px; height: 120px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--border); }
.season-poster img { width: 100%; height: 100%; object-fit: cover; }

.season-content h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.season-content p { font-size: 0.85rem; color: var(--text-secondary); }
.season-date { font-size: 0.75rem !important; color: var(--text-muted) !important; margin-top: 0.5rem; }

/* Episode List */
.episode-list { border-top: 1px solid var(--border); }
.episode-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.episode-number {
    width: 32px;
    height: 32px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
    flex-shrink: 0;
}

.episode-info { display: flex; flex-direction: column; }
.episode-title { font-weight: 600; font-size: 1rem; }
.episode-date { font-size: 0.8rem; color: var(--text-muted); }

/* Stats & Details Grid */
.details-section { padding: 4rem 0; }
.details-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 4rem; }

.cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
}

.cast-card { text-align: center; }
.cast-img {
    aspect-ratio: 1/1;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 3px solid var(--border);
}

.cast-name { font-weight: 700; font-size: 0.9rem; }
.cast-character { color: var(--text-muted); font-size: 0.8rem; }

.info-sidebar {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    height: fit-content;
}

.info-item { margin-bottom: 1.5rem; }
.info-label { color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; margin-bottom: 0.3rem; }
.info-value { font-weight: 600; font-size: 1.1rem; }

/* Trailer */
.trailer-container {
    margin-top: 3rem;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    background: #000;
}

.trailer-container iframe { width: 100%; height: 100%; border: none; }

/* Person Page */
.person-header {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.person-photo {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.person-photo img { width: 100%; display: block; }

/* Footer */
footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 5rem 0 2rem;
    margin-top: 5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-brand p { color: var(--text-secondary); font-size: 0.95rem; }

.footer-column h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.5rem; }
.footer-column ul li { margin-bottom: 0.75rem; }
.footer-column ul a { color: var(--text-secondary); font-size: 0.95rem; }

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
    .movie-hero-content, .person-header, .details-grid { grid-template-columns: 1fr; }
    .movie-poster, .person-photo { max-width: 300px; margin: 0 auto; }
    .movie-info { text-align: center; }
    .movie-meta, .genre-pills { justify-content: center; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    
    .search-wrapper { max-width: 300px; }
}

@media (max-width: 768px) {
    nav { flex-wrap: wrap; gap: 1rem; }
    .search-wrapper { order: 3; max-width: 100%; flex-basis: 100%; }
    .nav-right { gap: 0.75rem; }
}

@media (max-width: 640px) {
    .footer-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
}