:root {
  --bg: #0D0F12;
  --panel: #16191E;
  --panel-hover: #1E232B;
  --gold: #D8A84E;
  --gold-dim: #8A6E33;
  --red: #A8333D;
  --text: #F3F1EA;
  --muted: #9CA3AF;
  --display: 'Bebas Neue', sans-serif;
  --body: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  scroll-behavior: smooth;
}

::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2A2F38; border-radius: 6px; }

/* ---------- NAV ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(13,15,18,0.97) 0%, rgba(13,15,18,0.85) 80%, transparent 100%);
  backdrop-filter: blur(6px);
}

.marquee-strip {
  height: 3px;
  width: 100%;
  background-image: radial-gradient(circle, var(--gold) 1.5px, transparent 1.6px);
  background-size: 18px 3px;
  background-repeat: repeat-x;
  animation: chase 1.4s linear infinite;
  opacity: 0.85;
}

@keyframes chase {
  0% { background-position: 0 0; }
  100% { background-position: 36px 0; }
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 44px;
  flex-wrap: wrap;
  gap: 14px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 24px;
  border: 2px solid var(--gold);
  border-radius: 4px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(216,168,78,0.08);
}

.brand-word {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(216,168,78,0.35);
}

.section-tabs { display: flex; gap: 26px; }
.section-tabs button {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  cursor: pointer;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.section-tabs button:hover { color: var(--text); }
.section-tabs button.active { color: var(--gold); border-bottom-color: var(--gold); }

.nav-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}
.nav-search-toggle:hover { color: var(--gold); background: rgba(216,168,78,0.1); }
.nav-search.open .nav-search-toggle { color: var(--gold); }
.nav-search-input {
  width: 0;
  opacity: 0;
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  outline: none;
  transition: width 0.22s ease, opacity 0.18s ease, border-color 0.18s ease;
}
.nav-search.open .nav-search-input {
  width: 200px;
  opacity: 1;
  border-bottom-color: var(--gold-dim);
  padding: 8px 4px;
}
.nav-search-input::placeholder { color: var(--muted); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 62vh;
  display: flex;
  align-items: flex-end;
  padding: 60px 44px 56px;
  background-color: var(--panel);
  background-size: cover;
  background-position: center 18%;
  transition: background-image 0.25s ease;
}
.hero[hidden] { display: none; }
.hero-loading {
  margin: auto;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.5px;
}
.hero-content { max-width: 620px; position: relative; z-index: 2; }
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.hero-title {
  font-family: var(--display);
  font-size: 68px;
  line-height: 0.95;
  letter-spacing: 1px;
  margin: 0 0 16px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.6);
}
.hero-summary {
  color: #D8D9DC;
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 22px;
  max-width: 540px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 14px; }
.hero-btn {
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 26px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero-btn.primary { background: var(--gold); color: #1A1300; }
.hero-btn.primary:hover { background: #E8BC65; }
.hero-btn.secondary { background: rgba(255,255,255,0.12); color: var(--text); }
.hero-btn.secondary:hover { background: rgba(255,255,255,0.2); }

/* ---------- PAGE HEADING (Movies / TV Shows views) ---------- */
.page-heading {
  padding: 46px 44px 8px;
}
.page-heading h1 {
  font-family: var(--display);
  font-size: 44px;
  letter-spacing: 1px;
  margin: 0;
  color: var(--text);
}
.page-heading p {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 6px 0 0;
}

.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.pill {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted);
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pill:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }
.pill.active {
  background: var(--gold);
  color: #1A1300;
  border-color: var(--gold);
}

/* ---------- LETTER NAV (vertical A-Z sidebar, Plex-style) ---------- */
.letter-nav {
  position: fixed;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.letter-nav button {
  width: 22px;
  height: 18px;
  border: none;
  background: none;
  color: #6B7280;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.15s ease, background 0.15s ease;
}
.letter-nav button:hover {
  color: var(--gold);
  background: rgba(216,168,78,0.12);
}
.letter-nav button.active {
  color: var(--gold);
}

/* ---------- ALPHABETICAL GRID (Movies vertical layout) ---------- */
.letter-section { margin: 30px 0; scroll-margin-top: 60px; }
.letter-section-heading {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 1px;
  color: var(--gold);
  padding: 0 44px;
  margin: 0 0 14px;
}
.library-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 14px;
  padding: 0 44px;
}

/* ---------- ROWS ---------- */
.rows { padding: 8px 0 60px; }
.row { margin: 34px 0; }
.row-heading {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: 1px;
  color: var(--text);
  padding: 0 44px;
  margin: 0 0 14px;
}
.row-track {
  display: flex;
  gap: 14px;
  padding: 4px 44px 14px;
  overflow-x: auto;
}
.card {
  flex: 0 0 auto;
  width: 168px;
  cursor: pointer;
  transition: transform 0.18s ease;
  position: relative;
}
.card:hover { transform: translateY(-6px) scale(1.035); z-index: 3; }
.card-poster-wrap {
  position: relative;
  width: 168px;
  height: 252px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.04);
}
.card-poster-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

.collection-poster-wrap {
  height: 168px;
  border: 1px solid var(--gold-dim);
}
.collection-card .card-title { color: var(--gold); }

.card-quick-edit {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(13,15,18,0.75);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.card:hover .card-quick-edit { opacity: 1; }
.card-type-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(168,51,61,0.85);
  color: #FFF;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
}
.card-title {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-year { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }

.row-empty {
  padding: 0 44px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- MODAL ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6,7,9,0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel);
  border-radius: 10px;
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 30px 80px rgba(0,0,0,0.55);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(13,15,18,0.7);
  color: var(--text);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 5;
}
.modal-body { display: flex; gap: 26px; padding: 30px; }
.modal-poster-wrap { flex: 0 0 220px; position: relative; }
.modal-poster {
  width: 220px;
  height: 330px;
  object-fit: cover;
  border-radius: 8px;
  background: #0A0B0D;
  display: block;
}
.poster-edit-btn {
  display: block;
  margin-top: 10px;
  text-align: center;
  background: rgba(216,168,78,0.12);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 5px;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.poster-edit-btn:hover { background: rgba(216,168,78,0.22); }
.poster-reset-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  border-radius: 5px;
  padding: 8px 0;
  font-size: 12px;
  cursor: pointer;
}
.poster-reset-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }

.modal-info { flex: 1; min-width: 0; }
.modal-info h2 { font-family: var(--display); font-size: 34px; letter-spacing: 0.5px; margin: 4px 0 10px; }
.modal-meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.modal-meta span.badge {
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 1px 6px;
}
.modal-genres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.modal-genres span {
  background: rgba(168,51,61,0.18);
  color: #E48F97;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}
.modal-summary { font-size: 14.5px; line-height: 1.65; color: #D8D9DC; margin-bottom: 16px; }
.modal-credits { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.modal-credits b { color: var(--text); font-weight: 600; }

.modal-schedule {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 4px;
}
.modal-schedule b { color: var(--gold); font-weight: 600; }
.finale-tag {
  display: inline-block;
  background: rgba(168,51,61,0.2);
  color: #E48F97;
  border-radius: 3px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-left: 6px;
}
.upload-status { margin-top: 14px; font-size: 12.5px; font-family: var(--mono); color: var(--gold); min-height: 16px; }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1E232B;
  border: 1px solid var(--gold-dim);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
  .nav-inner { padding: 12px 18px; }
  .nav-search.open .nav-search-input { width: 130px; }
  .hero { padding: 40px 18px 34px; min-height: 48vh; }
  .hero-title { font-size: 42px; }
  .row-heading, .row-track, .row-empty { padding-left: 18px; padding-right: 18px; }
  .page-heading { padding: 30px 18px 4px; }
  .page-heading h1 { font-size: 32px; }
  .letter-nav { right: 2px; }
  .letter-nav button { width: 18px; height: 15px; font-size: 9px; }
  .letter-section-heading, .library-grid { padding-left: 18px; padding-right: 18px; }
  .modal-body { flex-direction: column; padding: 22px; }
  .modal-poster-wrap { flex: none; width: 160px; margin: 0 auto; }
  .modal-poster { width: 160px; height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-strip { animation: none; }
  .card:hover { transform: none; }
}
