/* Key Person AI — Application styles */

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

:root {
  --bg-deep: #0a0e27;
  --bg-elev: #ffffff;
  --bg-soft: #f5f7fb;
  --ink: #0a0e27;
  --ink-soft: #4a5478;
  --muted: #7c8db5;
  --line: #e5eaf5;
  --accent: #5b8cff;
  --accent-deep: #3b6cdd;
  --good: #1f9d6a;
  --warn: #c8782a;
  --bad: #c64242;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-soft);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-deep); }

.brand {
  font-size: .875rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.brand-mark {
  font-size: .875rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.muted { color: var(--muted); }

/* ----- Auth pages (login, error, root loading) ----- */

body.auth-page {
  background: var(--bg-deep);
  color: #fff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: left;
}

.auth-card .brand { color: #b8c5e0; margin-bottom: 2rem; }
.auth-card h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-bottom: 1rem; }
.auth-card .muted { color: #b8c5e0; font-size: 1rem; margin-bottom: 2rem; }
.auth-card label { display: block; font-size: .875rem; font-weight: 500; color: #b8c5e0; margin-bottom: .5rem; }
.auth-card input[type="email"], .auth-card input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1rem;
  padding: .875rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }

/* Buttons */

.button {
  display: inline-block;
  background: #fff;
  color: #0a0e27;
  font-size: 1rem;
  font-weight: 600;
  padding: .875rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: opacity .15s ease;
}
.button:hover { opacity: .9; }
.button:disabled { opacity: .5; cursor: not-allowed; }

.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-deep); }

.link-button {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* Auth-page form messages */

.auth-card .message {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 8px;
  font-size: .9375rem;
}
.auth-card .message.success { background: rgba(31, 157, 106, 0.15); color: #6bd9a8; border: 1px solid rgba(31, 157, 106, 0.3); }
.auth-card .message.error { background: rgba(198, 66, 66, 0.15); color: #ff8a8a; border: 1px solid rgba(198, 66, 66, 0.3); }

/* ----- App pages (dashboard, learn, admin) ----- */

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: .9375rem;
}
.topbar-nav a, .topbar-nav .link-button { color: var(--ink-soft); text-decoration: none; }
.topbar-nav a:hover, .topbar-nav .link-button:hover { color: var(--ink); }

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.page h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .5rem;
}
.page h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--ink-soft);
}

/* Module list */

.modules-list {
  display: grid;
  gap: .75rem;
}
.module-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease;
}
.module-card:hover { border-color: var(--accent); color: var(--ink); }
.module-card .module-meta { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.module-card .module-num { font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.5rem; }
.module-card .module-title { font-size: 1rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.module-card .module-status { font-size: .8125rem; color: var(--muted); flex-shrink: 0; }
.module-card .module-status.completed { color: var(--good); }
.module-card .module-status.in-progress { color: var(--warn); }

/* Quiz page */

.quiz-page .module-eyebrow { margin-bottom: .25rem; font-size: .8125rem; letter-spacing: .15em; text-transform: uppercase; }

.quiz-form { display: grid; gap: 1.25rem; margin-top: 1.5rem; }

.quiz-question {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}
.quiz-question legend {
  font-weight: 500;
  margin-bottom: .75rem;
  display: block;
}
.quiz-question .qnum { color: var(--muted); margin-right: .35rem; font-variant-numeric: tabular-nums; }

.quiz-options { display: grid; gap: .5rem; }
.quiz-option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: .75rem;
  align-items: start;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.quiz-option:hover { border-color: var(--accent); background: var(--bg-soft); }
.quiz-option input[type="radio"] { margin-top: .25rem; }
.quiz-option .opt-letter { color: var(--muted); font-weight: 600; min-width: 1rem; }
.quiz-option .opt-text { color: var(--ink); }

.quiz-actions { display: flex; gap: .75rem; align-items: center; margin-top: 2rem; flex-wrap: wrap; }

.results-detail { display: grid; gap: 1rem; margin: 1.5rem 0; }
.result-item {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}
.result-item.good { border-left-color: var(--good); }
.result-item.bad { border-left-color: var(--bad); }
.result-q { font-weight: 500; margin-bottom: .5rem; }
.result-your, .result-correct { font-size: .9375rem; margin-top: .25rem; }
.result-good { font-size: .9375rem; color: var(--good); margin-top: .25rem; }
.result-correct { color: var(--ink-soft); }
.result-correct span, .result-your span { color: var(--ink); font-weight: 500; }
.result-explanation {
  margin-top: .75rem;
  padding: .75rem .9rem;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: .9375rem;
  color: var(--ink-soft);
}

/* Bullet list inside quiz prose (auto-converted from comma lists). */
.quiz-bullets {
  list-style: disc;
  padding-left: 1.25rem;
  margin: .35rem 0 .25rem;
}
.quiz-bullets li { margin: .15rem 0; }

/* Module reader prose */

.prose { font-size: 1rem; color: var(--ink); line-height: 1.65; }
.prose h1, .prose h2, .prose h3 {
  margin-top: 2rem;
  margin-bottom: .75rem;
  line-height: 1.25;
}
.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.25rem; color: var(--ink); }
.prose h3 { font-size: 1.0625rem; color: var(--ink-soft); }
.prose p { margin: .75rem 0; }
.prose ul, .prose ol {
  margin: .5rem 0 1rem 1.5rem;
  padding: 0;
}
.prose ul li, .prose ol li { margin: .25rem 0; }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose blockquote {
  margin: 1rem 0;
  padding: .5rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  color: var(--ink-soft);
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-soft);
  padding: .1rem .3rem;
  border-radius: 4px;
  font-size: .9em;
}

.module-header { margin-bottom: 1.5rem; }
.module-eyebrow { font-size: .8125rem; letter-spacing: .15em; text-transform: uppercase; }
.module-footer { display: flex; gap: .75rem; align-items: center; margin-top: 2.5rem; flex-wrap: wrap; }

/* Key Takeaways panel (top of each module) */

.key-takeaways {
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.06), rgba(91, 140, 255, 0.02));
  border: 1px solid rgba(91, 140, 255, 0.2);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}
.key-takeaways-label {
  font-size: .8125rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: .75rem;
  font-weight: 600;
}
.key-takeaways ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0;
}
.key-takeaways li {
  margin: .35rem 0;
  color: var(--ink);
  line-height: 1.5;
}

/* Topbar nav extensions */

.topbar-nav a.active { color: var(--ink); font-weight: 600; }

/* Course switcher (dashboard) */

.course-switcher {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .75rem 1rem;
  background: rgba(91, 140, 255, 0.06);
  border: 1px solid rgba(91, 140, 255, 0.2);
  border-radius: 8px;
  margin-bottom: 1.25rem;
}
.course-switcher select {
  padding: .35rem .75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: .9375rem;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.course-switcher-hint { color: var(--ink-soft); }

/* Reset zone (dashboard "Reset my progress" + admin "Reset everyone") */

.reset-zone {
  margin-top: 3rem;
  padding: 1.25rem 1.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.reset-zone h2 { margin-top: 0; margin-bottom: .5rem; font-size: 1rem; color: var(--ink-soft); }
.reset-zone p { margin: .25rem 0 1rem; }
.reset-button {
  background: #fff;
  color: var(--bad);
  border: 1px solid var(--bad);
}
.reset-button:hover { background: rgba(198, 66, 66, 0.06); }
.reset-button:disabled { opacity: .6; }
.reset-zone-danger {
  border-color: var(--bad);
  background: rgba(198, 66, 66, 0.03);
}
.reset-button-danger {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}
.reset-button-danger:hover { background: #a73838; color: #fff; }
.reset-status { margin-left: 1rem; }

/* Helpers */

.muted.small { font-size: .875rem; }

/* Dashboard progress overview */

.progress-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0 2rem;
}
.progress-overview[hidden] { display: none; }
@media (max-width: 700px) { .progress-overview { grid-template-columns: repeat(2, 1fr); } }

.progress-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.25rem;
}
.progress-label {
  font-size: .8125rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .35rem;
}
.progress-value {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.progress-value.good { color: var(--good); }
.progress-of { font-size: 1rem; color: var(--muted); margin-left: .25rem; font-weight: 500; }
.progress-sub { color: var(--muted); font-size: .875rem; margin-top: .35rem; }

/* Refresher cards (slightly accented) */

.refresher-card { border-color: var(--warn); border-left-width: 4px; }

/* Practice page */

.category-section { margin-top: 2rem; }
.category-section h2 { margin-bottom: .75rem; }

.scenario-card-row .module-num { color: var(--accent); }

.scenario-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
}
.scenario-label {
  font-size: .8125rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
  font-weight: 600;
}
.scenario-label.good { color: var(--good); }
.scenario-customer { background: var(--bg-soft); }
.scenario-customer blockquote {
  margin: 0;
  padding: .5rem 1rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--ink);
}
.scenario-block textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  min-height: 120px;
  background: var(--bg-soft);
  color: var(--ink);
}
.scenario-block textarea:focus { outline: none; border-color: var(--accent); background: #fff; }

.scenario-reveal { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.rating-row { display: flex; gap: .5rem; margin: .75rem 0; flex-wrap: wrap; }
.rating-btn {
  flex: 1;
  min-width: 90px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem .25rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  line-height: 1.2;
}
.rating-btn span {
  display: block;
  font-size: .75rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: .25rem;
}
.rating-btn:hover { border-color: var(--accent); }
.rating-btn.selected { border-color: var(--accent); background: rgba(91, 140, 255, 0.08); }

.callout-coming-soon {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin: 1rem 0;
}
.callout-coming-soon h2 { margin-top: 0; margin-bottom: .5rem; color: var(--ink); font-size: 1.25rem; }
.callout-coming-soon p { margin: .5rem 0; }

.prose-bullets { list-style: disc; padding-left: 1.5rem; }
.prose-bullets li { margin: .35rem 0; }

/* Capstone exam */

.exam-progress {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem 0 1.5rem;
}
.exam-progress div {
  height: 100%;
  background: var(--accent);
  transition: width .3s ease;
  width: 0%;
}

.capstone-history { margin: 1.5rem 0; }
.capstone-attempt-row {
  padding: .5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9375rem;
}
.capstone-attempt-row:last-child { border-bottom: none; }

.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.badge.good { background: rgba(31, 157, 106, 0.15); color: var(--good); }
.badge.bad { background: rgba(198, 66, 66, 0.15); color: var(--bad); }
