/* ── Lesson layout — left sidebar + content ─────────────────────── */

/* Suppress the top nav on lesson pages */
body.lp-app #ch-nav    { display: none !important; }
body.lp-app #ch-footer { display: none !important; }

/* ── Layout shell — fills full viewport height ── */
.lp-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Reset Bootstrap interference on lesson pages */
.lp-layout *, .ls-sidebar *, .lp-content * {
  box-sizing: border-box;
}
.lp-topbar .lp-topbar-course,
.lp-topbar span {
  all: unset;
  display: inline;
  font-family: var(--font-body);
}
.lp-topbar a.lp-topbar-course {
  color: var(--ap-green-deep);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.lp-topbar a.lp-topbar-course:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════
   LEFT SIDEBAR
══════════════════════════════════════════════ */
.ls-sidebar {
  width: 288px;
  flex: none;
  background: #152b1e;
  color: rgba(255,255,255,.85);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.ls-sidebar::-webkit-scrollbar       { width: 4px; }
.ls-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* Header */
.ls-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex: none;
}
.ls-back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: rgba(255,255,255,.7);
  font-size: .82rem;
  transition: color .15s;
}
.ls-back-link:hover { color: #fff; }
.ls-back-icon { opacity: .6; }
.ls-logo-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: #C8860A;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #152b1e; font-size: .9rem;
  flex: none;
}
.ls-logo-text { font-weight: 700; font-size: .92rem; color: rgba(255,255,255,.9); }

/* Course meta + progress */
.ls-course-meta {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex: none;
}
.ls-course-title {
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 8px;
}
.ls-progress-label {
  font-size: .72rem;
  color: rgba(255,255,255,.5);
  margin-bottom: 6px;
}
.ls-progress-track {
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 4px;
  overflow: hidden;
}
.ls-progress-fill {
  height: 100%;
  background: #C8860A;
  border-radius: 4px;
  transition: width .4s;
}

/* Module tree */
.ls-tree {
  flex: 1;
  padding: 8px 0;
}

.ls-mod {
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.ls-mod-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background .12s;
}
.ls-mod-summary::-webkit-details-marker { display: none; }
.ls-mod-summary:hover { background: rgba(255,255,255,.06); }
.ls-mod-summary.ls-mod-current { background: rgba(255,255,255,.08); }

.ls-mod-num {
  font-size: .7rem;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  flex: none;
  min-width: 22px;
}
.ls-mod-title {
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255,255,255,.82);
  flex: 1;
  line-height: 1.3;
}
.ls-mod-badge {
  font-size: .7rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  flex: none;
}
.ls-mod-badge.ls-done   { background: rgba(200,134,10,.25); color: #C8860A; }
.ls-mod-badge.ls-active { color: rgba(255,255,255,.5); }

/* Items inside a module */
.ls-items {
  list-style: none;
  margin: 0;
  padding: 0 0 4px 0;
  background: rgba(0,0,0,.18);
}
.ls-items-empty {
  padding: 8px 16px 10px 40px;
  font-size: .75rem;
  color: rgba(255,255,255,.3);
  font-style: italic;
}
.ls-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px 8px 22px;
  text-decoration: none;
  color: rgba(255,255,255,.6);
  font-size: .8rem;
  transition: background .1s, color .1s;
  border-left: 2px solid transparent;
}
.ls-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); }
.ls-item-active {
  background: rgba(200,134,10,.12) !important;
  color: #fff !important;
  border-left-color: #C8860A;
}

/* Item type dot */
.ls-item-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
}
.ls-type-video    { background: #6C8EBF; }
.ls-type-article  { background: #C8860A; }
.ls-type-concept  { background: #40916C; }
.ls-type-notebook { background: #7F56D9; }
.ls-type-game     { background: #E86826; }
.ls-type-survey   { background: #555; }
.ls-type-resources { background: #888; }
.ls-type-materials { background: #888; }

.ls-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-item-type-chip {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: rgba(255,255,255,.3);
  flex: none;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════
   MAIN CONTENT AREA
══════════════════════════════════════════════ */
.lp-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--ap-parchment);
}

/* Breadcrumb / topbar */
.lp-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 32px;
  font-size: .8rem;
  color: var(--ap-muted);
  border-bottom: 1px solid var(--ap-border);
  background: var(--ap-parchment);
  flex: none;
}
.lp-topbar-course {
  color: var(--ap-green-deep);
  font-weight: 700;
  text-decoration: none;
}
.lp-topbar-course:hover { text-decoration: underline; }
.lp-topbar-sep { color: var(--ap-border); }
.lp-topbar-mod-link {
  color: var(--ap-charcoal);
  text-decoration: none;
}
.lp-topbar-mod-link:hover { text-decoration: underline; }

/* Lesson header area */
.lp-lesson-head {
  padding: 28px 40px 0;
  border-bottom: 1px solid var(--ap-border);
}
.lp-lesson-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.lp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.lp-chip-type-video    { background: #DBEAFE; color: #1D4ED8; }
.lp-chip-type-article  { background: #FEF3C7; color: #92400E; }
.lp-chip-type-concept  { background: #D1FAE5; color: #065F46; }
.lp-chip-type-notebook { background: #EDE9FE; color: #4C1D95; }
.lp-chip-type-game     { background: #FFEDD5; color: #C2410C; }
.lp-chip-duration {
  background: rgba(0,0,0,.06);
  color: var(--ap-muted);
}
.lp-chip-status {
  background: #D1FAE5;
  color: #065F46;
}

.lp-lesson-title {
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  color: var(--ap-charcoal);
  margin: 0 0 20px;
  line-height: 1.2;
}

/* Main scrollable body */
.lp-body {
  flex: 1;
  padding: 28px 40px 80px;
  max-width: 960px;
}

/* Video player */
.lp-video-wrap {
  position: relative;
  background: #0a1f12;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 28px;
  aspect-ratio: 16/9;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.lp-video-wrap iframe,
.lp-video-wrap video {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;
}
.lp-stage-placeholder {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: rgba(255,255,255,.45); font-size: .95rem;
}
.lp-stage-placeholder span:first-child { font-size: 2.2rem; }

/* Notebook embed */
.lp-notebook-wrap {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--ap-border);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.lp-notebook-wrap iframe {
  width: 100%;
  height: 75vh;
  border: none;
  display: block;
}
.lp-notebook-open {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: .85rem;
  color: var(--ap-muted);
}

/* Game embed */
.lp-game-wrap {
  width: 100%;
  border-radius: 10px;
  border: 2px solid var(--ap-border);
  overflow: hidden;
  margin-bottom: 28px;
  background: #fff;
}
.lp-game-wrap iframe {
  width: 100%;
  height: 80vh;
  border: none;
  display: block;
}

/* Article / concept prose */
.lp-prose {
  background: #fff;
  border: 1px solid var(--ap-border);
  border-radius: 14px;
  padding: 32px 36px;
  margin-bottom: 28px;
  line-height: 1.8;
  font-size: .97rem;
  color: var(--ap-charcoal);
}
.lp-prose h2, .lp-prose h3 {
  font-family: var(--font-heading);
  color: var(--ap-green-deep);
  margin-top: 1.5em;
}
.lp-prose p   { margin-bottom: .9em; }
.lp-prose a   { color: var(--ap-green-mid); }
.lp-prose strong { color: var(--ap-charcoal); font-weight: 600; }

/* Transcript */
.lp-transcript { margin-bottom: 28px; }
.lp-transcript-header {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px;
}
.lp-transcript h2 {
  font-family: var(--font-heading); font-size: 1.15rem; color: var(--ap-green-deep); margin: 0;
}
.lp-transcript-body {
  background: #fff; border: 1px solid var(--ap-border); border-radius: 10px;
  overflow: hidden; max-height: 300px; overflow-y: auto;
}
.lp-transcript-entry {
  display: flex; gap: 20px; padding: 11px 16px; border-bottom: 1px solid var(--ap-border);
  font-size: .86rem; line-height: 1.55;
}
.lp-transcript-entry:last-child { border-bottom: none; }
.lp-transcript-ts { color: var(--ap-gold); font-weight: 700; font-size: .8rem; min-width: 36px; flex: none; }

/* Bottom action bar */
.lp-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px 24px;
  border-top: 1px solid var(--ap-border);
  background: var(--ap-parchment);
  flex: none;
  gap: 16px;
  flex-wrap: wrap;
}
.lp-bottom-left  { display: flex; align-items: center; gap: 12px; }
.lp-bottom-right { display: flex; align-items: center; gap: 8px; }

.lp-mark-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  background: var(--ap-green-deep);
  color: #fff;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.lp-mark-btn:hover    { background: var(--ap-green-mid); }
.lp-mark-btn:disabled { background: var(--ap-green-pale); color: var(--ap-green-deep); cursor: default; }
.lp-completed-badge {
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--ap-green-pale);
  color: var(--ap-green-deep);
  font-weight: 700;
  font-size: .88rem;
}
.lp-counter {
  font-size: .8rem;
  color: var(--ap-muted);
}

/* ══════════════════════════════════════════════
   MY NOTES (collapsible panel below content)
══════════════════════════════════════════════ */
.lp-notes-panel {
  margin: 0 40px 40px;
  background: #fff;
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  overflow: hidden;
}
.lp-notes-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ap-charcoal);
  user-select: none;
}
.lp-notes-toggle:hover { background: var(--ap-parchment); }
.lp-notes-body { padding: 12px 18px 16px; border-top: 1px solid var(--ap-border); }

/* ══════════════════════════════════════════════
   ASK REMI WIDGET
══════════════════════════════════════════════ */
.ar-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #E86826;
  color: #fff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(232,104,38,.45);
  border: none;
  z-index: 500;
  transition: transform .15s, box-shadow .15s;
}
.ar-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(232,104,38,.55); }
.ar-label {
  position: fixed;
  bottom: 26px;
  right: 88px;
  background: #1C1C1E;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 500;
  opacity: 0;
  transition: opacity .2s;
}
.ar-bubble:hover + .ar-label,
.ar-label:hover { opacity: 1; }

.ar-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 360px;
  max-height: 500px;
  background: #fff;
  border: 1px solid var(--ap-border);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  z-index: 500;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.ar-panel.open { display: flex; }
.ar-panel-head {
  padding: 14px 18px 12px;
  background: var(--ap-green-deep);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ar-panel-title { font-weight: 700; font-size: .95rem; }
.ar-close { background: none; border: none; color: rgba(255,255,255,.7); font-size: 1.1rem; cursor: pointer; padding: 0; }
.ar-close:hover { color: #fff; }
.ar-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ap-parchment);
}
.ar-msg {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: .85rem;
  line-height: 1.5;
}
.ar-msg-ai   { background: #fff; border: 1px solid var(--ap-border); align-self: flex-start; }
.ar-msg-user { background: var(--ap-green-deep); color: #fff; align-self: flex-end; }
.ar-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--ap-border);
  background: #fff;
}
.ar-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--ap-border);
  border-radius: 8px;
  font-size: .85rem;
  outline: none;
  font-family: inherit;
}
.ar-input:focus { border-color: var(--ap-green-mid); }
.ar-send {
  padding: 8px 14px;
  background: var(--ap-green-deep);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── Bootstrap isolation — prevent Bootstrap utility classes leaking into lesson layout ── */
.lp-layout .alert { display: none; }    /* flash messages don't appear on lesson pages */
.lp-chip           { display: inline-flex !important; }
.lp-lesson-chips   { display: flex !important; }
.lp-lesson-head    { display: block !important; }
.lp-bottom-bar     { display: flex !important; }
.lp-bottom-left,
.lp-bottom-right   { display: flex !important; }
.ls-sidebar        { display: flex !important; }
.lp-content        { display: flex !important; }

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 860px) {
  .ls-sidebar { display: none; }
  .lp-body, .lp-lesson-head, .lp-bottom-bar, .lp-notes-panel { padding-left: 18px; padding-right: 18px; }
}
