/* =========================================================
   Savoka IT Sales Training Portal
   ========================================================= */

:root {
  --red: #E53E3E;
  --red-dark: #C53030;
  --red-soft: #FEE2E2;
  --ink: #0F172A;
  --ink-2: #1E293B;
  --muted: #64748B;
  --line: #E2E8F0;
  --surface: #FFFFFF;
  --bg: #F1F5F9;
  --bg-deep: #0B1220;
  --teal: #0D9488;
  --amber: #D97706;
  --green: #059669;
  --blue: #2563EB;
  --sidebar-w: 300px;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --font: "Outfit", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0B1220 0%, #151F32 100%);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-glass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.logo-word {
  font-family: 'Jost', 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  line-height: 1;
  color: #e30613;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-mark {
  display: none;
}

.brand-name {
  display: none;
}

.brand-sub {
  font-size: 0.75rem;
  color: #94A3B8;
}

.progress-panel {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #94A3B8;
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red), #FB923C);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 20px;
}

.nav-section {
  margin-top: 14px;
  padding: 0 10px 6px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748B;
}

.nav-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #CBD5E1;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.86rem;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }

.nav-item.active {
  background: rgba(229, 62, 62, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--red);
}

.nav-item.done .nav-num {
  background: var(--green);
  color: #fff;
}

.nav-num {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: rgba(255,255,255,0.1);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.nav-text { line-height: 1.3; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ---------- Main ---------- */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: rgba(241, 245, 249, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-weight: 700;
  font-size: 1.05rem;
  flex: 1;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.content {
  padding: 28px 32px 60px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(229, 62, 62, 0.28);
}

.btn-outline {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-outline:hover { border-color: var(--red); color: var(--red); }

.btn-ghost {
  background: transparent;
  color: #94A3B8;
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-ghost:hover { color: #fff; background: rgba(255,255,255,0.06); }

.btn-block { width: 100%; justify-content: center; }

.btn-teal {
  background: var(--teal);
  color: #fff;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink-2);
}

.icon-btn:hover { border-color: var(--red); color: var(--red); }

/* ---------- Dashboard ---------- */
.hero-dash {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 36px 36px 32px;
  background:
    radial-gradient(900px 300px at 10% -20%, rgba(229, 62, 62, 0.35), transparent 55%),
    radial-gradient(700px 280px at 90% 0%, rgba(13, 148, 136, 0.28), transparent 50%),
    linear-gradient(145deg, #0B1220, #1A2740);
  color: #fff;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.hero-dash h1 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 16ch;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero-dash p {
  color: #CBD5E1;
  max-width: 52ch;
  margin-bottom: 22px;
  font-size: 1.02rem;
}

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.03);
}

.stat-card .label { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.stat-card .value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

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

.module-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  width: 100%;
  font: inherit;
  color: inherit;
}

.module-card:hover {
  border-color: #FCA5A5;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.module-card.done { border-color: #A7F3D0; }

.module-card .mc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red-dark);
}

.badge.teal { background: #CCFBF1; color: #0F766E; }
.badge.amber { background: #FEF3C7; color: #B45309; }
.badge.green { background: #D1FAE5; color: #047857; }
.badge.blue { background: #DBEAFE; color: #1D4ED8; }
.badge.gray { background: #F1F5F9; color: #475569; }
.badge.red { background: var(--red-soft); color: var(--red-dark); }

.module-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.35;
}

.module-card p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
}

.section-heading h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

/* ---------- Lesson content ---------- */
.lesson {
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.lesson h1 {
  font-size: clamp(1.55rem, 2.8vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.lesson-lead {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink-2);
  margin-bottom: 28px;
  max-width: 60ch;
}

.lesson h2 {
  font-size: 1.28rem;
  font-weight: 800;
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}

.lesson h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 22px 0 8px;
  color: var(--ink-2);
}

.lesson p {
  margin-bottom: 14px;
  color: var(--ink-2);
}

.lesson ul, .lesson ol {
  margin: 0 0 16px 1.2rem;
  color: var(--ink-2);
}

.lesson li { margin-bottom: 8px; }

.lesson strong { color: var(--ink); }

.callout {
  border-radius: 14px;
  padding: 16px 18px;
  margin: 18px 0;
  border: 1px solid var(--line);
  background: #fff;
}

.callout.tip {
  border-left: 4px solid var(--teal);
  background: #F0FDFA;
}

.callout.warn {
  border-left: 4px solid var(--amber);
  background: #FFFBEB;
}

.callout.key {
  border-left: 4px solid var(--red);
  background: #FFF5F5;
}

.callout.example {
  border-left: 4px solid var(--blue);
  background: #EFF6FF;
}

.callout .callout-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.script-box {
  background: var(--bg-deep);
  color: #E2E8F0;
  border-radius: 14px;
  padding: 18px 20px;
  margin: 16px 0;
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.script-box .label {
  display: block;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94A3B8;
  margin-bottom: 10px;
}

.table-wrap {
  overflow-x: auto;
  margin: 16px 0 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data th,
table.data td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  background: #F8FAFC;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

table.data tr:last-child td { border-bottom: none; }

.steps {
  counter-reset: step;
  list-style: none;
  margin: 16px 0 22px;
  padding: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 14px 14px 14px 56px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.82rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.panel h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.panel ul { margin-left: 1.1rem; }

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.checklist {
  list-style: none;
  margin: 12px 0 18px;
  padding: 0;
}

.checklist li {
  position: relative;
  padding: 10px 12px 10px 40px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}

.checklist li::before {
  content: "✓";
  position: absolute;
  left: 12px;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #D1FAE5;
  color: #047857;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 18px;
}

.tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: #F1F5F9;
  color: var(--ink-2);
  border: 1px solid var(--line);
}

/* ---------- Quiz ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: #fff;
  border-radius: 18px;
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 { font-size: 1.15rem; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.q-progress {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.q-text {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.4;
}

.q-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-option {
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #F8FAFC;
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s;
}

.q-option:hover { border-color: #FCA5A5; background: #FFF5F5; }

.q-option.selected {
  border-color: var(--red);
  background: var(--red-soft);
  font-weight: 600;
}

.q-option.correct {
  border-color: var(--green);
  background: #D1FAE5;
}

.q-option.wrong {
  border-color: var(--red);
  background: #FEE2E2;
}

.quiz-result {
  text-align: center;
  padding: 20px 10px;
}

.quiz-result .score {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--red);
}

.quiz-result .msg {
  color: var(--muted);
  margin: 8px 0 20px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  z-index: 120;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  max-width: 320px;
}

.toast[hidden] { display: none; }

/* ---------- Print / PDF ---------- */
@media print {
  .sidebar, .topbar, .lesson-nav, .modal-overlay, .toast { display: none !important; }
  .main-wrap { margin: 0 !important; }
  .content { max-width: none; padding: 0; }
  .callout, .panel, .script-box, .steps li { break-inside: avoid; }
  body { background: #fff; }
  .hero-dash { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 48px; }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-105%);
  }
  .sidebar.open { transform: none; }
  .main-wrap { margin-left: 0; }
  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 35;
  }
}
