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

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

:root {
  --bg-primary: #000000;
  --bg-secondary: #0d0d0d;
  --bg-card: #1a1a1a;
  --bg-card-hover: #262626;
  --bg-glass: rgba(255,255,255,0.04);
  --bg-glass-hover: rgba(255,255,255,0.08);
  --text-primary: #e5e5e5;
  --text-secondary: #999999;
  --text-muted: #666666;
  --accent: #e50914;
  --accent-hover: #ff1a25;
  --accent-glow: rgba(229,9,20,0.25);
  --red: #e50914;
  --green: #46d369;
  --yellow: #f5c518;
  --gradient-hero: linear-gradient(135deg, #e50914 0%, #b20710 100%);
  --gradient-card: linear-gradient(145deg, rgba(229,9,20,0.08), rgba(0,0,0,0));
  --shadow-card: 0 4px 20px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px rgba(229,9,20,0.15);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --transition: 0.2s ease;
  --nav-height: 68px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

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

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ─── NAV ─── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 3rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
  transition: background var(--transition);
}
.nav.scrolled { background: rgba(0,0,0,0.95); }
.nav-logo {
  font-size: 1.6rem; font-weight: 800; color: var(--red);
  letter-spacing: -0.5px; text-transform: uppercase;
}
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  color: #b3b3b3; font-size: 0.875rem; font-weight: 400;
  transition: color var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: #fff; font-weight: 500; }
.nav-links a.active::after {
  content: none;
}
.nav-search {
  display: flex; align-items: center; gap: 0.5rem;
  background: transparent; border: 1px solid #555;
  border-radius: var(--radius-sm); padding: 0.35rem 0.75rem;
  transition: all var(--transition);
}
.nav-search:focus-within { border-color: #fff; background: rgba(0,0,0,0.8); }
.nav-search svg { color: #999; }
.nav-search input {
  background: none; border: none; color: #fff;
  font-size: 0.85rem; width: 170px;
}
.nav-search input::placeholder { color: #666; }
.nav-user { display: flex; align-items: center; gap: 1rem; }
.nav-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: #e50914; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.8rem;
  color: #fff; cursor: pointer;
}
.nav-right { display: flex; align-items: center; gap: 1rem; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.3rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.875rem;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: rgba(109,109,110,0.7); color: #fff;
  border: none;
}
.btn-secondary:hover { background: rgba(109,109,110,0.5); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #ff1a25; }
.btn-ghost { background: transparent; color: #b3b3b3; }
.btn-ghost:hover { color: #fff; }
.btn-lg { padding: 0.7rem 2rem; font-size: 1rem; border-radius: var(--radius-sm); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ─── HERO ─── */
.hero {
  position: relative; height: 80vh; min-height: 480px;
  display: flex; align-items: flex-end; padding: 0 3rem 5rem;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
  transition: opacity 1s ease;
}
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(0deg, #000 0%, rgba(0,0,0,0.7) 30%, rgba(0,0,0,0.1) 60%, rgba(0,0,0,0.4) 100%);
}
.hero-content { position: relative; z-index: 2; max-width: 550px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--red); color: #fff; padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm); font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 1rem;
}
.hero-title {
  font-size: 3rem; font-weight: 800; line-height: 1.05;
  margin-bottom: 0.6rem; letter-spacing: -0.5px; color: #fff;
}
.hero-meta {
  display: flex; gap: 0.75rem; align-items: center;
  color: #999; font-size: 0.85rem; margin-bottom: 0.6rem;
}
.hero-meta .rating { color: var(--green); font-weight: 600; }
.hero-desc {
  color: #b3b3b3; font-size: 0.9rem; line-height: 1.5;
  margin-bottom: 1.5rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 0.6rem; }

/* ─── CAROUSEL ROW ─── */
.content-section { padding: 1rem 3rem; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: 1.2rem; font-weight: 700; color: #e5e5e5;
}
.section-link { font-size: 0.8rem; color: #999; }
.section-link:hover { color: #fff; }

.carousel-container { position: relative; }
.carousel {
  display: flex; gap: 0.5rem; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding-bottom: 0.5rem;
  -ms-overflow-style: none; scrollbar-width: none;
  scroll-padding-left: 3rem;
}
.carousel::-webkit-scrollbar { display: none; }

.carousel-btn {
  position: absolute; top: 0; bottom: 0;
  width: 50px; background: rgba(0,0,0,0.5);
  color: #fff; border: none; font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 5; opacity: 0; transition: opacity var(--transition); cursor: pointer;
}
.carousel-container:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: rgba(0,0,0,0.7); }
.carousel-btn.prev { left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.carousel-btn.next { right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* ─── CONTENT CARD ─── */
.card {
  flex-shrink: 0; width: 210px; scroll-snap-align: start;
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--bg-card); transition: all 0.3s ease;
  cursor: pointer; position: relative;
}
.card:hover {
  transform: scale(1.08); z-index: 2;
  box-shadow: 0 8px 30px rgba(0,0,0,0.8);
}
.card-poster {
  width: 100%; aspect-ratio: 2/3; object-fit: cover;
  background: #141414;
}
.card-info { padding: 0.5rem 0.6rem; }
.card-title {
  font-size: 0.82rem; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: #e5e5e5;
}
.card-meta {
  font-size: 0.72rem; color: #777; margin-top: 0.15rem;
  display: flex; gap: 0.5rem;
}
.card-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition);
}
.card:hover .card-overlay { opacity: 1; }
.card-play {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.9); display: flex; align-items: center;
  justify-content: center; font-size: 1.2rem; color: #000;
  transform: scale(0.85); transition: transform var(--transition);
}
.card:hover .card-play { transform: scale(1); }
.card-progress {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: #333;
}
.card-progress-bar { height: 100%; background: var(--red); }

/* ─── DETAILS PAGE ─── */
.details-hero {
  position: relative; min-height: 70vh; display: flex; align-items: flex-end;
  padding: 0 3rem 3rem;
}
.details-hero .hero-bg::after {
  background: linear-gradient(0deg, #000 0%, rgba(0,0,0,0.5) 50%, rgba(0,0,0,0.3) 100%);
}
.details-info { position: relative; z-index: 2; display: flex; gap: 2rem; max-width: 900px; }
.details-poster {
  width: 200px; flex-shrink: 0; border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0,0,0,0.6); aspect-ratio: 2/3; object-fit: cover;
}
.details-text { flex: 1; }
.details-genres { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.genre-tag {
  padding: 0.2rem 0.6rem; border-radius: var(--radius-sm);
  background: #333; border: none;
  font-size: 0.75rem; color: #ccc; font-weight: 500;
}
.details-cast { color: #777; font-size: 0.85rem; margin-top: 0.5rem; }

/* Season tabs */
.season-tabs {
  display: flex; gap: 0; padding: 0 3rem;
  border-bottom: 2px solid #333;
}
.season-tab {
  padding: 0.6rem 1.5rem; border-radius: 0;
  background: transparent; color: #999;
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition); border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.season-tab:hover { color: #e5e5e5; }
.season-tab.active { color: #fff; border-bottom-color: var(--red); font-weight: 600; }

/* Episodes list */
.episodes-list { padding: 1.5rem 3rem; }
.episode-card {
  display: flex; gap: 1rem; padding: 1rem 0;
  border-bottom: 1px solid #1a1a1a;
  transition: background var(--transition);
  cursor: pointer;
}
.episode-card:hover { background: rgba(255,255,255,0.03); }
.episode-thumb {
  width: 180px; flex-shrink: 0; aspect-ratio: 16/9;
  border-radius: var(--radius-sm); object-fit: cover;
  background: #141414;
}
.episode-info { flex: 1; }
.episode-num { font-size: 0.75rem; color: #666; font-weight: 600; }
.episode-title { font-weight: 600; margin: 0.15rem 0 0.3rem; font-size: 0.95rem; }
.episode-desc {
  font-size: 0.82rem; color: #999; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.episode-duration { font-size: 0.75rem; color: #666; margin-top: 0.25rem; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 500;
  color: #999; margin-bottom: 0.35rem;
}
.form-input {
  width: 100%; padding: 0.65rem 0.9rem; border-radius: var(--radius-sm);
  background: #333; border: 1px solid #444;
  color: #fff; font-size: 0.875rem;
  transition: all var(--transition);
}
.form-input:focus { border-color: #fff; }
.form-input::placeholder { color: #777; }
textarea.form-input { min-height: 90px; resize: vertical; }
select.form-input { cursor: pointer; }

/* ─── AUTH PAGE ─── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #000;
  background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400"><rect fill="%23111" width="400" height="400"/></svg>');
}
.auth-card {
  width: 400px; padding: 3rem 3.5rem; border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.85); border: none;
}
.auth-title {
  font-size: 2rem; font-weight: 700; text-align: left;
  margin-bottom: 1.5rem; color: #fff;
}
.auth-subtitle {
  text-align: left; color: #999; font-size: 0.85rem;
  margin-bottom: 1.5rem; margin-top: -1rem;
}
.auth-toggle {
  text-align: left; margin-top: 1.5rem; font-size: 0.85rem;
  color: #737373;
}
.auth-toggle a { color: #fff; }
.auth-toggle a:hover { text-decoration: underline; }

/* ─── LOADING / EMPTY STATES ─── */
.loader {
  display: flex; align-items: center; justify-content: center;
  padding: 4rem; gap: 0.3rem;
}
.loader-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  animation: loaderBounce 1.4s infinite ease-in-out both;
}
.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes loaderBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.empty-state {
  text-align: center; padding: 4rem 2rem; color: #666;
}
.empty-state p { font-size: 1rem; }

/* ─── TOAST ─── */
.toast-container { position: fixed; top: 80px; right: 1.5rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  padding: 0.7rem 1rem; border-radius: var(--radius-sm);
  background: #1a1a1a; border-left: 3px solid #555;
  color: #e5e5e5; font-size: 0.85rem; font-weight: 500;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 320px;
}
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(100%); } }

/* ─── PAGE PADDING ─── */
.page-content { padding-top: var(--nav-height); transition: opacity 0.15s ease; }

/* ─── SEARCH RESULTS ─── */
.search-overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.92);
  padding-top: calc(var(--nav-height) + 1rem);
  display: none; overflow-y: auto;
}
.search-overlay.active { display: block; }
.search-results { padding: 1rem 2rem; max-width: 700px; margin: 0 auto; }
.search-result-item {
  display: flex; gap: 1rem; padding: 0.7rem 0.5rem;
  border-bottom: 1px solid #1a1a1a;
  transition: background var(--transition); cursor: pointer;
}
.search-result-item:hover { background: rgba(255,255,255,0.04); }
.search-result-poster {
  width: 50px; aspect-ratio: 2/3; border-radius: var(--radius-sm);
  object-fit: cover; background: #141414;
}
.search-result-info { flex: 1; }
.search-result-title { font-weight: 600; font-size: 0.9rem; }
.search-result-meta { font-size: 0.78rem; color: #777; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .nav-links { display: none; }
  .hero { height: 65vh; padding: 0 1.5rem 3rem; }
  .hero-title { font-size: 2rem; }
  .content-section { padding: 1rem 1rem; }
  .card { width: 140px; }
  .details-hero { display: block; padding: 0; min-height: auto; }
  .details-hero .hero-bg { height: 320px; position: absolute; top: 0; left: 0; right: 0; bottom: auto; }
  .details-hero .hero-bg::after { background: linear-gradient(0deg, #000 0%, transparent 100%); }
  .details-info { flex-direction: column; align-items: center; text-align: center; padding: 220px 1.5rem 2rem; gap: 1rem; }
  .details-poster { width: 160px; box-shadow: 0 10px 40px rgba(0,0,0,0.9); border: 1px solid rgba(255,255,255,0.05); }
  .season-tabs { padding: 0 1.5rem; }
  .episodes-list { padding: 1rem 1.5rem; }
  .episode-card { flex-direction: column; }
  .episode-thumb { width: 100%; }
  .auth-card { width: 90%; padding: 1.5rem; }
}
