/* 10X Academy Student Portal */
:root {
  --bg: #f5f7fa; --surface: #fff; --text: #1d2433; --muted: #5d6779; --line: #e1e6ee;
  --brand: #0f5ea8; --brand-dark: #0a4580; --brand-soft: #e7f0fa;
  --ok: #1a7f4b; --ok-soft: #e4f4ea; --warn: #9a6200; --warn-soft: #fdf2dc; --bad: #b42318; --bad-soft: #fde8e6;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
img, video { max-width: 100%; }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; white-space: nowrap; }
.brand-mark { background: var(--brand); color: #fff; border-radius: 6px; padding: .1rem .4rem; margin-right: .2rem; }
.nav { display: flex; align-items: center; gap: .25rem; margin-left: auto; }
.nav a, .nav .link { color: var(--muted); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-weight: 500; }
.nav a:hover, .nav .link:hover { background: var(--bg); color: var(--text); }
.nav a.active { color: var(--brand); background: var(--brand-soft); }
.nav-sep { width: 1px; height: 22px; background: var(--line); margin: 0 .35rem; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.1rem; padding: .25rem .6rem; cursor: pointer; }
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem; }
  .nav.open { display: flex; }
  .nav-sep { display: none; }
}

/* layout */
.app { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.app > .card + .card, .app > .card + .actions, .app > .alert + .btn { margin-top: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.two-col { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.page-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.crumb { display: inline-block; margin-bottom: .75rem; text-decoration: none; font-weight: 500; }

/* auth pages */
.auth-wrap { min-height: 80vh; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { display: block; text-align: center; margin-bottom: 1.25rem; font-size: 1.3rem; }

/* forms */
label { display: block; font-weight: 500; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
input[type=text], input[type=password], input[type=email], input[type=search] {
  width: 100%; padding: .6rem .75rem; border: 1px solid #c9d1dd; border-radius: 8px; font: inherit; background: #fff;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(15,94,168,.35); outline-offset: 1px; }
.hint { font-size: .825rem; color: var(--muted); margin-top: .3rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--brand); color: #fff; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--text); border-color: #c9d1dd; }
.btn.secondary:hover { background: var(--bg); }
.btn.block { width: 100%; }
.btn.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; cursor: default; }
button.link { background: none; border: 0; font: inherit; cursor: pointer; color: var(--brand); padding: 0; }
.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.alert.error { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--brand-soft); color: var(--brand-dark); }

/* badges / progress */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .775rem; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.complete, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.partial, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); }

/* class cards */
.class-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; overflow: hidden; padding: 0; transition: box-shadow .15s; }
.class-card:hover { box-shadow: 0 4px 12px rgba(16,24,40,.12); }
.thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #0f5ea8, #3a8fd6); color: #fff; display: grid; place-items: center; font-size: 2rem; font-weight: 700; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.class-card .body { padding: 1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.class-card .title { font-weight: 600; }
.class-card .body > .badge { align-self: flex-start; }
.class-card .meta { font-size: .825rem; color: var(--muted); }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.tabs button { border: 0; background: none; padding: .35rem .8rem; border-radius: 6px; font: inherit; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* class page */
.class-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.class-head .title { flex: 1; min-width: 240px; }
.rich { overflow-wrap: anywhere; }
.rich img { height: auto; }
.player { background: #000; border-radius: 8px; overflow: hidden; }
.player video { display: block; width: 100%; max-height: 70vh; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li + li { border-top: 1px solid var(--line); }
.lesson-list a { display: flex; align-items: center; gap: .75rem; padding: .7rem .25rem; text-decoration: none; color: inherit; }
.lesson-list a:hover { background: var(--bg); }
.lesson-list .num { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-size: .8rem; font-weight: 600; color: var(--muted); flex: none; }
.lesson-list .num.complete { background: var(--ok-soft); color: var(--ok); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* exam */
.exam { max-width: 680px; margin: 0 auto; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.timer.low { color: var(--bad); }
.answers { display: grid; gap: .6rem; margin: 1rem 0; }
.answer { display: flex; gap: .7rem; align-items: center; padding: .8rem 1rem; border: 1px solid #c9d1dd; border-radius: 8px; cursor: pointer; background: #fff; font-weight: 400; margin: 0; }
.answer:hover { border-color: var(--brand); }
.answer input { margin: 0; }
.answer.chosen { border-color: var(--brand); background: var(--brand-soft); }
.answer.right { border-color: var(--ok); background: var(--ok-soft); }
.answer.wrong { border-color: var(--bad); background: var(--bad-soft); }
.score-big { font-size: 2.6rem; font-weight: 700; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg); }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-top: .75rem; }

/* misc */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 3rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: #1d2433; color: #fff; padding: .7rem 1.1rem; border-radius: 8px; box-shadow: var(--shadow); z-index: 50; max-width: 90vw; }
.toast.error { background: var(--bad); }
