/* === LESSON MODULES VIEWER (base, nav & background shared via flashcards.css) === */

.lm-layout {
  display: flex; align-items: flex-start; gap: 1.25rem;
  max-width: 1200px; margin: 1.5rem auto 3rem; padding: 0 1rem;
}

/* ── Left panel: curriculum map + progress ─────────────────── */
.lm-sidebar {
  width: 280px; flex-shrink: 0; position: sticky; top: 76px;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius); padding: 1.1rem 1rem; max-height: calc(100vh - 96px); overflow-y: auto;
}

.lm-progress { margin-bottom: 1rem; }
.lm-progress-track { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.lm-progress-fill { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--fc-green-dark), var(--fc-green)); transition: width .4s ease; }
.lm-progress-label { display: block; margin-top: .4rem; font-size: .82rem; color: var(--fc-muted); letter-spacing: .03em; }

.lm-sidebar-title { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: #fff; margin-bottom: .7rem; }

.lm-map { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .45rem; }
.lm-item {
  display: flex; align-items: flex-start; gap: .6rem; width: 100%; text-align: left;
  padding: .55rem .7rem; border-radius: 9px; cursor: pointer; font-family: inherit;
  background: rgba(255, 255, 255, .05); border-left: 3px solid rgba(255, 255, 255, .18);
  color: var(--fc-text); transition: background .2s ease;
}
.lm-item:hover:not(.locked) { background: rgba(255, 255, 255, .12); }
.lm-item.completed { border-left-color: var(--fc-green); }
.lm-item.active { background: rgba(22, 163, 74, .9); border-left-color: var(--fc-green-dark); }
.lm-item.locked { opacity: .45; cursor: not-allowed; }

.lm-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: .1rem; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; color: #fff; }
.lm-item.completed .lm-icon { color: var(--fc-green); }
.lm-item.active .lm-icon { color: #fff; }

/* CSS-drawn padlock (locked modules) */
.lm-lock { position: relative; width: 10px; height: 8px; border-radius: 2px; background: var(--fc-muted); margin-top: 5px; }
.lm-lock::before { content: ''; position: absolute; left: 1.5px; top: -6px; width: 7px; height: 6px; border: 2px solid var(--fc-muted); border-bottom: none; border-radius: 4px 4px 0 0; }

.lm-item-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.lm-item-title { font-size: .92rem; line-height: 1.3; color: #fff; }
.lm-item-summary { font-size: .78rem; line-height: 1.35; color: var(--fc-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.lm-reset {
  width: 100%; padding: .45rem; font-family: inherit; font-size: .82rem; letter-spacing: .03em;
  color: var(--fc-muted); background: transparent; border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px; cursor: pointer; transition: background .2s ease, color .2s ease;
}
.lm-reset:hover { background: rgba(220, 38, 38, .2); color: #fff; }

/* ── Right panel: active module (dark box behind text for readability) ── */
.lm-content {
  flex: 1; min-width: 0;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius); padding: 1.4rem 1.6rem;
}

.lm-module-header { display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.lm-module-title { font-size: clamp(1.6rem, 4vw, 2.2rem); color: #fff; letter-spacing: -.01em; text-shadow: 0 2px 10px rgba(0, 0, 0, .45); }
.lm-order-badge { font-size: .85rem; letter-spacing: .05em; color: #dcead0; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); padding: .25rem .8rem; border-radius: 99px; white-space: nowrap; }

.lm-body p { line-height: 1.7; margin: .9rem 0; font-size: 1.02rem; }
.lm-body > p:first-child { margin-top: 0; }

/* Callouts */
.lm-callout { border-radius: 8px; padding: .85rem 1.1rem; margin: 1.1rem 0; line-height: 1.6; font-size: .98rem; border-left-width: 4px; }
.lm-callout.warning { background: rgba(245, 158, 11, .13); border-left-color: #f59e0b; }
.lm-callout.tip { background: rgba(22, 163, 74, .13); border-left-color: var(--fc-green); }
.lm-callout.info { background: rgba(59, 130, 246, .13); border-left-color: #3b82f6; }

/* Checklists */
.lm-checklist { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: .5rem; }
.lm-checklist li { display: flex; align-items: flex-start; gap: .6rem; line-height: 1.55; font-size: .98rem; }
.lm-check { flex-shrink: 0; width: 17px; height: 17px; margin-top: .22rem; border-radius: 4px; background: rgba(255, 255, 255, .08); border: 1.5px solid var(--fc-green); position: relative; }
.lm-check::after { content: ''; position: absolute; left: 4.5px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ── Checkpoint quiz ────────────────────────────────────────── */
.lm-checkpoint { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid rgba(255, 255, 255, .16); }
.lm-checkpoint-title { font-size: 1.3rem; color: #fff; margin-bottom: .3rem; }
.lm-checkpoint-sub { font-size: .9rem; color: var(--fc-muted); margin-bottom: 1.2rem; }

.lm-question { background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.lm-q-text { font-size: 1.05rem; color: #fff; line-height: 1.45; margin-bottom: .8rem; }

.lm-options { display: flex; flex-direction: column; gap: .45rem; }
.lm-option { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 8px; cursor: pointer; background: rgba(255, 255, 255, .06); border: 1.5px solid transparent; transition: background .15s ease, border-color .15s ease; font-size: .97rem; line-height: 1.4; }
.lm-option:hover { background: rgba(255, 255, 255, .12); }
.lm-option input { accent-color: var(--fc-green); width: 16px; height: 16px; flex-shrink: 0; margin: 0; cursor: pointer; }
.lm-option.selected { border-color: rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .12); }

/* Graded states */
.lm-question.graded .lm-option { cursor: default; }
.lm-option.correct { border-color: var(--fc-green); background: rgba(22, 163, 74, .22); }
.lm-option.incorrect { border-color: #dc2626; background: rgba(220, 38, 38, .2); }
.lm-explanation { display: none; margin-top: .7rem; padding: .6rem .8rem; border-radius: 8px; background: rgba(255, 255, 255, .07); font-size: .9rem; line-height: 1.5; color: var(--fc-muted); }
.lm-question.graded .lm-explanation { display: block; }

/* Result panel */
.lm-result { margin-top: 1.2rem; padding: 1.1rem 1.3rem; border-radius: 10px; font-size: 1.05rem; line-height: 1.5; }
.lm-result.pass { background: rgba(22, 163, 74, .18); border: 1px solid var(--fc-green); color: #eafff0; }
.lm-result.fail { background: rgba(245, 158, 11, .15); border: 1px solid #f59e0b; color: #fef3c7; }

/* Back / Next navigation */
.lm-nav-btns { display: flex; justify-content: space-between; gap: .8rem; margin-top: 1.6rem; }
.lm-navbtn { padding: .65rem 1.4rem; font-family: inherit; font-size: 1rem; border-radius: 9px; cursor: pointer; transition: background .2s ease, transform .1s ease; }
.lm-navbtn:disabled { opacity: .35; cursor: default; }
.lm-navbtn.prev { background: rgba(255, 255, 255, .09); color: var(--fc-text); border: 1px solid rgba(255, 255, 255, .18); }
.lm-navbtn.prev:hover:not(:disabled) { background: rgba(255, 255, 255, .17); }
.lm-navbtn.next { background: var(--fc-green-dark); color: #fff; border: 1px solid var(--fc-green); min-width: 160px; }
.lm-navbtn.next:hover:not(:disabled) { background: var(--fc-green); transform: translateY(-1px); }

/* ── Responsive: collapse sidebar on mobile (<768px) ────────── */
@media (max-width: 768px) {
  .lm-layout { flex-direction: column; margin-top: 1rem; }
  .lm-sidebar { width: 100%; position: static; max-height: none; overflow-y: visible; }
  .lm-map { flex-direction: row; overflow-x: auto; padding-bottom: .4rem; gap: .5rem; }
  .lm-item { min-width: 200px; flex-shrink: 0; border-left-width: 3px; }
  .lm-item-summary { display: none; }
}
