/* ── Fiirso — Dark Streaming Theme ─────────────────────────────────────── */

:root {
  --brand:       #e50914;
  --brand-dark:  #b20710;
  --bg:          #141414;
  --bg2:         #1a1a1a;
  --bg3:         #222;
  --card-bg:     #1e1e1e;
  --border:      #2a2a2a;
  --text:        #e5e5e5;
  --muted:       #777;
  --radius:      8px;
  --transition:  .2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* ── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: 0 4%;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,.9) 0%, transparent 100%);
  transition: background var(--transition);
}
.navbar.scrolled { background: var(--bg); box-shadow: 0 2px 10px rgba(0,0,0,.5); }

.navbar-brand {
  font-size: 1.8rem; font-weight: 900;
  color: var(--brand); letter-spacing: 2px;
  flex-shrink: 0;
  /* Halo so the logo stays readable over any hero image/video */
  text-shadow: 0 1px 2px rgba(0,0,0,.95), 0 0 14px rgba(0,0,0,.7);
}

.navbar-links {
  display: flex; align-items: center; gap: 24px;
  list-style: none;
}
.navbar-links a {
  font-size: .9rem; color: #ccc; font-weight: 500;
  transition: color var(--transition);
}
.navbar-links a:hover, .navbar-links a.active { color: #fff; }

.navbar-right {
  display: flex; align-items: center; gap: 12px;
}

.search-toggle {
  background: none; border: none; color: #ccc; cursor: pointer; padding: 4px;
  transition: color var(--transition);
}
.search-toggle:hover { color: #fff; }

.avatar {
  width: 34px; height: 34px; border-radius: 4px;
  object-fit: cover; cursor: pointer; border: 2px solid transparent;
  transition: border-color var(--transition);
}
.avatar:hover { border-color: var(--brand); }

.btn-login {
  background: var(--brand); color: #fff;
  border: none; border-radius: 4px;
  padding: 6px 16px; font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: background var(--transition);
}
.btn-login:hover { background: var(--brand-dark); }

/* Search bar */
.search-bar {
  position: absolute; top: 64px; left: 0; right: 0;
  background: rgba(0,0,0,.95); padding: 12px 4%;
  display: none;
}
.search-bar.open { display: block; }
.search-bar input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 4px; color: #fff; padding: 10px 16px; font-size: 1rem;
}
.search-bar input:focus { outline: none; border-color: var(--brand); }

/* Mobile nav toggle */
.nav-toggle {
  display: none; background: none; border: none; color: #fff;
  font-size: 1.4rem; cursor: pointer;
}

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  position: relative; height: 80vh; min-height: 480px;
  display: flex; align-items: flex-end;
  padding: 0 4% 8%;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center top;
  filter: brightness(.55);
}
.hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,.8) 30%, transparent 70%),
              linear-gradient(to top,   rgba(20,20,20,1) 0%, transparent 40%);
}
.hero-content { position: relative; max-width: 550px; }
.hero-title {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 800; line-height: 1.1; margin-bottom: 14px;
}
.hero-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.hero-year, .hero-dur { color: #aaa; font-size: .9rem; }
.hero-rating { background: var(--brand); color: #fff; padding: 2px 8px; border-radius: 3px; font-size: .8rem; font-weight: 700; }
.hero-desc {
  color: #ccc; font-size: .95rem; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 20px;
}
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 4px; font-weight: 600; font-size: .95rem;
  cursor: pointer; border: none; transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: #fff; color: #000; }
.btn-primary:hover { background: rgba(255,255,255,.8); }
.btn-secondary { background: rgba(109,109,110,.7); color: #fff; }
.btn-secondary:hover { background: rgba(109,109,110,.5); }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); }
.btn-outline { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.4); }
.btn-outline:hover { border-color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-icon { padding: 8px; border-radius: 50%; }

/* ── Section ──────────────────────────────────────────────────────────── */
.section { padding: 32px 4%; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 1.2rem; font-weight: 700; }
.section-more { color: var(--brand); font-size: .85rem; font-weight: 600; }
.section-more:hover { text-decoration: underline; }

/* ── Card Row (horizontal scroll) ────────────────────────────────────── */
.card-row {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px;
  scrollbar-width: thin; scrollbar-color: #444 transparent;
  scroll-snap-type: x mandatory;
}
.card-row::-webkit-scrollbar { height: 4px; }

/* ── Content Card ─────────────────────────────────────────────────────── */
.card {
  flex-shrink: 0;
  width: 160px;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.card:hover { transform: scale(1.05); box-shadow: 0 8px 30px rgba(0,0,0,.6); z-index: 2; }

.card-poster {
  width: 100%; aspect-ratio: 2/3;
  object-fit: cover; background: var(--bg3);
}
.card-poster-placeholder {
  width: 100%; aspect-ratio: 2/3;
  background: linear-gradient(135deg, #1e1e1e, #2a2a2a);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 2rem;
}
.card-body { padding: 10px; }
.card-title {
  font-size: .82rem; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.3; margin-bottom: 4px;
}
.card-meta { font-size: .75rem; color: var(--muted); }

/* Progress bar on card */
.card-progress {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: rgba(255,255,255,.15);
}
.card-progress-fill { height: 100%; background: var(--brand); }

/* Watchlist badge */
.card-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.7); border-radius: 50%;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: #fff;
}

/* Grid layout (browse pages) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.card-grid .card { width: auto; }

/* ── Player Page ──────────────────────────────────────────────────────── */
.player-wrap {
  background: #000; width: 100%;
  aspect-ratio: 16/9; position: relative;
}
.player-wrap iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
}

.watch-layout { padding: 20px 4%; max-width: 1200px; margin: 0 auto; }
.watch-title { font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 800; margin-bottom: 8px; }
.watch-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.watch-meta span { font-size: .88rem; color: var(--muted); }
.watch-meta .badge { background: var(--bg3); color: var(--text); padding: 2px 10px; border-radius: 20px; font-size: .8rem; }
.watch-desc { color: #ccc; font-size: .95rem; line-height: 1.7; margin-bottom: 20px; }
.watch-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }

/* Episode list */
.episode-list { display: flex; flex-direction: column; gap: 2px; }
.episode-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--card-bg); cursor: pointer;
  transition: background var(--transition);
}
.episode-item:hover { background: var(--bg3); }
.episode-item.active { background: rgba(229,9,20,.15); border-left: 3px solid var(--brand); }
.episode-num { font-size: 1.2rem; font-weight: 800; color: var(--muted); min-width: 30px; }
.episode-thumb {
  width: 100px; height: 56px; object-fit: cover; border-radius: 4px;
  flex-shrink: 0; background: var(--bg3);
}
.episode-info { flex: 1; min-width: 0; }
.episode-title { font-weight: 600; font-size: .9rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.episode-dur { font-size: .78rem; color: var(--muted); }
.episode-progress { height: 2px; background: rgba(255,255,255,.1); border-radius: 2px; margin-top: 6px; }
.episode-progress-fill { height: 100%; background: var(--brand); border-radius: 2px; }

/* Season tabs */
.season-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.season-tab {
  padding: 6px 16px; border-radius: 20px;
  background: var(--bg3); color: var(--muted);
  cursor: pointer; font-size: .85rem; font-weight: 600;
  transition: all var(--transition); border: 1px solid transparent;
}
.season-tab:hover { color: #fff; }
.season-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Genre Pills ──────────────────────────────────────────────────────── */
.genre-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.genre-pill {
  padding: 6px 14px; border-radius: 20px;
  background: var(--bg3); color: var(--muted);
  font-size: .82rem; cursor: pointer; border: 1px solid var(--border);
  transition: all var(--transition);
}
.genre-pill:hover, .genre-pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Profile / History ────────────────────────────────────────────────── */
.profile-header {
  display: flex; align-items: center; gap: 20px;
  padding: 32px 4%; background: var(--bg2);
}
.profile-avatar { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; }
.profile-name { font-size: 1.5rem; font-weight: 800; }
.profile-since { font-size: .85rem; color: var(--muted); margin-top: 2px; }

/* ── Admin ────────────────────────────────────────────────────────────── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; flex-shrink: 0;
  background: #111; padding: 20px 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  overflow-y: auto;
}
.admin-sidebar .brand { padding: 10px 20px 24px; font-size: 1.4rem; font-weight: 900; color: var(--brand); }
.admin-sidebar .brand span { color: #fff; font-size: .7rem; font-weight: 400; display: block; letter-spacing: 1px; }
.admin-menu { list-style: none; }
.admin-menu li a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: #888; font-size: .9rem;
  transition: all var(--transition);
}
.admin-menu li a:hover, .admin-menu li a.active { color: #fff; background: rgba(255,255,255,.05); border-left: 3px solid var(--brand); padding-left: 17px; }
.admin-menu .menu-label { padding: 16px 20px 6px; font-size: .7rem; color: #444; text-transform: uppercase; letter-spacing: 1px; }
.admin-main { margin-left: 240px; flex: 1; }
.admin-topbar {
  background: #111; padding: 16px 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.admin-topbar h1 { font-size: 1.1rem; font-weight: 700; }
.admin-content { padding: 28px; }

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  text-align: left; padding: 10px 14px;
  background: var(--bg3); color: var(--muted);
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:hover td { background: rgba(255,255,255,.02); }
.admin-table .thumb { width: 50px; height: 70px; object-fit: cover; border-radius: 4px; background: var(--bg3); }

/* Admin form */
.admin-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.admin-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.form-control {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; color: #fff; padding: 10px 14px; font-size: .9rem;
  transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--brand); background: #252525; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: .78rem; color: #555; margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 10px; }
.form-check input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--brand); }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 2rem; font-weight: 800; }
.stat-icon { font-size: 1.5rem; float: right; opacity: .3; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: rgba(40,167,69,.15); border: 1px solid rgba(40,167,69,.3); color: #6fcf97; }
.alert-danger  { background: rgba(229,9,20,.12);  border: 1px solid rgba(229,9,20,.3);  color: #ff6b6b; }
.alert-info    { background: rgba(23,162,184,.12); border: 1px solid rgba(23,162,184,.3); color: #7ecfda; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 32px 4%; text-align: center;
  color: var(--muted); font-size: .85rem; margin-top: 40px;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--brand); }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 24px 0; }
.page-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; background: var(--bg3); color: var(--text);
  font-size: .9rem; transition: all var(--transition); cursor: pointer;
}
.page-btn:hover { background: var(--brand); color: #fff; }
.page-btn.active { background: var(--brand); color: #fff; font-weight: 700; }
.page-btn.disabled { opacity: .3; cursor: not-allowed; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .navbar-links.open {
    display: flex; flex-direction: column; gap: 0;
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.97); padding: 20px 4%;
    z-index: 999;
  }
  .navbar-links.open a { padding: 14px 0; font-size: 1.1rem; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: block; }

  .hero { height: 65vh; padding-bottom: 10%; }
  .hero-desc { display: none; }

  .card { width: 130px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

  .form-row { grid-template-columns: 1fr; }

  .admin-sidebar { display: none; }
  .admin-sidebar.open { display: block; }
  .admin-main { margin-left: 0; }

  .episode-thumb { width: 72px; height: 40px; }
  .profile-header { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .section { padding: 24px 16px; }
  .hero { padding: 0 16px 12%; }
  .watch-layout { padding: 16px; }
}

/* ── Utilities ────────────────────────────────────────────────────────── */
.text-brand  { color: var(--brand); }
.text-muted  { color: var(--muted) !important; }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--bg3);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notification */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg3); color: #fff; padding: 12px 18px;
  border-radius: 6px; font-size: .88rem; box-shadow: 0 4px 20px rgba(0,0,0,.5);
  animation: slideIn .3s ease; border-left: 3px solid var(--brand);
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
