/* =================================================================
   Staff Training Portal — visual identity
   Ink navy ground, brass amber accent (progress/active), muted teal
   (pass), rust (overdue/fail). Display serif for authority, Inter
   for UI, mono for course codes / certificate serials.
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink:        #12151C;
  --panel:      #1B2029;
  --panel-2:    #232936;
  --line:       #303747;
  --text:       #E7E9EE;
  --text-dim:   #99A1B3;
  --paper:      #F3EFE6;
  --brass:      #D9A441;
  --brass-dim:  #8A6C33;
  --teal:       #4C9C87;
  --rust:       #C1523A;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  color: #FFFFFF;
}

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

code, .mono { font-family: var(--font-mono); }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

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

/* ---------- Layout shells ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 28px;
  padding: 0 8px;
}
.sidebar .brand span { color: var(--brass); }

.nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.nav-link.active { background: var(--panel-2); color: #fff; }
.nav-link.active::before { content: '— '; color: var(--brass); }

.sidebar .user-box {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.sidebar .user-box strong { color: var(--text); display:block; font-size: 0.92rem; }
.sidebar .user-box a { color: var(--text-dim); font-size: 0.8rem; }

.main {
  flex: 1;
  padding: 40px 48px;
  max-width: 1100px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 6px;
  display: block;
}

/* ---------- Auth (login) ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 15%, rgba(217,164,65,0.08), transparent 40%),
    var(--ink);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 40px 32px;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card p.sub { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
}
.field input:focus { border-color: var(--brass); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--brass);
  color: #1a1305;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
}
.btn:hover { background: #e7b458; text-decoration: none; }
.btn.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.btn-ghost:hover { background: var(--panel-2); }
.btn.btn-danger { background: var(--rust); color: #fff; }
.btn.full { width: 100%; }

.error-msg {
  background: rgba(193,82,58,0.15);
  border: 1px solid rgba(193,82,58,0.4);
  color: #f0a898;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ---------- Cards / grids ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

.course-card .code { font-family: var(--font-mono); font-size: 0.72rem; color: var(--brass-dim); }
.course-card h3 { font-size: 1.05rem; margin: 4px 0 8px; }
.course-card p { color: var(--text-dim); font-size: 0.88rem; margin: 0 0 14px; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 100px;
  font-family: var(--font-mono);
}
.badge.not_started { background: var(--panel-2); color: var(--text-dim); }
.badge.in_progress { background: rgba(217,164,65,0.18); color: var(--brass); }
.badge.passed { background: rgba(76,156,135,0.18); color: var(--teal); }
.badge.failed { background: rgba(193,82,58,0.18); color: #e58671; }
.badge.required { background: rgba(193,82,58,0.15); color: #e58671; }

/* ---------- Route-line progress (signature element) ---------- */

.route {
  display: flex;
  align-items: center;
  margin: 28px 0 36px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.route-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 92px;
  position: relative;
  flex-shrink: 0;
}
.route-stop .dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 2px solid var(--line);
  z-index: 1;
}
.route-stop.done .dot { background: var(--teal); border-color: var(--teal); }
.route-stop.current .dot { background: var(--brass); border-color: var(--brass); box-shadow: 0 0 0 4px rgba(217,164,65,0.2); }
.route-stop .label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 8px;
  max-width: 100px;
}
.route-stop.current .label, .route-stop.done .label { color: var(--text); }
.route-line-seg {
  height: 2px;
  background: var(--line);
  flex: 1;
  min-width: 24px;
  margin-bottom: 24px;
}
.route-line-seg.done { background: var(--teal); }

/* ---------- Lesson / quiz content ---------- */

.lesson-body { font-size: 0.98rem; color: var(--text); }
.lesson-body iframe { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }

.quiz-q { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 14px; }
.quiz-q .qtext { font-weight: 500; margin-bottom: 12px; }
.quiz-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.quiz-opt:hover { background: var(--panel-2); }
.quiz-opt input { accent-color: var(--brass); }

/* ---------- Certificate ---------- */

.certificate {
  background: var(--paper);
  color: #2A2416;
  border-radius: 4px;
  padding: 56px 48px;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid #d8cfb8;
  position: relative;
}
.certificate::before {
  content: '';
  position: absolute; inset: 14px;
  border: 1.5px solid var(--brass-dim);
  pointer-events: none;
}
.certificate .eyebrow { color: var(--brass-dim); }
.certificate h1 { font-size: 2rem; color: #2A2416; }
.certificate .name { font-family: var(--font-display); font-size: 1.6rem; margin: 18px 0 4px; color: #1a1305; }
.certificate .meta { font-family: var(--font-mono); font-size: 0.78rem; color: #6b6247; margin-top: 24px; }
.certificate .seal {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid var(--brass-dim);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.65rem; color: var(--brass-dim);
  position: absolute; right: 48px; bottom: 48px;
  text-align: center; line-height: 1.2;
}

@media print {
  body * { visibility: hidden; }
  .certificate, .certificate * { visibility: visible; }
  .certificate { position: absolute; top: 0; left: 0; margin: 0; box-shadow: none; }
}

/* ---------- Tables (admin reporting) ---------- */

table.report { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.report th, table.report td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.report th { color: var(--text-dim); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }

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

/* ---------- Responsive ---------- */

@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; }
  .sidebar .brand { margin: 0 16px 0 0; }
  .sidebar .user-box { display: none; }
  .main { padding: 24px 20px; }
}
