/* ============================================================
   app.css — Global design system
   ============================================================ */

:root {
  --bg:          #050507;
  --panel:       #101116;
  --panel2:      #171922;
  --text:        #fff;
  --muted:       #a6a8b3;
  --red:         #f31226;
  --red2:        #ff4051;
  --line:        rgba(255,255,255,.12);
  --glass:       rgba(15,15,18,.74);
  --radius:      22px;
  --shadow:      0 30px 90px rgba(0,0,0,.55);
  --header-h:    84px;
}

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  overflow-x: hidden;
}

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

/* ── Site Header ───────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: clamp(24px, 3vw, 52px);
  padding: 0 clamp(22px, 5vw, 92px);
  background: linear-gradient(180deg, rgba(6,8,13,.68) 0%, rgba(6,8,13,.20) 72%, transparent 100%);
  transition: background .28s ease, backdrop-filter .28s ease, box-shadow .28s ease;
}

.site-header.scrolled {
  background: rgba(6,8,13,.94);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  box-shadow: 0 14px 42px rgba(0,0,0,.32);
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 160px;
  text-decoration: none;
}

.brand img {
  display: block;
  width: auto;
  height: 46px;
  max-width: 200px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.30));
  transition: transform .22s ease, opacity .22s ease;
}

.brand:hover img { transform: translateY(-1px) scale(1.025); }

/* Nav panel */
.nav-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2vw, 32px);
  white-space: nowrap;
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: rgba(247,248,251,.86);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: color .2s ease, transform .2s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), var(--red2));
  transform: translateX(-50%);
  transition: width .2s ease;
}

.nav-links a:hover { color: #fff; transform: translateY(-1px); }
.nav-links a.active { color: #fff; }
.nav-links a.active::after,
.nav-links a:hover::after { width: 28px; }

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

/* Search */
.header-search-wrap {
  position: relative;
  width: clamp(240px, 28vw, 460px);
  min-width: 200px;
}

.header-search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  background: rgba(255,255,255,.085);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 12px 30px rgba(0,0,0,.16);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.header-search-form:focus-within {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.26);
  box-shadow: 0 0 0 4px rgba(243,18,38,.09), 0 16px 38px rgba(0,0,0,.22);
}

.header-search-form > span {
  color: #e3e7ee;
  font-size: 22px;
  line-height: 1;
  opacity: .92;
  flex-shrink: 0;
}

.header-search-form input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}

.header-search-form input::placeholder { color: rgba(223,228,236,.65); }

/* Search suggestions */
.header-search-suggestions {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 999999;
  display: none;
  max-height: 510px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px;
  background: rgba(13,16,23,.97);
  box-shadow: 0 28px 80px rgba(0,0,0,.58);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
}

.header-suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: #fff;
  text-decoration: none;
  transition: background .18s ease;
}

.header-suggest-item:last-child { border-bottom: 0; }
.header-suggest-item:hover { background: rgba(243,18,38,.12); }

.header-suggest-item img {
  width: 46px;
  height: 68px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 9px;
  background: #20242d;
}

.header-suggest-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-suggest-info strong {
  margin-bottom: 5px;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.header-suggest-info span { color: var(--muted); font-size: 12px; }
.header-no-result { padding: 16px; color: var(--muted); font-size: 14px; }

/* Login button */
.login-btn {
  min-width: 104px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.15), rgba(255,255,255,.07));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 12px 30px rgba(0,0,0,.16);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.24);
  background: linear-gradient(145deg, rgba(255,255,255,.21), rgba(255,255,255,.10));
}

/* Hamburger */
.hamb {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 13px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background .2s ease;
  flex-shrink: 0;
}

.hamb:hover { background: rgba(255,255,255,.13); }

/* ── Legacy class aliases (used by some pages) ─────────────── */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.12);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  min-width: 260px;
}

.search input {
  border: 0;
  background: transparent;
  color: #fff;
  outline: 0;
  padding: 12px 8px;
  width: 100%;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary { background: #fff; color: #000; border-color: #fff; }
.btn.red     { background: var(--red); border-color: var(--red); }

/* ── Hero (legacy pages) ───────────────────────────────────── */
.hero {
  min-height: 760px;
  padding: 170px 5vw 80px;
  position: relative;
  display: flex;
  align-items: center;
  background-size: cover;
  background-position: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #050507 0%, rgba(5,5,7,.82) 32%, rgba(5,5,7,.15) 72%),
    linear-gradient(0deg, #050507 0%, rgba(5,5,7,0) 45%);
}

.hero-content { position: relative; max-width: 720px; }
.eyebrow { letter-spacing: .22em; text-transform: uppercase; color: #17e88d; font-weight: 900; font-size: 13px; }
.hero h1 { font-size: clamp(46px, 8vw, 120px); line-height: .9; margin: 22px 0; font-weight: 950; }
.meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: #d9d9df; margin: 12px 0; }
.badge { background: rgba(255,255,255,.14); border: 1px solid var(--line); padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 800; }
.stars { color: #ffc400; }
.hero p { font-size: 19px; line-height: 1.6; color: #e4e4ea; }
.actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

/* ── Main content area ─────────────────────────────────────── */
.main { padding: 0 5vw 70px; }
.section { margin: 34px 0 52px; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.section h2 { font-size: 28px; margin: 0; }

/* ── Cards / Grid / Rail ───────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
}

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 190px);
  gap: 18px;
  overflow-x: auto;
  padding: 4px 0 18px;
  scroll-snap-type: x mandatory;
}

.rail::-webkit-scrollbar { height: 5px; }
.rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 999px; }

.card {
  background: var(--panel);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 35px rgba(0,0,0,.3);
  transition: .25s transform, .25s box-shadow;
  scroll-snap-align: start;
  border: 1px solid rgba(255,255,255,.05);
}

.card:hover { transform: translateY(-6px); box-shadow: 0 24px 52px rgba(0,0,0,.48); }

.poster { aspect-ratio: 2/3; object-fit: cover; width: 100%; background: #111; }
.card-body { padding: 12px; }
.card-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: 13px; margin-top: 5px; }

/* ── Page-level layouts ────────────────────────────────────── */
.page-title   { padding: 130px 5vw 20px; }
.page-title h1 { font-size: 54px; margin: 0; }

.details {
  padding: 130px 5vw 70px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 36px;
}

.details .poster { border-radius: 22px; }

.watch-layout {
  padding: 110px 5vw 70px;
  display: grid;
  grid-template-columns: minmax(0,1fr) 320px;
  gap: 26px;
}

.player {
  background: #000;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 520px;
}

.player iframe,
.player video {
  width: 100%;
  height: 620px;
  border: 0;
  background: #000;
}

.watch-info {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
}

.selector { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

.selector select,
.form-input {
  background: #11131a;
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

/* ── Auth / Setup ──────────────────────────────────────────── */
.auth-page,
.setup-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: radial-gradient(circle at top, #2a0508, #050507 45%);
}

.auth-card,
.setup-card {
  width: min(560px, 100%);
  background: rgba(18,18,24,.88);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 32px;
  box-shadow: var(--shadow);
}

label { display: block; color: #d8d8df; margin: 14px 0 8px; }
.form-input { width: 100%; }

.alert { padding: 13px 16px; border-radius: 12px; margin: 14px 0; }
.alert.err { background: #3a1115; color: #ffb7bd; }
.alert.ok  { background: #123520; color: #a7ffcc; }

/* ── Admin ─────────────────────────────────────────────────── */
.admin { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.admin-side { background: #0b0c12; border-right: 1px solid var(--line); padding: 26px; position: sticky; top: 0; height: 100vh; }
.admin-side img { height: 48px; margin-bottom: 30px; }
.admin-side a { display: block; padding: 13px 14px; border-radius: 12px; color: #ddd; margin: 6px 0; }
.admin-side a:hover { background: #1b1d27; }
.admin-main { padding: 32px; background: #f4f5f8; color: #111; min-width: 0; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; }
.stat { background: #fff; border-radius: 18px; padding: 20px; box-shadow: 0 6px 28px rgba(0,0,0,.08); }
.stat b { font-size: 32px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 18px; overflow: hidden; }
.table th, .table td { padding: 14px; border-bottom: 1px solid #eee; text-align: left; }
.admin-card { background: #fff; border-radius: 20px; padding: 22px; margin: 20px 0; box-shadow: 0 6px 28px rgba(0,0,0,.08); }

/* ── Misc ──────────────────────────────────────────────────── */
.card a  { display: block; }
.main    { min-height: 45vh; }
.admin-main { overflow-x: auto; }
.table-wrap { width: 100%; overflow-x: auto; }
.table { min-width: 680px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (min-width: 1400px) {
  .main, .page-title, .details, .watch-layout { padding-left: 7vw; padding-right: 7vw; }
  .rail { grid-auto-columns: minmax(180px, 210px); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .hero-content { max-width: 820px; }
}

@media (max-width: 1280px) {
  .site-header { gap: 18px; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 14px; }
  .hero h1 { font-size: clamp(44px, 8vw, 88px); }
  .watch-layout { grid-template-columns: 1fr; }
  .player iframe, .player video { height: 56vw; min-height: 360px; max-height: 620px; }
}

/* ── Tablet ────────────────────────────────────────────────── */
@media (max-width: 980px) {
  :root { --header-h: 72px; }

  .site-header {
    padding: 0 18px;
    gap: 12px;
    background: rgba(6,8,13,.88) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
  }

  .brand img { height: 40px !important; max-width: 170px !important; }

  .hamb { display: inline-flex; margin-left: auto; }

  .nav-panel {
    position: fixed;
    top: var(--header-h);
    left: 12px;
    right: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    max-height: calc(100dvh - calc(var(--header-h) + 14px));
    overflow-y: auto;
    padding: 18px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 22px;
    background:
      radial-gradient(circle at 90% 4%, rgba(243,18,38,.10), transparent 28%),
      rgba(9,12,18,.98);
    box-shadow: 0 30px 80px rgba(0,0,0,.65);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    z-index: 9999;
  }

  .nav-panel.open,
  .nav-panel.active { display: flex; }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .nav-links a {
    min-height: 50px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 13px;
    font-size: 15px;
    justify-content: flex-start;
  }

  .nav-links a::after { display: none; }

  .nav-links a:hover,
  .nav-links a.active {
    transform: none;
    border-color: rgba(255,255,255,.08);
    background: rgba(255,255,255,.065);
  }

  .nav-links a.active { box-shadow: inset 3px 0 0 var(--red); }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 11px;
  }

  .header-search-wrap { width: 100%; min-width: 0; }
  .login-btn { width: 100%; justify-content: center; }

  .hero { min-height: 560px; padding: 118px 18px 56px; background-position: center top; }
  .hero::before {
    background:
      linear-gradient(180deg, rgba(5,5,7,.3) 0%, rgba(5,5,7,.72) 45%, #050507 96%),
      linear-gradient(90deg, #050507 0%, rgba(5,5,7,.35) 60%, rgba(5,5,7,.1) 100%);
  }

  .eyebrow { font-size: 11px; }
  .hero h1 { font-size: clamp(38px, 13vw, 68px); line-height: .94; margin: 16px 0; }
  .hero p { font-size: 15.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .meta { font-size: 13px; }
  .actions { gap: 10px; }
  .btn { padding: 11px 16px; font-size: 14px; }

  .main { padding: 0 18px 56px; }
  .section { margin: 26px 0 38px; }
  .section h2 { font-size: 22px; }
  .rail { grid-auto-columns: minmax(130px, 42vw); gap: 12px; padding-bottom: 14px; }
  .grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
  .card { border-radius: 13px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 13px; }
  .card-meta { font-size: 12px; }

  .page-title { padding: 104px 18px 18px; }
  .page-title h1 { font-size: 36px; }

  .details { padding: 104px 18px 56px; display: block; }
  .details > .poster { max-width: 220px; margin: 0 auto 22px; }

  .watch-layout { padding: 92px 12px 48px; display: block; }
  .player { border-radius: 16px; min-height: 220px; }
  .player iframe, .player video { height: 56.25vw; min-height: 220px; }
  .watch-info { margin-top: 16px; border-radius: 16px; padding: 16px; }

  .selector select, .form-input { width: 100%; }
  .auth-page, .setup-page { padding: 18px; }
  .auth-card, .setup-card { padding: 22px; border-radius: 20px; }

  .admin { grid-template-columns: 1fr; }
  .admin-side { display: flex; gap: 8px; overflow-x: auto; height: auto; position: relative; padding: 12px; }
  .admin-side img { height: 36px; margin: 0 12px 0 0; flex: 0 0 auto; }
  .admin-side a { white-space: nowrap; margin: 0; padding: 10px 12px; }
  .admin-main { padding: 18px; }
  .admin-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
  .stat { padding: 16px; }
  .stat b { font-size: 25px; }
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 560px) {
  :root { --header-h: 66px; }

  body { font-size: 15px; }

  .site-header { padding: 0 12px; }
  .brand img { height: 36px !important; max-width: 160px !important; }
  .hamb { width: 40px; height: 40px; border-radius: 12px; font-size: 18px; }

  .nav-panel { top: var(--header-h); left: 10px; right: 10px; border-radius: 18px; padding: 14px; }

  .hero { min-height: 520px; padding: 100px 14px 44px; }
  .hero h1 { font-size: clamp(34px, 15vw, 56px); }
  .hero p { font-size: 14px; }
  .badge { font-size: 11px; padding: 4px 7px; }
  .actions .btn { flex: 1; min-width: 130px; }

  .main { padding-left: 14px; padding-right: 14px; }
  .section-head { align-items: flex-start; gap: 8px; }
  .grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
  .rail { grid-auto-columns: minmax(120px, 46vw); }

  .page-title h1 { font-size: 30px; }
  .details > .poster { max-width: 180px; }
  .player iframe, .player video { height: 58vw; min-height: 205px; }
  .watch-info h1 { font-size: 24px; }

  .admin-grid { grid-template-columns: 1fr; }
  .admin-card { padding: 16px; border-radius: 16px; }
  .table th, .table td { padding: 10px; font-size: 13px; }
}

@media (max-width: 380px) {
  .brand img { height: 32px !important; max-width: 140px !important; }
  .hero h1 { font-size: 32px; }
  .grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .rail { grid-auto-columns: 142px; }
  .btn { padding: 10px 13px; }
  .card-title { font-size: 12px; }
  .page-title h1 { font-size: 27px; }
}

@media (hover: none) {
  .card:hover { transform: none; }
  .btn:active, .card:active { transform: scale(.98); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
