/* Rekindle Training — light professional theme, ember accents (brand palette) */
:root {
  --ember: #F85F23;       /* primary accent */
  --ember-deep: #DE3413;  /* hover states, gradient top */
  --ember-low: #FF9616;   /* gradient base */
  --gold: #FFC24B;        /* spark highlights — sparingly */
  --ink: #15171C;         /* charcoal */
  --ink-soft: #4b5563;
  --muted: #6b7280;
  --bg: #F7F5F2;          /* off-white */
  --card: #ffffff;
  --line: #e7e3dd;
  --pass: #15803d;
  --pass-bg: #e8f5ee;
  --fail: #b91c1c;
  --fail-bg: #fdeaea;
  --progress-bg: #fff3dc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(21, 23, 28, .06), 0 1px 3px rgba(21, 23, 28, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100vh; display: flex; flex-direction: column;
  font-size: 15px; line-height: 1.5;
}
a { color: var(--ember); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
small { color: var(--muted); }

/* ---------- Nav ---------- */
.topnav { background: var(--card); border-bottom: 3px solid var(--ember); box-shadow: var(--shadow); }
.topnav-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 24px; padding: 10px 20px; }
.brand { display: flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand-lockup { height: 34px; display: block; }
.navlinks { display: flex; gap: 18px; flex: 1; }
.navlinks a { color: var(--ink-soft); font-weight: 600; padding: 6px 2px; }
.navlinks a:hover { color: var(--ember); text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-user-name { display: flex; flex-direction: column; line-height: 1.15; font-weight: 600; font-size: .88rem; }
.nav-user-name small { font-weight: 400; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: .78rem;
  flex: none;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.15rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.5rem; }
.nav-user-link { display: flex; align-items: center; gap: 10px; color: var(--ink); border-radius: 8px; padding: 3px 6px; }
.nav-user-link:hover { background: #f1eee9; text-decoration: none; }

/* ---------- Layout ---------- */
.page { flex: 1; }
.container { max-width: 1080px; margin: 0 auto; padding: 26px 20px 40px; }
.container.narrow { max-width: 760px; }
.container.wide { max-width: 1280px; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px; }
.page-title { margin-bottom: 18px; }
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-title-row .page-title { margin-bottom: 0; }
.breadcrumbs { color: var(--muted); font-size: .85rem; margin-bottom: 14px; }
.section-title { margin: 4px 0 12px; }
.section-sub { margin-top: 20px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
}
.empty-state { text-align: center; color: var(--muted); padding: 34px; }
.error-card { text-align: center; padding: 40px; }
.error-card h1 { color: var(--ember); }

/* ---------- Buttons, forms, badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; font-size: .9rem; font-weight: 600;
  cursor: pointer; text-decoration: none !important; transition: background .12s, border-color .12s;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn-primary:hover { background: var(--ember-deep); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #3a2b00; }
.btn-pass { background: var(--pass); border-color: var(--pass); color: #fff; }
.btn-danger { background: var(--fail-bg); border-color: #f3c1c1; color: var(--fail); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-icon { padding: 5px 9px; font-size: .85rem; }
.btn[disabled] { opacity: .4; cursor: default; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  font: inherit; color: var(--ink); background: #fff;
}
.input:focus { outline: 2px solid rgba(248, 95, 35, .3); border-color: var(--ember); }
.stack-form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.field-label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field-row { display: flex; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 3px 10px; font-size: .76rem; font-weight: 700;
  background: #eef0f3; color: var(--ink-soft); white-space: nowrap;
}
.badge-pass { background: var(--pass-bg); color: var(--pass); }
.badge-fail { background: var(--fail-bg); color: var(--fail); }
.badge-progress { background: var(--progress-bg); color: #9a6202; }
.badge-locked { background: #eef0f3; color: var(--muted); }
.badge-time { background: #eef2ff; color: #3b4a9f; font-variant-numeric: tabular-nums; }

/* ---------- Progress bars ---------- */
.progress-row { display: flex; align-items: center; gap: 10px; }
.progressbar { flex: 1; height: 8px; border-radius: 999px; background: #e9ebef; overflow: hidden; }
.progressbar-fill { height: 100%; background: linear-gradient(90deg, var(--ember-deep), var(--ember-low)); border-radius: 999px; }
.progress-label { font-size: .82rem; font-weight: 700; color: var(--ink-soft); min-width: 38px; text-align: right; }

/* ---------- Login ---------- */
.login-wrap { max-width: 900px; margin: 0 auto; padding: 48px 20px; flex: 1; }
.login-hero { text-align: center; margin-bottom: 34px; }
.login-lockup { width: 230px; max-width: 70vw; margin-bottom: 4px; }
.auth-card { max-width: 460px; margin: 0 auto 18px; }
.auth-card h2 { margin-bottom: 14px; }
.auth-alt { margin: 14px 0 0; color: var(--muted); font-size: .9rem; }
.form-error {
  background: var(--fail-bg); color: var(--fail); border: 1px solid #f3c1c1;
  border-radius: 8px; padding: 9px 12px; font-size: .88rem; font-weight: 600; margin-bottom: 12px;
}
.demo-hint { max-width: 460px; margin: 0 auto; font-size: .84rem; color: var(--ink-soft); }
.demo-hint ul { margin: 8px 0 0; padding-left: 18px; }
.demo-hint li { margin: 2px 0; }
.demo-hint code { background: #f1eee9; border-radius: 4px; padding: 1px 5px; }

/* ---------- Course cards ---------- */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.course-card { display: flex; flex-direction: column; gap: 10px; }
.course-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.course-card-head h2 a { color: var(--ink); }
.course-card-head h2 a:hover { color: var(--ember); text-decoration: none; }
.course-card p { margin: 0; }
.course-card-meta { display: flex; gap: 16px; color: var(--muted); font-size: .84rem; }
.course-card .btn { align-self: flex-start; }
.new-course-card { border-style: dashed; }

/* ---------- Course detail / module list ---------- */
.course-header { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 18px; }
.course-header h1 { margin-bottom: 4px; }
.course-header p { margin: 0; }
.course-header-stats { min-width: 260px; display: flex; flex-direction: column; gap: 6px; }
.module-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.module-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.module-locked { opacity: .62; }
.module-icon {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.05rem; font-weight: 700;
  background: #f1f2f5; color: var(--ink-soft);
}
.module-icon-lesson { background: #feede5; color: var(--ember-deep); }
.module-icon-quiz { background: #fff3dc; color: #9a6202; }
.module-icon-assignment { background: #e8f0fe; color: #2b5bb8; }
.module-main { flex: 1; min-width: 0; }
.module-title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.module-title { font-weight: 700; color: var(--ink); }
a.module-title:hover { color: var(--ember); text-decoration: none; }
.module-kind { color: var(--muted); font-size: .8rem; }
.module-sub { font-size: .8rem; margin-top: 2px; }
.module-status { flex: none; }
.module-actions { display: flex; gap: 6px; flex: none; }

/* ---------- Viewer ---------- */
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.viewer-head h1 { margin: 0; }
.viewer-head-right { display: flex; gap: 8px; }
.viewer { padding: 0; overflow: hidden; }
.viewer-stage { position: relative; background: #22262b; display: flex; align-items: center; justify-content: center; min-height: 320px; }
.viewer-stage img, .viewer-stage canvas { max-width: 100%; display: block; }
.viewer-stage img { width: 100%; height: auto; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 64px; border: none; border-radius: 10px;
  background: rgba(20, 22, 25, .45); color: #fff; font-size: 1.9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.viewer-nav:hover { background: rgba(222, 52, 19, .85); }
.viewer-nav[disabled] { opacity: .25; cursor: default; }
.viewer-nav[disabled]:hover { background: rgba(20, 22, 25, .45); }
.viewer-prev { left: 12px; }
.viewer-next { right: 12px; }
.viewer-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; }
.viewer-units { display: flex; gap: 6px; flex-wrap: wrap; }
.unit-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid #cdd2d9; background: #fff; cursor: pointer; padding: 0;
}
.unit-dot.viewed { background: var(--gold); border-color: var(--gold); }
.unit-dot.current { border-color: var(--ember); background: var(--ember); }
.viewer-counter { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer-footer { display: flex; align-items: center; gap: 16px; margin-top: 14px; }

/* ---------- Quiz ---------- */
.quiz-form .quiz-q { border: none; border-top: 1px solid var(--line); margin: 0; padding: 16px 0 6px; }
.quiz-form .quiz-q:first-child { border-top: none; padding-top: 4px; }
.quiz-q legend { font-weight: 700; padding: 0 0 8px; }
.quiz-opt { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.quiz-opt:hover { background: #f7f8fa; }
.quiz-result h2 { margin-bottom: 2px; }
.quiz-pass h2 { color: var(--pass); }
.quiz-fail h2 { color: var(--fail); }
.quiz-score { font-size: 1.6rem; font-weight: 800; margin: 0 0 14px; }
.quiz-review { display: flex; flex-direction: column; gap: 12px; }
.quiz-review-q { display: flex; gap: 12px; align-items: flex-start; }
.quiz-review-mark { width: 24px; height: 24px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; }
.quiz-review-mark.ok { background: var(--pass-bg); color: var(--pass); }
.quiz-review-mark.bad { background: var(--fail-bg); color: var(--fail); }
.quiz-q-text { font-weight: 600; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table-card { margin-bottom: 18px; }
.table-scroll { overflow-x: auto; }

/* ---------- Instructor editor ---------- */
.editor-cols { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.editor-side { display: flex; flex-direction: column; gap: 14px; }
.side-card h3 { margin-bottom: 6px; }
.side-card .muted { font-size: .82rem; margin-top: 0; }

/* ---------- Quiz builder ---------- */
.qb-question { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 6px; display: flex; flex-direction: column; gap: 10px; }
.qb-q-head { display: flex; justify-content: space-between; align-items: center; }
.qb-options { display: flex; flex-direction: column; gap: 8px; }
.qb-opt-row { display: flex; gap: 10px; align-items: center; }
.qb-opt-row .input { flex: 1; }

/* ---------- Submissions ---------- */
.submission-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.submission-main { display: flex; flex-direction: column; gap: 8px; min-width: 280px; }
.submission-title { display: flex; align-items: center; gap: 10px; }
.submission-file { font-size: .9rem; }
.submission-grade { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.grade-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grade-form .input { width: 260px; }
.submission-feedback { max-width: 340px; text-align: right; }

/* ---------- Reports ---------- */
.report-table th.report-mod-head { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-cell { min-width: 92px; }
.report-cell.cell-done { background: var(--pass-bg); }
.cell-top { font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-detail { font-size: .74rem; }
.report-user { white-space: nowrap; font-weight: 600; }
.report-user .avatar { width: 24px; height: 24px; font-size: .62rem; vertical-align: middle; margin-right: 4px; }
.unit-bars { display: flex; gap: 10px; align-items: flex-end; padding: 10px 4px 0; overflow-x: auto; }
.unit-bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 46px; }
.unit-bar-col .unit-bar { width: 26px; min-height: 3px; height: 60px; background: linear-gradient(180deg, var(--ember-deep), var(--ember-low)); border-radius: 4px 4px 0 0; align-self: center; }
.unit-bar-col { height: 130px; justify-content: flex-end; }
.unit-bar-label { font-size: .74rem; font-weight: 700; color: var(--ink-soft); }
.unit-bar-secs { font-size: .68rem; white-space: nowrap; }

/* ---------- Profile ---------- */
.profile-cols { display: grid; grid-template-columns: 400px 1fr; gap: 22px; align-items: start; }
.profile-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-name { margin: 0 0 2px; }
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.swatch { cursor: pointer; position: relative; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-dot { display: block; width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + .swatch-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ember); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-tile { text-align: center; padding: 16px 10px; }
.stat-value { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-denom { color: var(--muted); font-size: 1rem; font-weight: 600; }
.stat-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.profile-course-row { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.profile-course-row:first-of-type { border-top: none; padding-top: 0; }
.profile-course-row a { font-weight: 600; }

/* ---------- Admin & compliance ---------- */
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.notice { border-radius: 8px; padding: 10px 14px; font-size: .9rem; font-weight: 600; margin-bottom: 16px; }
.notice-ok { background: var(--pass-bg); color: var(--pass); border: 1px solid #bfe3cd; }
.stat-link { text-decoration: none !important; color: inherit; transition: border-color .12s; }
.stat-link:hover { border-color: var(--ember); }
.stat-bad .stat-value { color: var(--fail); }
.stat-warn .stat-value { color: #9a6202; }
.row-inactive { opacity: .55; }
.input-sm { padding: 5px 8px; font-size: .84rem; width: auto; }
.people-table td { vertical-align: middle; }
.people-actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.audit-table .audit-action { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }
.cell-behind { background: var(--fail-bg); }
.assignment-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .88rem; }
.course-overdue { border-color: #f3c1c1; }
.transcript-total { margin-left: auto; text-align: right; }
.transcript-footer { margin-top: 6px; font-size: .78rem; }

@media print {
  .topnav, .no-print, .footer { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .container { max-width: 100%; padding: 0; }
}

/* ---------- Assignment ---------- */
.assignment-instructions { white-space: pre-wrap; }
.upload-form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.upload-form .btn { align-self: flex-start; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .editor-cols { grid-template-columns: 1fr; }
  .profile-cols { grid-template-columns: 1fr; }
  .course-header { flex-direction: column; align-items: stretch; }
  .navlinks { gap: 10px; }
  .nav-user-name { display: none; }
}
