/* Kariva Study Point — Midnight Scholar theme */
:root {
  --bg: #0b0f19;
  --bg-card: #121826;
  --bg-card-2: #161d2e;
  --bg-elev: #1b2438;
  --border: #26304a;
  --text: #e8ecf5;
  --text-dim: #9aa6bd;
  --gold: #d4af37;
  --gold-dim: #a8861f;
  --gold-bg: rgba(212, 175, 55, 0.08);
  --green: #3fbf6f;
  --red: #e4575f;
  --radius: 12px;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Outfit', system-ui, sans-serif;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3, .brand { font-family: var(--font-serif); }

.container { max-width: 1180px; margin: 0 auto; padding: 0 1.1rem; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 0; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-size: 1.25rem; font-weight: 600; color: var(--text); }
.brand .k { color: var(--gold); }
.topbar nav { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.topbar nav a, .navbtn {
  color: var(--text-dim); font-size: 0.9rem; padding: 0.5rem 0.9rem; border-radius: 8px;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}
.topbar nav a:hover, .navbtn:hover { color: var(--text); background: var(--bg-elev); }
.topbar nav a.active { color: var(--gold); }
.user-chip {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem 0.45rem; font-size: 0.85rem; color: var(--text-dim);
}
.user-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.user-chip b { color: var(--text); font-weight: 500; }
.btn-logout {
  background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.8rem;
  padding: 0.2rem 0.5rem; border-radius: 6px;
}
.btn-logout:hover { color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 500;
  padding: 0.72rem 1.3rem; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform 140ms var(--ease), background 160ms var(--ease), border-color 160ms var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn-gold { background: var(--gold); color: #10141e; border-color: var(--gold); }
.btn-gold:hover { background: #e3c050; }
.btn-gold:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost { background: var(--bg-elev); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--gold-dim); color: var(--gold); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* ---------- Hero ---------- */
.hero {
  padding: 4.5rem 0 3rem; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(60% 45% at 78% 18%, rgba(212, 175, 55, 0.10), transparent 65%),
    radial-gradient(45% 40% at 12% 70%, rgba(88, 120, 220, 0.08), transparent 60%);
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center; position: relative; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.15; letter-spacing: -0.01em; }
.hero h1 .gold { color: var(--gold); }
.hero p.lead { margin-top: 1.1rem; color: var(--text-dim); font-size: 1.08rem; max-width: 34rem; line-height: 1.6; }
.hero-cta { display: flex; gap: 0.9rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 2.2rem; margin-top: 2.6rem; flex-wrap: wrap; }
.hero-stats .s b { display: block; font-family: var(--font-serif); font-size: 1.7rem; color: var(--gold); }
.hero-stats .s span { color: var(--text-dim); font-size: 0.85rem; }
.hero-card {
  background: linear-gradient(160deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid var(--border); border-radius: 18px; padding: 1.6rem; position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.hero-card h3 { color: var(--gold); margin-bottom: 0.8rem; }
.hero-card ul { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; }
.hero-card li { color: var(--text-dim); font-size: 0.95rem; display: flex; gap: 0.6rem; align-items: flex-start; }
.hero-card li::before { content: '◆'; color: var(--gold); font-size: 0.65rem; margin-top: 0.3rem; }

/* ---------- Sections ---------- */
.section { padding: 2.6rem 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.section-head h2 { font-size: 1.6rem; }
.section-head .sub { color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Search bar ---------- */
.search-bar { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.search-bar input, .search-bar select {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 0.65rem 0.9rem; font-family: var(--font-sans); font-size: 0.95rem;
}
.search-bar input { flex: 1 1 240px; }
.search-bar input:focus, .search-bar select:focus { outline: none; border-color: var(--gold-dim); }

/* ---------- Grid & cards ---------- */
.batch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1.1rem;
}
.batch-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease), box-shadow 220ms var(--ease);
}
.batch-card:hover { transform: translateY(-3px); border-color: var(--gold-dim); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4); }
.batch-card .thumb {
  aspect-ratio: 16 / 9; background: var(--bg-elev); background-size: cover; background-position: center;
  position: relative;
}
.batch-card .thumb .fee {
  position: absolute; right: 0.6rem; bottom: 0.6rem; background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--gold-dim); color: var(--gold); font-size: 0.78rem;
  padding: 0.2rem 0.55rem; border-radius: 999px; font-weight: 500;
}
.batch-card .body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.batch-card h3 { font-size: 1.02rem; line-height: 1.35; }
.batch-card .meta { color: var(--text-dim); font-size: 0.8rem; }
.batch-card .tags { margin-top: auto; display: flex; gap: 0.4rem; flex-wrap: wrap; padding-top: 0.5rem; }
.chip {
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim);
  font-size: 0.72rem; padding: 0.2rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.chip.gold { color: var(--gold); border-color: rgba(212, 175, 55, 0.35); }

/* ---------- Page shell ---------- */
.page-hero { padding: 2.4rem 0 1.4rem; border-bottom: 1px solid var(--border); }
.page-hero h1 { font-size: 1.8rem; }
.page-hero .sub { color: var(--text-dim); margin-top: 0.4rem; font-size: 0.95rem; }
.breadcrumb { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 0.8rem; }
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--gold); }

.tabs { display: flex; gap: 0.3rem; border-bottom: 1px solid var(--border); margin-top: 1.2rem; flex-wrap: wrap; }
.tab {
  background: none; border: none; color: var(--text-dim); font-family: var(--font-sans);
  font-size: 0.92rem; padding: 0.7rem 1rem; cursor: pointer; position: relative;
  transition: color 160ms var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); }
.tab.active::after {
  content: ''; position: absolute; left: 0.6rem; right: 0.6rem; bottom: -1px; height: 2px;
  background: var(--gold); border-radius: 2px;
}

/* ---------- List rows ---------- */
.row-list { display: flex; flex-direction: column; gap: 0.7rem; padding-top: 1.2rem; }
.row-card {
  display: flex; align-items: center; gap: 1rem; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem;
  transition: border-color 180ms var(--ease);
}
.row-card:hover { border-color: var(--gold-dim); }
.row-card .num {
  width: 34px; height: 34px; border-radius: 8px; background: var(--bg-elev); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--gold); font-weight: 600; font-size: 0.85rem; flex-shrink: 0;
}
.row-card .t { flex: 1; min-width: 0; }
.row-card .t h4 { font-size: 0.98rem; font-weight: 500; }
.row-card .t span { color: var(--text-dim); font-size: 0.8rem; }
.status {
  font-size: 0.72rem; padding: 0.22rem 0.6rem; border-radius: 999px; font-weight: 600; letter-spacing: 0.03em;
}
.status.live { background: rgba(63, 191, 111, 0.12); color: var(--green); border: 1px solid rgba(63, 191, 111, 0.4); }
.status.upcoming { background: var(--bg-elev); color: var(--gold); border: 1px solid rgba(212, 175, 55, 0.35); }
.status.ended { background: var(--bg-elev); color: var(--text-dim); border: 1px solid var(--border); }

/* ---------- Login ---------- */
.login-wrap { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 1fr; }
.login-box {
  max-width: 420px; width: 100%; margin: 3rem auto; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 18px; padding: 2.2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.login-box h2 { font-size: 1.7rem; }
.login-box .sub { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.4rem; }
.field { margin-top: 1.2rem; }
.field label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0.4rem; }
.field input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 0.8rem 0.9rem; font-family: var(--font-sans); font-size: 1rem;
}
.field input:focus { outline: none; border-color: var(--gold-dim); }
.note { color: var(--text-dim); font-size: 0.8rem; margin-top: 1rem; line-height: 1.55; }
.otp-row { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.otp-row input { letter-spacing: 0.3em; text-align: center; font-size: 1.2rem; }

/* ---------- Player / viewer ---------- */
.player-box {
  background: #000; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; position: relative; margin-top: 1rem;
}
.player-box video { width: 100%; height: 100%; }
.player-note {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.8rem; padding: 2rem; text-align: center;
}
.player-note .big { font-family: var(--font-serif); font-size: 1.4rem; }
.player-note span { color: var(--text-dim); font-size: 0.9rem; max-width: 26rem; line-height: 1.5; }

/* ---------- States ---------- */
.loading, .empty-state, .error-state {
  text-align: center; padding: 3rem 1rem; color: var(--text-dim);
}
.spinner {
  width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { color: var(--red); }

.load-more { text-align: center; padding: 1.6rem 0; }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border); padding: 2rem 0; margin-top: 3rem;
  color: var(--text-dim); font-size: 0.85rem;
}
footer .cols { display: flex; gap: 2rem; flex-wrap: wrap; justify-content: space-between; }
footer b { color: var(--gold); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .topbar nav { display: none; }
  .topbar nav.open {
    display: flex; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0;
    background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 0.6rem;
  }
  .burger { display: block; }
  .mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    display: flex; background: rgba(11, 15, 25, 0.95); border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }
  .mobile-nav a {
    flex: 1; text-align: center; padding: 0.7rem 0.2rem; color: var(--text-dim); font-size: 0.72rem;
  }
  .mobile-nav a.active { color: var(--gold); }
  .mobile-nav a svg { display: block; margin: 0 auto 0.2rem; }
  body { padding-bottom: 4.2rem; }
}
@media (min-width: 821px) { .burger, .mobile-nav { display: none !important; } }
