/* ============================================================
   AIP ACADEMY — The AI-Powered Paralegal Course
   Shared Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,600&family=Jost:wght@300;400;500;600;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  --navy:        #162035;
  --navy-mid:    #1e2a3e;
  --navy-light:  #2a3a52;
  --gold:        #c49a28;
  --gold-light:  #d4ae48;
  --gold-pale:   #f5e9c4;
  --cream:       #f8f5ee;
  --cream-dark:  #efe9dc;
  --cream-mid:   #e8e0ce;
  --white:       #ffffff;
  --text:        #1a1a2e;
  --text-mid:    #374151;
  --text-muted:  #6b7280;
  --success:     #15803d;
  --success-bg:  #dcfce7;
  --error:       #b91c1c;
  --error-bg:    #fee2e2;
  --warning:     #b45309;
  --warning-bg:  #fef3c7;
  --info:        #1d4ed8;
  --info-bg:     #dbeafe;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 2px 12px rgba(22,32,53,.12);
  --shadow-md:   0 4px 24px rgba(22,32,53,.16);
  --shadow-lg:   0 8px 40px rgba(22,32,53,.22);
  --sidebar-w:   280px;
  --header-h:    68px;
  --transition:  0.22s ease;
  --font-serif:  'Cormorant Garamond', Georgia, serif;
  --font-sans:   'Jost', system-ui, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--cream);
  line-height: 1.7;
  min-height: 100vh;
}
img { max-width: 100%; }
button { cursor: pointer; font-family: var(--font-sans); border: none; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  color: var(--navy);
}
h1 { font-size: clamp(1.9rem, 3.5vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h4 { font-size: 1.1rem; }
p  { margin-bottom: 1rem; }

/* ---------- Course Layout ---------- */
.course-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

/* ---------- Top Header ---------- */
.top-header {
  grid-column: 1 / -1;
  grid-row: 1;
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--gold);
}
.top-header .logo {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.top-header .course-title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: rgba(255,255,255,.7);
  font-weight: 400;
}
.top-header .header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.top-header .progress-pill {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(196,154,40,.4);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.78rem;
  color: var(--gold-light);
  font-weight: 500;
}
.top-header .btn-dashboard {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.85);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: var(--transition);
}
.top-header .btn-dashboard:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.5);
}

/* ---------- Sidebar ---------- */
.course-sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--navy-mid);
  overflow-y: auto;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  padding: 1.5rem 0;
}
.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,.35);
  padding: 0 1.25rem;
  margin: 1.2rem 0 0.5rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1.25rem;
  color: rgba(255,255,255,.65);
  font-size: 0.82rem;
  font-weight: 400;
  transition: var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.9);
}
.sidebar-link.active {
  background: rgba(196,154,40,.12);
  color: var(--gold-light);
  border-left-color: var(--gold);
  font-weight: 500;
}
.sidebar-link.locked {
  opacity: 0.4;
  pointer-events: none;
}
.sidebar-link .mod-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-link.complete .mod-num {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
}
.sidebar-link .mod-check {
  margin-left: auto;
  color: var(--success);
  font-size: 0.8rem;
}
.sidebar-link.final-link {
  background: rgba(196,154,40,.08);
  border-left-color: rgba(196,154,40,.3);
  color: var(--gold-light);
}

/* ---------- Main Content ---------- */
.main-content {
  grid-column: 2;
  grid-row: 2;
  padding: 2.5rem 3rem;
  max-width: 900px;
}

/* ---------- Module Header ---------- */
.module-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--cream-dark);
}
.module-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.module-header h1 {
  margin-bottom: 0.5rem;
}
.module-header .subtitle {
  font-size: 1.05rem;
  color: var(--text-mid);
  font-style: italic;
  font-family: var(--font-serif);
}

/* ---------- Module Page Layout ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  min-height: 100vh;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.course-layout {
  display: flex;
  min-height: 100vh;
}
.top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem;
  background: var(--navy);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 90;
}
.top-bar-title {
  font-family: var(--font-sans);
  font-size: .82rem;
  color: rgba(255,255,255,.75);
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 1.25rem;
  cursor: pointer;
  padding: .25rem .5rem;
  display: none;
}
#progress-pill {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(196,154,40,.4);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .72rem;
  color: var(--gold-light, #d4b97a);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
}
.content-area {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 900px;
  width: 100%;
}
.module-hero {
  margin-bottom: 1.5rem;
}
.module-hero-eyebrow {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gold);
  margin-bottom: .35rem;
}
.module-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  color: var(--navy);
  margin: 0 0 .4rem;
  font-weight: 600;
}
.module-hero-sub {
  font-size: .95rem;
  color: var(--text-mid);
  margin: 0 0 1.25rem;
  line-height: 1.6;
}
.module-nav-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--cream);
  border-radius: var(--radius-lg);
  border: 1px solid var(--cream-dark);
}

/* ---------- Module Tabs ---------- */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--cream-dark);
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: white;
  border-radius: var(--radius) var(--radius) 0 0;
}
.tab-nav::-webkit-scrollbar { display: none; }
.module-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--cream-dark);
  padding-bottom: 0;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 0.65rem 1.1rem;
  font-size: 0.82rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius) var(--radius) 0 0;
  border: none;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  margin-bottom: -2px;
  letter-spacing: 0.02em;
}
.tab-btn:hover {
  color: var(--navy);
  background: var(--cream-dark);
}
.tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
  font-weight: 600;
  background: var(--cream);
}
.tab-btn.locked-tab {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Tab Panels ---------- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(0,0,0,.05);
}
.card-gold {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white);
  border: none;
}
.card-gold h3, .card-gold h4 { color: var(--gold-light); }
.card-gold p, .card-gold li { color: rgba(255,255,255,.85); }
.card-cream {
  background: var(--cream);
  border: 1px solid var(--cream-dark);
}
.card-highlight {
  border-left: 4px solid var(--gold);
  background: var(--gold-pale);
}

/* ---------- Objectives List ---------- */
.objectives-list {
  list-style: none;
  padding: 0;
}
.objectives-list li {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 0.95rem;
}
.objectives-list li:last-child { border-bottom: none; }
.obj-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ---------- Reading Section ---------- */
.reading-excerpt {
  background: var(--cream);
  border-left: 4px solid var(--navy);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-mid);
}
.reading-excerpt .pullquote {
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.callout-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.callout-info    { background: var(--info-bg);    border-left: 3px solid var(--info); }
.callout-warning { background: var(--warning-bg); border-left: 3px solid var(--warning); }
.callout-success { background: var(--success-bg); border-left: 3px solid var(--success); }
.callout-gold    { background: var(--gold-pale);  border-left: 3px solid var(--gold); }

/* ---------- Video Embed ---------- */
.video-container,
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--navy);
  margin: 1.25rem 0;
}
.video-container iframe,
.video-container .video-placeholder,
.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}
.vid-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.12);
  color: white;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: var(--radius-lg);
  padding: .75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
  width: 90%;
  text-align: center;
}
.vid-play-btn:hover { background: rgba(255,255,255,0.22); }

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  cursor: pointer;
  gap: 1rem;
  text-align: center;
  padding: 1rem;
}
.video-placeholder .play-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(196,154,40,.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: var(--transition);
}
.video-placeholder:hover .play-icon {
  background: var(--gold);
  transform: scale(1.08);
}
.video-placeholder .video-label { font-size: 0.9rem; opacity: 0.8; font-style: italic; }
.video-label-top {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-light);
  margin-bottom: 0.3rem;
  display: block;
}

/* ---------- Interactive Activities ---------- */
.activity-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.activity-badge {
  background: var(--navy);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 20px;
}
.activity-badge.badge-green  { background: var(--success); color: white; }
.activity-badge.badge-blue   { background: var(--info);    color: white; }

/* Flip Cards */
.flip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.flip-card {
  height: 160px;
  perspective: 800px;
  cursor: pointer;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s ease;
  border-radius: var(--radius);
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.flip-front {
  background: var(--navy);
  color: var(--white);
  border: 2px solid var(--navy-light);
}
.flip-front .myth-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #ef4444;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.flip-front p { font-size: 0.85rem; line-height: 1.4; margin: 0; color: rgba(255,255,255,.9); }
.flip-back {
  background: var(--success-bg);
  transform: rotateY(180deg);
  border: 2px solid var(--success);
}
.flip-back .reality-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--success);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.flip-back p { font-size: 0.82rem; line-height: 1.4; margin: 0; color: var(--text-mid); }
.flip-hint { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.75rem; }

/* Matching Activity */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}
.match-term, .match-def {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
  border: 2px solid transparent;
  transition: var(--transition);
  min-height: 64px;
  display: flex;
  align-items: center;
}
.match-term {
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
}
.match-term:hover, .match-term.selected {
  border-color: var(--gold);
  background: var(--navy-mid);
}
.match-def {
  background: var(--cream);
  color: var(--text-mid);
  border-color: var(--cream-dark);
}
.match-def:hover, .match-def.selected { border-color: var(--navy); }
.match-def.matched { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.match-def.wrong   { background: var(--error-bg);   border-color: var(--error);   animation: shake 0.4s; }
@keyframes shake {
  0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)}
}

/* Scenario / Simulator */
.scenario-card {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 1rem 0;
}
.scenario-top {
  background: var(--navy-mid);
  padding: 1.25rem 1.5rem;
  color: var(--white);
}
.scenario-top .scenario-num {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.25rem;
}
.scenario-body { padding: 1.25rem 1.5rem; }
.scenario-ai-output {
  background: var(--cream);
  border-left: 3px solid var(--text-muted);
  padding: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.75rem 0;
  font-family: var(--font-serif);
}
.scenario-question {
  font-weight: 600;
  color: var(--navy);
  margin: 1rem 0 0.75rem;
}
.scenario-choices {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.scenario-btn {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}
.scenario-btn-yes {
  background: var(--success);
  color: var(--white);
}
.scenario-btn-yes:hover { background: #166534; }
.scenario-btn-no {
  background: var(--error);
  color: var(--white);
}
.scenario-btn-no:hover { background: #991b1b; }
.scenario-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  display: none;
  font-size: 0.9rem;
  line-height: 1.6;
}
.scenario-feedback.show { display: block; }
.scenario-feedback.correct { background: var(--success-bg); border-left: 4px solid var(--success); }
.scenario-feedback.incorrect { background: var(--error-bg); border-left: 4px solid var(--error); }
.scenario-nav {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--cream-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Drag and Drop Sorter */
.sort-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.sort-bucket {
  border: 2px dashed var(--cream-mid);
  border-radius: var(--radius-lg);
  padding: 1rem;
  min-height: 200px;
  transition: var(--transition);
}
.sort-bucket.drag-over { border-color: var(--gold); background: var(--gold-pale); }
.sort-bucket h4 { text-align: center; font-size: 0.9rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid currentColor; }
.sort-item {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.sort-item:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.sort-item.dragging { opacity: 0.5; cursor: grabbing; }

/* ---------- Assessment / Quiz ---------- */
.quiz-container { margin: 1rem 0; }
.quiz-question {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.q-number {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.q-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.q-options { display: flex; flex-direction: column; gap: 0.5rem; }
.q-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.92rem;
  background: var(--white);
}
.q-option:hover { border-color: var(--navy); background: var(--cream); }
.q-option input[type="radio"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--navy); }
.q-option.correct  { border-color: var(--success); background: var(--success-bg); }
.q-option.incorrect{ border-color: var(--error);   background: var(--error-bg); }
.q-option.selected { border-color: var(--navy);    background: var(--cream); }
.q-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  display: none;
}
.q-feedback.show { display: block; }
.q-feedback.correct   { background: var(--success-bg); color: var(--success); }
.q-feedback.incorrect { background: var(--error-bg);   color: var(--error); }

.quiz-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}
.quiz-score-display {
  background: var(--navy);
  color: var(--gold);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 1rem;
  display: none;
}
.quiz-score-display.show { display: block; }
.attempts-notice {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover { background: var(--navy-light); }
.btn-gold {
  background: var(--gold);
  color: var(--navy);
}
.btn-gold:hover { background: var(--gold-light); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--navy);
  color: var(--navy);
}
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.82rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Progress Bar ---------- */
.progress-bar-wrap {
  background: var(--cream-dark);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 100%);
  border-radius: 20px;
  transition: width 0.6s ease;
}

/* ---------- Alert Banners ---------- */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  font-size: 0.92rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: #14532d; }
.alert-error   { background: var(--error-bg);   border: 1px solid var(--error);   color: #7f1d1d; }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning); color: #78350f; }
.alert-info    { background: var(--info-bg);    border: 1px solid var(--info);    color: #1e3a8a; }

/* ---------- Enrollment Gate ---------- */
.gate-wrapper {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.gate-card {
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border-top: 5px solid var(--gold);
}
.gate-logo {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.gate-subtitle {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-style: italic;
}
.gate-card h2 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.gate-course-name {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-mid);
  margin-bottom: 2rem;
  font-style: italic;
}
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--cream-mid);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  background: var(--white);
  color: var(--text);
  transition: var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(22,32,53,.1);
}
.gate-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.gate-brand {
  margin-top: 2.5rem;
  text-align: center;
}
.gate-brand img { max-width: 80px; opacity: 0.5; }

/* ---------- Dashboard ---------- */
.dashboard-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white);
  padding: 2.5rem 3rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.dashboard-hero::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(196,154,40,.1);
}
.dashboard-hero h1 { color: var(--white); font-size: clamp(1.4rem, 3vw, 2.2rem); }
.dashboard-hero .course-meta {
  font-size: 0.82rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}
.dashboard-hero .overall-progress {
  margin-top: 1.5rem;
}
.overall-score {
  font-size: 0.82rem;
  color: var(--gold-light);
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.module-tile {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--cream-dark);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.module-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--navy);
}
.module-tile .tile-num {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
}
.module-tile h3 {
  font-size: 1rem;
  margin: 0;
}
.module-tile .tile-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: auto;
}
.module-tile.complete { border-left: 4px solid var(--success); }
.module-tile.in-progress { border-left: 4px solid var(--gold); }
.module-tile.locked { opacity: 0.55; pointer-events: none; }
.tile-score-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--cream-dark);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}
.tile-score-badge.pass { background: var(--success-bg); color: var(--success); }

/* ---------- Certificate Preview ---------- */
.cert-wrapper {
  max-width: 800px;
  margin: 0 auto;
}
.cert-preview {
  background: #f8f5ee;
  border: 2px solid var(--cream-dark);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.cert-header {
  background: var(--navy);
  color: var(--white);
  text-align: center;
  padding: 1.5rem 2rem;
  font-family: var(--font-serif);
}
.cert-header .cert-academy {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.cert-header .cert-url {
  font-size: 0.78rem;
  opacity: 0.6;
  margin-top: 0.2rem;
}
.cert-body {
  padding: 2.5rem 3rem;
  text-align: center;
}
.cert-body .cert-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 1.5rem;
  font-family: var(--font-serif);
}
.cert-divider {
  width: 80%;
  max-width: 480px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 1rem auto;
}
.cert-awarded-to { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.cert-name-field {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1rem 0;
  font-style: italic;
  min-height: 60px;
}
.cert-name-input {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  text-align: center;
  border: none;
  border-bottom: 2px dashed var(--gold);
  background: transparent;
  color: var(--navy);
  width: 100%;
  max-width: 400px;
  padding: 0.5rem;
  outline: none;
}
.cert-completing { font-size: 0.9rem; color: var(--text-muted); margin: 1rem 0 0.5rem; }
.cert-course-name {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--navy);
}
.cert-sigs {
  display: flex;
  justify-content: center;
  gap: 4rem;
  margin: 2rem 0 1rem;
}
.cert-sig-block {
  text-align: center;
}
.cert-sig-name {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
.cert-footer-text {
  font-style: italic;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.cert-gems { color: var(--gold); letter-spacing: 0.5rem; font-size: 1rem; margin-top: 0.5rem; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-navy { color: var(--navy); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.divider {
  border: none;
  border-top: 1px solid var(--cream-dark);
  margin: 1.5rem 0;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--cream-dark);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* Tap-to-sort: selected item on mobile */
.sort-item.tap-selected {
  border-color: var(--gold);
  background: var(--gold-pale, #fef9ec);
  box-shadow: 0 0 0 2px var(--gold);
}
.sort-bucket:has(.sort-item) {
  border-color: var(--cream-mid);
}

/* ---------- Print (Certificate) ---------- */


/* Tap-to-sort: selected item on mobile */
.sort-item.tap-selected {
  border-color: var(--gold);
  background: var(--gold-pale, #fef9ec);
  box-shadow: 0 0 0 2px var(--gold);
}
.sort-bucket:has(.sort-item) {
  border-color: var(--cream-mid);
}

/* ---------- Print (Certificate) ---------- */
@media print {
  .no-print { display: none !important; }
  .course-layout { display: block; }
  .course-sidebar, .top-header, .module-tabs { display: none !important; }
  .main-content { padding: 0; max-width: 100%; }
  body { background: white; }
}

/* ==========================================================
   MOBILE-FIRST RESPONSIVE — optimized for phones
   ========================================================== */
@media (max-width: 768px) {

  /* Layout */
  .course-layout { flex-direction: column; display: flex; }
  .sidebar, .course-sidebar {
    width: 100%; min-height: unset; height: auto;
    position: relative; top: 0; display: none; order: 2;
  }
  .sidebar.open, .course-sidebar.open { display: block; }
  .main-wrap { order: 1; }
  .menu-btn { display: block !important; }

  /* Top bar */
  .top-bar { padding: .6rem 1rem; }
  .top-bar-title { font-size: .78rem; }
  #progress-pill { font-size: .68rem; padding: 3px 8px; }

  /* Content */
  .content-area { padding: .75rem .875rem 3rem; }
  .content-card { padding: 1rem; }

  /* Module hero */
  .module-hero { margin-bottom: 0; }
  .module-hero-title { font-size: 1.3rem; }
  .module-hero-sub { font-size: .88rem; }

  /* Tab nav: sticky below top-bar, horizontally scrollable */
  .tab-nav {
    position: sticky;
    top: 50px;
    z-index: 80;
    background: white;
    box-shadow: 0 2px 8px rgba(22,32,53,.12);
    border-bottom: 2px solid var(--cream-dark);
    margin: 0 -.875rem;
    padding: 0 .875rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn {
    font-size: .74rem;
    padding: .7rem .75rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
  }

  /* Module nav bar: Continue on top, back below */
  .module-nav-bar {
    flex-direction: column-reverse;
    gap: .6rem;
    padding: 1rem;
  }
  .module-nav-bar .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    min-height: 48px;
    font-size: .95rem;
  }
  /* Continue button demoted until Assessment tab visited */
  #btn-next.btn-demoted {
    background: var(--cream);
    color: var(--text-mid);
    border: 2px solid var(--cream-dark);
    font-size: .85rem;
  }
  #btn-next.btn-demoted::after {
    content: 'Visit Module Assessment tab first';
    font-size: .7rem;
    display: block;
    font-weight: 400;
    opacity: .75;
    margin-top: .2rem;
  }

  /* Collapse all 2+ col grids to 1 col */
  .grid-2, .grid-3, .match-grid, .sort-container, .enroll-grid { grid-template-columns: 1fr !important; }

  /* Quiz */
  .quiz-question { padding: 1rem; }
  .q-text { font-size: .92rem; }
  .q-option { padding: .85rem .9rem; font-size: .88rem; min-height: 44px; }
  .quiz-controls { flex-direction: column; align-items: stretch; gap: .75rem; }
  .quiz-controls .btn { width: 100%; min-height: 48px; }
  .quiz-score-display { text-align: center; width: 100%; }

  /* Activities */
  .scenario-choices { flex-direction: column; }
  .scenario-btn { width: 100%; min-height: 48px; }
  .sort-item { cursor: pointer; padding: .85rem 1rem; min-height: 44px; }
  .flip-grid { grid-template-columns: 1fr; }
  .flip-card { height: 140px; }

  /* Enrollment gate */
  .gate-card { padding: 1.75rem 1.25rem; }
  .gate-wrapper { padding: 1rem; }

  /* Dashboard */
  .stats-bar { grid-template-columns: repeat(2, 1fr) !important; }
  .welcome-banner { padding: 1.25rem; }
  .dashboard-wrap { padding: 1rem; }
  .module-grid { grid-template-columns: 1fr !important; }

  /* Typography */
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.05rem; }
  table { font-size: .8rem; }
  table th, table td { padding: .35rem .5rem; }
  .reading-pull { font-size: .92rem; padding: .75rem 1rem; }
  .cert-sigs { gap: 2rem; }
  .cert-body { padding: 1.5rem; }
  .cert-body .cert-title { font-size: 1.5rem; }
}

/* Extra small phones */
@media (max-width: 400px) {
  .content-area { padding: .6rem .75rem 3rem; }
  .module-hero-title { font-size: 1.15rem; }
  .tab-btn { font-size: .7rem; padding: .7rem .6rem; }
  .stats-bar { grid-template-columns: 1fr !important; }
  .gate-card { padding: 1.25rem 1rem; }
}
