/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a25;
  --bg-card-hover: #242436;
  --bg-sidebar: #0d0d14;
  --bg-input: #1e1e2e;
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #5c5c78;
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --rating: #f59e0b;
  --border: #1e1e32;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
input { font-family: inherit; border: none; outline: none; }
::selection { background: var(--accent); color: white; }

/* ===== SKIP LINK ===== */
.skip-link {
  position: fixed; top: -100%; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: white; padding: 10px 24px;
  border-radius: 0 0 var(--radius) var(--radius); z-index: 9999;
  font-weight: 600; font-size: 14px;
}
.skip-link:focus { top: 0; }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; left: 0; top: 0; width: var(--sidebar-width);
  height: 100vh; background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto;
}
.sidebar-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 24px; }
.logo-text {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: all 0.2s;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item.small { font-size: 12px; color: var(--text-muted); }
.nav-item.small:hover { color: var(--text-secondary); }
.sidebar-section-label {
  padding: 16px 20px 8px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted);
}
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }
.sidebar-footer {
  margin-top: auto; padding: 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-height); background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0 16px; align-items: center; justify-content: space-between;
  z-index: 99;
}
.mobile-logo .logo-text { font-size: 18px; }

/* ===== OVERLAY ===== */
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 90;
}

/* ===== MAIN ===== */
main {
  margin-left: var(--sidebar-width); padding-bottom: 40px;
}

/* ===== HERO ===== */
.hero {
  position: relative; height: 520px; overflow: hidden;
}
.hero-backdrop {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #1a0533 0%, #0a0a1a 40%, #0d0d1a 100%);
  background-size: cover; background-position: center;
}
.hero-backdrop::before {
  content: ''; position: absolute; inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,92,246,0.08) 0%, transparent 50%);
}
.hero-gradient {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 250px;
  background: linear-gradient(to top, var(--bg-primary), transparent);
}
.hero-content {
  position: relative; z-index: 2;
  max-width: 680px; padding: 120px 40px 60px;
}
.hero-badge {
  display: inline-block; padding: 4px 12px;
  background: var(--accent); border-radius: 20px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 16px;
}
.hero-title {
  font-size: 48px; font-weight: 800; line-height: 1.1;
  margin-bottom: 12px;
}
.hero-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 14px; color: var(--text-secondary); margin-bottom: 16px;
}
.hero-rating { display: flex; align-items: center; gap: 4px; color: var(--rating); }
.hero-quality {
  padding: 2px 6px; border: 1px solid var(--text-muted);
  border-radius: 4px; font-size: 11px; font-weight: 600; color: var(--text-secondary);
}
.hero-description {
  font-size: 16px; line-height: 1.6; color: var(--text-secondary);
  margin-bottom: 16px; max-width: 550px;
}
.hero-tags { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.hero-tags span {
  padding: 4px 12px; background: var(--bg-card); border-radius: 20px;
  font-size: 12px; color: var(--text-secondary);
}
.hero-actions { display: flex; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); }
.btn-secondary:hover { background: var(--bg-card-hover); }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: none; padding: 16px 40px; background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}
.search-bar.open { display: block; }
.search-container {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-input); border-radius: var(--radius);
  padding: 10px 16px; max-width: 600px;
}
.search-container svg { color: var(--text-muted); flex-shrink: 0; }
.search-container input {
  flex: 1; background: none; color: var(--text-primary);
  font-size: 14px;
}
.search-container input::placeholder { color: var(--text-muted); }
.search-close { color: var(--text-muted); padding: 4px; }
.search-close:hover { color: var(--text-primary); }

/* ===== CONTENT SECTIONS ===== */
.content-sections { padding: 0 40px; }
.content-section { margin-bottom: 40px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-size: 22px; font-weight: 700;
}
.section-link {
  font-size: 13px; font-weight: 600; color: var(--accent); opacity: 0.8;
}
.section-link:hover { opacity: 1; }

/* ===== MOVIE GRID ===== */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

/* ===== MOVIE CARD ===== */
.movie-card {
  position: relative; border-radius: var(--radius);
  overflow: hidden; background: var(--bg-card);
  transition: all 0.3s; cursor: pointer;
}
.movie-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.movie-card-poster {
  aspect-ratio: 2/3; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
  overflow: hidden;
}
.movie-card-poster .poster-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 48px; opacity: 0.6;
}
.movie-card-poster img {
  width: 100%; height: 100%; object-fit: cover;
}
.movie-card-info { padding: 10px 12px 12px; }
.movie-card-title {
  font-size: 13px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px;
}
.movie-card-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-muted);
}
.movie-card-rating { color: var(--rating); display: flex; align-items: center; gap: 2px; }
.movie-card-type {
  padding: 1px 6px; background: var(--accent-glow);
  border-radius: 4px; font-size: 10px; font-weight: 600; color: var(--accent);
}

/* Card overlay */
.movie-card-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s;
}
.movie-card:hover .movie-card-overlay { opacity: 1; }
.movie-card-overlay .play-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.movie-card:hover .play-icon { transform: scale(1.1); }
.movie-card-overlay .play-icon svg { width: 20px; height: 20px; color: white; margin-left: 2px; }

/* ===== CONTINUE WATCHING ===== */
.continue-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.continue-card .movie-card-poster { aspect-ratio: 16/9; }
.progress-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--bg-card-hover);
}
.progress-bar-fill {
  height: 100%; background: var(--accent); border-radius: 0 2px 2px 0;
  width: 45%;
}

/* ===== FOOTER ===== */
.site-footer {
  margin-top: 40px; border-top: 1px solid var(--border);
  padding: 40px 40px 20px;
}
.footer-content {
  display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between;
  margin-bottom: 30px;
}
.footer-brand { max-width: 260px; }
.footer-brand p { font-size: 13px; color: var(--text-muted); margin-top: 12px; line-height: 1.6; }
.footer-links { display: flex; gap: 40px; flex-wrap: wrap; }
.footer-col { }
.footer-col h4 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-secondary); margin-bottom: 12px;
}
.footer-col a {
  display: block; font-size: 13px; color: var(--text-muted);
  margin-bottom: 8px; transition: color 0.2s;
}
.footer-col a:hover { color: var(--text-secondary); }
.footer-bottom {
  border-top: 1px solid var(--border); padding-top: 16px;
  text-align: center;
}
.footer-bottom p { font-size: 12px; color: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .hero { height: 440px; }
  .hero-title { font-size: 36px; }
  .hero-content { padding: 80px 40px 40px; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
  main { margin-left: 0; padding-top: var(--header-height); }
  .hero { height: 380px; }
  .hero-title { font-size: 28px; }
  .hero-content { padding: 60px 20px 30px; }
  .hero-description { font-size: 14px; }
  .hero-actions { flex-direction: column; }
  .btn { justify-content: center; }
  .content-sections { padding: 0 16px; }
  .section-title { font-size: 18px; }
  .movie-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .site-footer { padding: 24px 16px 16px; }
  .search-bar { padding: 12px 16px; }
  .footer-content { flex-direction: column; gap: 24px; }
  .footer-links { gap: 24px; }
}

@media (max-width: 480px) {
  .hero { height: 320px; }
  .hero-title { font-size: 24px; }
  .movie-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== FOCUS VISIBLE ===== */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.movie-card { animation: fadeIn 0.4s ease-out; }
.movie-card:nth-child(2) { animation-delay: 0.05s; }
.movie-card:nth-child(3) { animation-delay: 0.1s; }
.movie-card:nth-child(4) { animation-delay: 0.15s; }
.movie-card:nth-child(5) { animation-delay: 0.2s; }
.movie-card:nth-child(6) { animation-delay: 0.25s; }

/* ===== PLAYER MODAL ===== */
.player-modal {
  display: none; position: fixed; inset: 0; z-index: 9999;
  align-items: center; justify-content: center;
}
.player-modal.open { display: flex; }
.player-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.85);
}
.player-container {
  position: relative; width: 90%; max-width: 960px;
  background: var(--bg-secondary); border-radius: var(--radius-lg);
  overflow: hidden; z-index: 1;
  animation: modalIn 0.3s ease-out;
}
@keyframes modalIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.player-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.player-title { font-size: 16px; font-weight: 600; }
.player-close {
  width: 36px; height: 36px; display: flex; align-items: center;
  justify-content: center; border-radius: 50%;
  transition: background 0.2s;
}
.player-close:hover { background: var(--bg-card); }
.player-wrapper {
  position: relative; width: 100%; padding-top: 56.25%; /* 16:9 */
}
.player-wrapper iframe {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.player-status {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: var(--text-muted); font-size: 14px; z-index: 2;
  text-align: center; display: none;
}

/* Hero with real backdrop */
.hero-backdrop-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
