@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* 🌑 Obsidian & Charcoal Palette with Gold Accents */
    --bg-primary: #080808; /* Obsidian base */
    --bg-secondary: #121415; /* Charcoal */
    --bg-elevated: #1b1e20;
    --accent: #D4AF37; /* Cinematic Gold */
    --accent-hover: #F3E5AB;
    --text-primary: #F0F0F0;
    --text-secondary: #A0A0A0;
    --text-muted: #666666;
    --border: rgba(255, 255, 255, 0.08);
    --star-gold: #D4AF37;
    --success: #2ECC71;
    --shadow-hover: 0 12px 40px rgba(212, 175, 55, 0.15);
    --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.8);
    --transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="light"] {
    /* ☀️ Light Mode Palette (Overridden for cinematic feel) */
    --bg-primary: #080808;
    --bg-secondary: #121415;
    --bg-elevated: #1b1e20;
    --accent: #D4AF37;
    --text-primary: #F0F0F0;
    --text-secondary: #A0A0A0;
    --border: rgba(255, 255, 255, 0.08);
    --shadow-hover: 0 12px 40px rgba(212, 175, 55, 0.15);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

/* 🏔️ Header */
header {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    background: rgba(8, 8, 8, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

.logo {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 1px;
}
.logo span {
    color: var(--accent);
}

nav {
    display: flex;
    gap: 32px;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent);
    transition: var(--transition);
}

nav a:hover, nav a.active {
    color: var(--text-primary);
}

nav a:hover::after, nav a.active::after {
    width: 100%;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}

/* 🏔️ Hero Section */
.hero {
    height: 75vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    /* Dune cinematic bottom-to-top gradient fade */
    background: linear-gradient(to top, var(--bg-primary) 0%, rgba(8, 8, 8, 0.8) 30%, rgba(8, 8, 8, 0) 100%),
                url('https://images.unsplash.com/photo-1542157585-ef20bfc075b5?auto=format&fit=crop&q=80&w=2560'); /* Desert dunes backdrop */
    background-size: cover;
    background-position: center 30%;
    text-align: center;
    padding: 60px 20px;
    margin-top: -80px; /* Pull beneath the transparent header */
    position: relative;
}

.hero h1 {
    font-family: 'Cinzel', serif;
    font-size: 4.5rem;
    font-weight: 800;
    margin-bottom: 32px;
    color: #FFF;
    letter-spacing: 2px;
    text-shadow: 0 10px 30px rgba(0,0,0,0.8);
    max-width: 900px;
    line-height: 1.1;
}

.search-box {
    width: 100%;
    max-width: 700px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(30, 30, 30, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    padding: 8px 12px 8px 24px;
    transition: var(--transition);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-bottom: 24px;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.25);
    background: rgba(30, 30, 30, 0.6);
}

.search-icon {
    font-size: 1.4rem;
    color: var(--text-primary);
}

input#search-input {
    flex: 1;
    padding: 14px 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
}

input#search-input::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    padding: 12px 32px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 100px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
}

.trending-tags {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.trending-tags span {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.trending-tags button {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 6px 18px;
    border-radius: 100px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.trending-tags button:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

/* 🏔️ Filter Bar */
.filters-bar {
    padding: 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.genre-pills {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.genre-pills::-webkit-scrollbar {
    height: 4px;
}

.pill {
    padding: 8px 24px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 100px;
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
}

.pill:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.pill.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

select#sort-select {
    padding: 8px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* 🏔️ Movie Grid */
.movies-grid {
    padding: 0 40px 64px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 32px;
}

/* 🎞️ Movie Card */
.movie-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

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

.poster-wrapper {
    width: 100%;
    aspect-ratio: 2 / 3;
    background: var(--bg-elevated);
    position: relative;
    overflow: hidden;
}

.movie-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.no-poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-elevated) 100%);
    color: var(--text-muted);
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.6;
}

.placeholder-content i {
    font-size: 3rem;
}

.placeholder-content span {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 16px 16px;
    background: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.85) 40%, #000 100%);
}

.year-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #FFF;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.card-meta {
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', sans-serif;
}

.muted-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.card-rating {
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gold-star {
    color: var(--star-gold);
}

.rating-unknown {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

.featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.4);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
    100% { transform: scale(1); opacity: 1; }
}

.card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.card-actions {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    padding: 16px;
    background: var(--bg-elevated);
    display: flex;
    gap: 8px;
    transition: var(--transition);
}

.movie-card:hover .card-actions {
    bottom: 0;
}

.card-actions button {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

/* 🏔️ Sidebar Watchlist */
.watchlist-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    z-index: 1100;
    padding: 40px 24px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.watchlist-panel.active {
    right: 0;
}

.watchlist-items {
    flex: 1;
    overflow-y: auto;
}

/* 🦴 Skeleton Shimmer */
.skeleton {
    background: linear-gradient(90deg, #1A1A1A 25%, #252525 50%, #1A1A1A 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

/* 📱 Responsive */
@media (max-width: 768px) {
    header { padding: 0 20px; }
    .hero h1 { font-size: 2.5rem; }
    .hero { min-height: 500px; padding: 100px 20px 40px; }
    .search-box { flex-direction: column; border-radius: 20px; padding: 16px; }
    .btn-primary { width: 100%; }
    .page-container { padding: 20px; }
    .watchlist-panel { width: 100%; right: -100%; }
}
