/* Skool Vault — dark, Skool-shaped. No webfonts (offline-safe), no framework. */

:root {
  --bg: #0e1014;
  --bg-2: #14171d;
  --card: #171a21;
  --card-hover: #1c2029;
  --line: #262a33;
  --line-soft: #1e222a;
  --text: #e7e9ee;
  --muted: #939aa6;
  --accent: #f2c94c;          /* Skool's yellow, dulled for a dark UI */
  --accent-ink: #1b1a12;
  --done: #34c77b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: rgba(14, 16, 20, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 800;
}
.search { flex: 1; max-width: 460px; margin: 0 auto; }
.search input {
  width: 100%; padding: 8px 13px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: 14px; outline: none;
}
.search input:focus { border-color: #3a4150; background: #171b22; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions form { margin: 0; }

/* ── buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--card-hover); border-color: #333a46; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: #f7d264; }
.btn.done { background: rgba(52, 199, 123, .12); color: var(--done); border-color: rgba(52, 199, 123, .35); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── layout ─────────────────────────────────────────────────────────────── */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 20px 64px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 8px 0 16px;
}
.section-head h2 { font-size: 20px; }
.community { margin-bottom: 40px; }
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}

/* ── course cards ───────────────────────────────────────────────────────── */
.card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.card:hover { transform: translateY(-2px); border-color: #333a46; box-shadow: var(--shadow); }
.cover { position: relative; aspect-ratio: 16 / 9; background: #10131a; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 34px; font-weight: 800; color: #2f3541;
  background: linear-gradient(135deg, #191d25, #12151b);
}
.badge {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: rgba(52, 199, 123, .16); color: var(--done);
  border: 1px solid rgba(52, 199, 123, .3);
  backdrop-filter: blur(6px);
}
.card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 7px; }
.card-body h3 { font-size: 15.5px; }
.meta { margin: 0; color: var(--muted); font-size: 13px; }

/* ── progress bar ───────────────────────────────────────────────────────── */
.bar { height: 5px; background: #232830; border-radius: 999px; overflow: hidden; }
.bar span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width .3s ease;
}

/* ── course view ────────────────────────────────────────────────────────── */
.course-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 48px);
  align-items: start;
}
.sidebar {
  position: sticky; top: 48px;
  height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-2);
  border-right: 1px solid var(--line-soft);
  padding: 20px 0 40px;
}
.sidebar-head { padding: 0 18px 16px; border-bottom: 1px solid var(--line-soft); }
.sidebar-head h2 { font-size: 17px; margin: 8px 0 6px; }
.back { display: inline-block; color: var(--muted); font-size: 13px; font-weight: 600; }
.back:hover { color: var(--text); }
.sidebar-head .bar { margin-top: 8px; }

.lesson-list, .lesson-list ul { list-style: none; margin: 0; padding: 0; }
.lesson-list { padding-top: 8px; }
.group-name {
  display: block; padding: 16px 18px 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #6f7784;
}
.lesson {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  border-left: 3px solid transparent;
  color: #c4c9d2; font-size: 14px;
}
.lesson:hover { background: #1a1e26; color: var(--text); }
.lesson.current {
  background: #1d222b; color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.lesson.done .lesson-title { color: var(--muted); }
.check {
  flex: none; width: 17px; height: 17px; border-radius: 50%;
  border: 1.5px solid #3a414e;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 800; line-height: 1;
}
.lesson.done .check { background: var(--done); border-color: var(--done); color: #0d1a13; }
.lesson-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dur { flex: none; color: #6f7784; font-size: 12px; font-variant-numeric: tabular-nums; }
.dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ── lesson pane ────────────────────────────────────────────────────────── */
.lesson-pane { padding: 26px 34px 80px; max-width: 900px; }
.player {
  background: #000; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line-soft); box-shadow: var(--shadow);
}
.player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
/* Remote (Zoho WorkDrive) embed: classic 56.25% padding box so the iframe keeps a
   16:9 ratio even in browsers where an iframe ignores aspect-ratio. */
.video-embed { position: relative; width: 100%; padding-top: 56.25%; background: #000; }
.video-embed iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0; display: block;
}
.no-video {
  display: grid; place-items: center; gap: 6px; text-align: center;
  aspect-ratio: 16 / 5;
  background: var(--bg-2); border: 1px dashed var(--line);
  border-radius: var(--radius); color: var(--muted);
}
.lesson-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  margin: 22px 0 18px;
}
.lesson-head h1 { font-size: 25px; }
.crumbs { margin: 0 0 5px; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }

/* ── rendered description ───────────────────────────────────────────────── */
.desc { font-size: 15.5px; line-height: 1.68; color: #d3d7de; overflow-wrap: anywhere; }
.desc > :first-child { margin-top: 0; }
.desc h1, .desc h2, .desc h3, .desc h4 { margin: 26px 0 10px; color: var(--text); }
.desc h1 { font-size: 22px; } .desc h2 { font-size: 19px; } .desc h3 { font-size: 17px; }
.desc p { margin: 0 0 14px; }
.desc a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.desc ul, .desc ol { margin: 0 0 14px; padding-left: 22px; }
.desc li { margin: 4px 0; }
.desc blockquote {
  margin: 16px 0; padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: #15181e; color: #c2c7d0; border-radius: 0 8px 8px 0;
}
.desc hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.desc img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line-soft); margin: 8px 0; }
.desc pre, .desc .md {
  background: #10131a; border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.desc code { background: #10131a; border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 5px; }
.desc pre code { background: none; border: 0; padding: 0; }

/* ── attachments ────────────────────────────────────────────────────────── */
.attachments { margin-top: 32px; }
.attachments h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.attachments ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 10px;
  transition: background .12s ease, border-color .12s ease;
}
.file:hover { background: var(--card-hover); border-color: #333a46; }
.file-name { flex: 1; font-weight: 600; font-size: 14px; }
.file-size { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ── pager ──────────────────────────────────────────────────────────────── */
.pager {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line-soft);
}
.pager .btn { max-width: 46%; overflow: hidden; text-overflow: ellipsis; display: inline-block; }

/* ── search results ─────────────────────────────────────────────────────── */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.results a {
  display: block; padding: 15px 17px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 10px;
}
.results a:hover { background: var(--card-hover); border-color: #333a46; }
.results h3 { font-size: 15.5px; margin-bottom: 3px; }
.snippet { margin: 7px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
mark { background: rgba(242, 201, 76, .22); color: #f7d97e; border-radius: 3px; padding: 0 2px; }

/* ── login ──────────────────────────────────────────────────────────────── */
body.plain { display: grid; place-items: center; min-height: 100vh; }
.login-wrap { width: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
  padding: 34px 30px 30px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-mark { font-size: 30px; }
.login-card h1 { font-size: 21px; }
.login-card p { margin: -4px 0 6px; font-size: 13.5px; }
.login-card input {
  padding: 11px 13px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .btn { justify-content: center; }
.alert {
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px;
  background: rgba(255, 90, 90, .1); color: #ff8f8f;
  border: 1px solid rgba(255, 90, 90, .25);
}

/* ── misc ───────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 90px 20px; display: grid; gap: 10px; place-items: center; }
.empty h1 { font-size: 26px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px);
  padding: 10px 18px; border-radius: 999px;
  background: #22262f; color: var(--text); border: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .course-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .lesson-pane { padding: 20px 16px 60px; }
  .search { max-width: none; }
  .lesson-head { flex-direction: column; align-items: stretch; }
}

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