/* =========================================================================
   PRO SELLER — design tokens
   Palette:  --bg (deep indigo night), --surface (card), --surface-2 (raised),
             --primary (electric indigo), --accent (cyan), --line (hairline),
             --text / --text-dim, --good / --warn / --bad
   Type:     display = 'Sora' (headlines, numbers) — geometric, confident
             body    = 'Inter' (everything readable)
             mono    = 'JetBrains Mono' (prices, codes, lesson numbers)
   Signature: the "lesson ladder" — a vertical stepped rail that visualises
             sequential unlocking. Locked = dim node, active = pulsing ring,
             done = filled node + connecting line lights up.
   ========================================================================= */

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

:root {
  --bg: #0c0e1f;
  --bg-soft: #11142b;
  --surface: #161a36;
  --surface-2: #1d2142;
  --line: #2a2f55;
  --primary: #5b6cff;
  --primary-dim: #3c47a8;
  --accent: #34e7e0;
  --text: #eef0fb;
  --text-dim: #9aa0c7;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f3617a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 80% -10%, #1a1f44 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}

h1, h2, h3, h4, .display {
  font-family: 'Sora', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.mono { font-family: 'JetBrains Mono', monospace; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

::selection { background: var(--primary-dim); }

/* focus visibility (a11y) */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- layout shells ---------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-narrow { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12,14,31,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Sora'; font-weight: 800; color: #06081a; font-size: 0.95rem;
}
.nav-links { display: flex; gap: 4px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.nav-link {
  color: var(--text-dim); padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 0.92rem;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-2); text-decoration: none; }

.lang-switch { display: flex; gap: 6px; align-items:center; }
.lang-btn {
  font-family: 'JetBrains Mono'; font-size: 0.75rem; font-weight: 600; padding: 5px 9px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim);
}
.lang-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration:none; }

.page { padding: 36px 0 70px; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Sora', 'Inter'; font-weight: 700; font-size: 0.9rem;
  padding: 11px 22px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s;
  text-decoration: none; letter-spacing: .2px;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #7b6cff 100%);
  color: #fff; box-shadow: 0 8px 24px -6px rgba(91,108,255,.55);
}
.btn-primary:hover { box-shadow: 0 14px 32px -6px rgba(91,108,255,.7); }
.btn-accent { background: linear-gradient(135deg, var(--accent), #22d3d6); color: #06251f; box-shadow: 0 8px 24px -6px rgba(52,231,224,.4); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); border-radius:12px; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger {
  background: rgba(243,97,122,0.12); color: var(--bad);
  border-color: rgba(243,97,122,0.35); box-shadow: 0 4px 14px -4px rgba(243,97,122,.2);
}
.btn-danger:hover { background: rgba(243,97,122,0.22); }
.btn-success { background: linear-gradient(135deg,#065f46,#059669); color:#fff; box-shadow:0 8px 24px -6px rgba(5,150,105,.4); }
.btn-sm { padding: 7px 15px; font-size: 0.82rem; border-radius: 9px; }
.btn-lg { padding: 14px 30px; font-size: 1rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* Admin file upload styled */
input[type=file] {
  background: var(--surface-2);
  border: 2px dashed var(--line);
  border-radius: 10px; padding: 10px 14px;
  color: var(--text-dim); font-size: 0.85rem;
  cursor: pointer; transition: border-color .2s;
}
input[type=file]:hover { border-color: var(--primary); }
input[type=file]::file-selector-button {
  background: linear-gradient(135deg,var(--primary),#7b6cff);
  color:#fff; border:none; border-radius:8px;
  padding:6px 14px; font-size:0.82rem; font-weight:700;
  cursor:pointer; margin-right:12px; font-family:'Sora',sans-serif;
  transition: opacity .15s;
}
input[type=file]::file-selector-button:hover { opacity:.85; }


label { display:block; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px; font-family: 'Inter'; font-size: 0.95rem;
}
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card-flat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.74rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; font-family: 'JetBrains Mono';
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-locked { background: rgba(154,160,199,.12); color: var(--text-dim); }
.badge-progress { background: rgba(251,191,36,.15); color: var(--warn); }
.badge-done { background: rgba(52,211,153,.15); color: var(--good); }
.badge-bad { background: rgba(243,97,122,.15); color: var(--bad); }

.tag-chip {
  display:inline-block; font-size:0.74rem; font-family:'JetBrains Mono'; color: var(--accent);
  background: rgba(52,231,224,.1); padding: 3px 9px; border-radius: 6px; margin: 0 4px 4px 0;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table th { text-align: left; color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.flash-stack { position: fixed; top: 78px; right: 20px; z-index: 200; display:flex; flex-direction:column; gap:8px; max-width: 320px; }
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 600;
  box-shadow: var(--shadow); border: 1px solid var(--line); background: var(--surface);
}
.flash-success { border-color: rgba(52,211,153,.4); color: var(--good); }
.flash-danger { border-color: rgba(243,97,122,.4); color: var(--bad); }
.flash-warning { border-color: rgba(251,191,36,.4); color: var(--warn); }

/* ---------- LESSON LADDER (signature element) ---------- */
.ladder { position: relative; padding-left: 38px; }
.ladder::before {
  content: ""; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 2px;
  background: var(--line);
}
.ladder-item { position: relative; margin-bottom: 6px; }
.ladder-node {
  position: absolute; left: -38px; top: 14px; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-family: 'JetBrains Mono'; font-size: 0.7rem;
  font-weight: 700; border: 2px solid var(--line); background: var(--bg-soft); color: var(--text-dim); z-index: 2;
}
.ladder-item.is-done .ladder-node { background: var(--good); border-color: var(--good); color: #04261a; }
.ladder-item.is-active .ladder-node { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px rgba(52,231,224,.15); }
.ladder-item.is-done::after {
  /* light up the segment of rail above completed items */
  content: ""; position: absolute; left: -25px; top: -6px; width: 2px; height: 20px; background: var(--good);
}
.ladder-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.ladder-item.is-locked .ladder-row { opacity: .55; }
.ladder-title { font-weight: 600; }
.ladder-meta { font-size: 0.78rem; color: var(--text-dim); }

/* ---------- video player ---------- */
.video-shell { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.video-shell video { width: 100%; display: block; max-height: 70vh; background: #000; }
.video-watermark {
  position: absolute; pointer-events: none; color: rgba(255,255,255,0.35); font-family: 'JetBrains Mono';
  font-size: 0.75rem; padding: 4px 8px; background: rgba(0,0,0,0.25); border-radius: 6px; z-index: 5;
  user-select: none; transition: left 6s linear, top 6s linear;
}
.video-protect-note { font-size: 0.78rem; color: var(--text-dim); margin-top: 8px; }

/* ---------- progress bar ---------- */
.progress-track { background: var(--bg-soft); border-radius: 999px; height: 10px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; transition: width .4s ease; }

/* ---------- stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat-num { font-family: 'Sora'; font-size: 1.9rem; font-weight: 800; }
.stat-label { color: var(--text-dim); font-size: 0.82rem; margin-top: 4px; }

/* ---------- chat ---------- */
.chat-window { display:flex; flex-direction:column; gap:10px; padding: 16px; max-height: 480px; overflow-y:auto; background: var(--bg-soft); border-radius: var(--radius); border: 1px solid var(--line); }
.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 14px; font-size: 0.9rem; }
.chat-bubble.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.them { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.chat-time { font-size: 0.68rem; opacity: .65; margin-top: 4px; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; align-items:flex-end; }
.chat-form textarea { min-height: 44px; }

/* ---------- admin shell ---------- */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--bg-soft); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top:0; height: 100vh; overflow-y:auto; }
.admin-sidebar .brand { padding: 6px 8px 18px; }
.admin-nav-link { display: block; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text-dim); font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.admin-nav-link:hover, .admin-nav-link.active { background: var(--surface-2); color: var(--text); text-decoration:none; }
.admin-main { padding: 28px 30px; max-width: 1200px; }
.admin-topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom: 22px; flex-wrap:wrap; gap: 10px; }

.section-title { display:flex; align-items:baseline; justify-content:space-between; margin-bottom: 16px; flex-wrap:wrap; gap:10px; }
.muted { color: var(--text-dim); }
.hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display:grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; display:flex; overflow-x:auto; gap:4px; white-space:nowrap; }
  .admin-sidebar .brand { display:none; }
}

.center-screen { min-height: 80vh; display: flex; align-items:center; justify-content:center; }
.auth-card { width: 100%; max-width: 420px; }

.empty-state { text-align:center; padding: 50px 20px; color: var(--text-dim); }

/* hero */
.hero { padding: 70px 0 50px; text-align:center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 820px; margin: 0 auto 18px; }
.hero p { color: var(--text-dim); max-width: 620px; margin: 0 auto 28px; font-size: 1.05rem; }
.hero-actions { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }
.feature-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap:16px; margin-top: 24px;}
.feature-card { background: var(--surface); border:1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature-icon { width:42px; height:42px; border-radius:11px; background: linear-gradient(135deg,var(--primary),var(--accent)); display:flex; align-items:center; justify-content:center; font-size:1.2rem; margin-bottom: 14px; }

/* ---------- USER SHELL (sidebar layout for logged-in users) ---------- */
.user-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 64px); }
.user-sidebar {
  background: var(--bg-soft); border-right: 1px solid var(--line);
  padding: 24px 14px; position: sticky; top: 64px; height: calc(100vh - 64px);
  overflow-y: auto;
}
.user-nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 600; font-size: 0.92rem; margin-bottom: 3px;
}
.user-nav-link:hover, .user-nav-link.active {
  background: var(--surface-2); color: var(--text); text-decoration: none;
}
.user-nav-link .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.user-main { padding: 32px 36px; max-width: 1000px; }

/* profile chip in topbar */
.profile-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px 6px 10px;
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  text-decoration: none; transition: background .15s;
}
.profile-chip:hover { background: var(--surface); text-decoration: none; }
.profile-chip .chip-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; color: #06081a;
}
.profile-chip .chip-id { color: var(--text-dim); font-size: 0.78rem; font-family: 'JetBrains Mono'; }

/* course card */
.course-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.course-card-img { width: 100%; height: 140px; object-fit: cover; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 2rem; }
.course-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-card-title { font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.course-card-desc { color: var(--text-dim); font-size: 0.86rem; flex: 1; margin-bottom: 14px; }
.course-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge-free { background: rgba(52,211,153,.15); color: var(--good); }
.badge-price { background: rgba(91,108,255,.15); color: var(--primary); font-family: 'JetBrains Mono'; }

@media (max-width: 720px) {
  .user-shell { grid-template-columns: 1fr; }
  .user-sidebar {
    position: static; height: auto; display: flex; overflow-x: auto;
    gap: 4px; white-space: nowrap; padding: 10px 12px;
    top: 0; border-right: none; border-bottom: 1px solid var(--line);
  }
  .user-sidebar hr { display: none; }
  .user-main { padding: 20px 16px; }
}
