/* ============================================
   EduAI — Learn Page Styles
   ============================================ */

.learn-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  padding-top: 1.5rem;
  align-items: start;
}

/* Sidebar */
.learn-sidebar {
  background: #fff; border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-lg); padding: 1rem; position: sticky; top: 70px;
}
.sidebar-level {
  font-size: 1rem; font-weight: 700; color: var(--clr-text);
  margin-bottom: .75rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--clr-border);
}
.subject-list { list-style: none; margin-bottom: 1rem; }
.subject-list li {
  padding: .45rem .6rem; border-radius: var(--radius); font-size: 13px;
  cursor: pointer; color: var(--clr-text-muted); transition: all .15s;
}
.subject-list li:hover { background: var(--clr-primary-light); color: var(--clr-primary); }
.subject-list li.active { background: var(--clr-primary-light); color: var(--clr-primary); font-weight: 600; }
.sidebar-progress h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--clr-text-muted); margin-bottom: .5rem; }

/* Learn main */
.learn-main { background: #fff; border: 1.5px solid var(--clr-border); border-radius: var(--radius-lg); overflow: hidden; }
.learn-tabs { display: flex; border-bottom: 1.5px solid var(--clr-border); }
.learn-tab {
  flex: 1; padding: .75rem; font-size: 13px; font-weight: 500;
  border: none; background: none; cursor: pointer; color: var(--clr-text-muted);
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; transition: all .15s;
}
.learn-tab.active { color: var(--clr-primary); border-bottom-color: var(--clr-primary); background: var(--clr-primary-light); }
.tab-content { display: none; padding: 1.25rem; }
.tab-content.active { display: block; }

/* Topic chips */
.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }
.topic-chip {
  padding: 5px 14px; border-radius: 20px; border: 1.5px solid var(--clr-border);
  background: #fff; font-size: 13px; cursor: pointer; transition: all .15s;
}
.topic-chip:hover, .topic-chip.active { border-color: var(--clr-primary); background: var(--clr-primary-light); color: var(--clr-primary); }

/* Audio bar */
.audio-bar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
#listenStatus { font-size: 12px; color: var(--clr-text-muted); }

/* Chat window */
.chat-window {
  background: #f8fafc; border: 1px solid var(--clr-border); border-radius: var(--radius);
  min-height: 280px; max-height: 380px; overflow-y: auto;
  padding: 1rem; display: flex; flex-direction: column; gap: 12px; margin-bottom: 1rem;
}
.msg { display: flex; gap: 10px; max-width: 88%; }
.msg-ai { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--clr-primary-light); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.msg-body {
  background: #fff; border: 1px solid var(--clr-border);
  border-radius: 12px; border-bottom-left-radius: 3px;
  padding: .6rem .9rem; font-size: 14px; line-height: 1.55;
}
.msg-user .msg-body { background: var(--clr-primary); color: #fff; border-color: var(--clr-primary); border-bottom-left-radius: 12px; border-bottom-right-radius: 3px; }
.msg-loading .msg-body { opacity: .6; font-style: italic; }

.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input {
  flex: 1; padding: .6rem .9rem; border: 1.5px solid var(--clr-border); border-radius: var(--radius);
  font-size: 14px; background: #fff; color: var(--clr-text); transition: border-color .15s;
}
.chat-input-row input:focus { outline: none; border-color: var(--clr-primary); }

/* Exam */
.exam-intro { text-align: center; padding: 2rem; }
.exam-intro h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: .5rem; }
.exam-intro p { color: var(--clr-text-muted); font-size: 14px; margin-bottom: 1.5rem; }
.exam-question { margin-bottom: 1.25rem; }
.exam-question .q-number { font-size: 12px; color: var(--clr-text-muted); margin-bottom: .4rem; }
.exam-question .q-text { font-size: 15px; font-weight: 600; margin-bottom: .75rem; }
.option-btn {
  display: block; width: 100%; text-align: left;
  padding: .6rem .9rem; margin: .35rem 0; border-radius: var(--radius);
  border: 1.5px solid var(--clr-border); background: #fff; font-size: 14px; cursor: pointer; transition: all .15s;
}
.option-btn:hover { border-color: var(--clr-primary); background: var(--clr-primary-light); }
.option-btn.correct { border-color: var(--clr-success); background: var(--clr-success-light); color: var(--clr-success); }
.option-btn.wrong { border-color: var(--clr-danger); background: var(--clr-danger-light); color: var(--clr-danger); }

/* Progress bar */
.progress-bar-wrap { height: 7px; background: var(--clr-border); border-radius: 4px; margin: .35rem 0 .6rem; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: var(--clr-primary); transition: width .5s; }

/* Results */
.results-card { text-align: center; padding: 2rem 1.5rem; }
.results-score { font-size: 3rem; font-weight: 800; color: var(--clr-primary); }
.results-label { font-size: 14px; color: var(--clr-text-muted); margin-top: .25rem; }
.results-badge { font-size: 1.5rem; margin: 1rem 0; }

/* Sidebar subject groups (replaces flat subject list) */
.subject-group { margin-bottom: 1rem; }
.subject-name {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--clr-text-muted); padding: .3rem .6rem;
}
.subject-list { list-style: none; }
.subject-list li {
  padding: .45rem .6rem; border-radius: var(--radius); font-size: 13px;
  cursor: pointer; color: var(--clr-text-muted); transition: all .15s;
}
.subject-list li:hover { background: var(--clr-primary-light); color: var(--clr-primary); }
.subject-list li.active { background: var(--clr-primary-light); color: var(--clr-primary); font-weight: 600; }

/* In-app video shown above the lesson chat */
.inapp-video { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; margin-bottom: .5rem; }
.inapp-video iframe { width: 100%; height: 100%; border: none; display: block; }
.vid-caption { font-size: 12px; color: var(--clr-text-muted); margin-bottom: 1rem; }

/* Assessment & project assistant panels */
.panel-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .4rem; }
.assess-input-row { display: flex; align-items: center; gap: 10px; margin: 1rem 0 .75rem; flex-wrap: wrap; }
.assess-textarea {
  width: 100%; min-height: 100px; padding: .75rem; border: 1.5px solid var(--clr-border);
  border-radius: var(--radius); font-size: 14px; font-family: inherit; resize: vertical; margin-bottom: .75rem;
}
.assess-textarea:focus { outline: none; border-color: var(--clr-primary); }
.assess-result { margin-top: 1rem; }
.assess-card {
  display: flex; gap: 12px; background: var(--clr-primary-light); border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg); padding: 1rem;
}
.assess-icon { font-size: 1.5rem; flex-shrink: 0; }
.assess-body { font-size: 14px; line-height: 1.7; color: var(--clr-text); white-space: pre-wrap; }

.topic-suggestions { margin-bottom: 1rem; }
.topic-pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-pill {
  text-align: left; padding: .5rem .85rem; border-radius: var(--radius); border: 1.5px solid var(--clr-border);
  background: #fff; font-size: 13px; cursor: pointer; transition: all .15s; max-width: 100%;
}
.topic-pill:hover { border-color: var(--clr-primary); background: var(--clr-primary-light); }

.section-heading { font-size: 1.3rem; font-weight: 800; margin: 2rem 0 .25rem; }

/* Assessment photo preview */
.assess-preview { max-width: 100%; max-height: 280px; border-radius: var(--radius); border: 1.5px solid var(--clr-border); display: block; margin-bottom: .5rem; }
#assessPreviewWrap { margin-bottom: .75rem; }

/* Project mode toggle */
.project-mode-row { display: flex; gap: 8px; margin-bottom: 1rem; }
.mode-btn {
  flex: 1; padding: .6rem; border-radius: var(--radius); border: 1.5px solid var(--clr-border);
  background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--clr-text-muted); transition: all .15s;
}
.mode-btn.active { border-color: var(--clr-primary); background: var(--clr-primary-light); color: var(--clr-primary); }

/* Per-course score rows */
.course-score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .75rem; border: 1px solid var(--clr-border); border-radius: var(--radius); margin-bottom: 6px; font-size: 13px;
}

@media (max-width: 680px) {
  .learn-layout { grid-template-columns: 1fr; }
  .learn-sidebar { position: static; }
}

/* ── CHAT HISTORY SIDEBAR ─────────────────── */
.sidebar-history { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--clr-border); }
.sidebar-history h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--clr-text-muted); margin-bottom: .5rem; }
.history-item {
  padding: .5rem .6rem; border-radius: var(--radius); cursor: pointer;
  transition: background .12s; margin-bottom: 4px;
}
.history-item:hover { background: var(--clr-primary-light); }
.history-topic { font-size: 12.5px; font-weight: 700; color: var(--clr-text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-preview { font-size: 11px; color: var(--clr-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── CHAT HEADER (topic label + clear btn) ── */
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .45rem .75rem; background: var(--clr-primary-light);
  border: 1px solid #bfdbfe; border-radius: var(--radius);
  margin-bottom: .65rem; font-size: 13px; font-weight: 600;
  color: var(--clr-primary);
}

/* ── CHAT SYSTEM NOTE ─────────────────────── */
.chat-system-note {
  text-align: center; font-size: 12px; color: var(--clr-text-muted);
  background: #f8fafc; border: 1px dashed var(--clr-border);
  border-radius: var(--radius); padding: .4rem .75rem; margin: .25rem 0;
}

/* ── STICKY VIDEO while scrolling ── */
.sticky-video-wrap {
  position: sticky;
  top: 60px;
  z-index: 40;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: .75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

/* ── DASHBOARD RECENT ACTIVITY links ── */
.recent-item-link { text-decoration: none; color: inherit; display: block; }
.recent-item-link:hover .recent-item { background: var(--clr-primary-light); border-radius: var(--radius); }
.recent-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-bottom: 1px solid var(--clr-border); font-size: 13px; cursor: pointer; }
.recent-item:last-child { border-bottom: none; }
.recent-dot { font-size: 15px; flex-shrink: 0; }
.recent-arrow { margin-left: auto; color: var(--clr-primary); font-weight: 700; }

/* ============================================
   STRUCTURED LESSON FLOW
   ============================================ */
.lesson-empty-hint { text-align: center; padding: 3rem 1rem; }

/* Sidebar lock / done indicators */
.subject-list li { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.subject-list li.topic-locked { opacity: .55; cursor: not-allowed; }
.subject-list li.topic-locked:hover { background: transparent; color: inherit; }
.subject-list li.topic-done .topic-li-label { color: var(--clr-success); }
.topic-status { font-size: 12px; flex-shrink: 0; }

/* Progress row above the stepper */
.flow-progress-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.flow-progress-bar { flex: 1; margin: 0; }
.flow-progress-pct { font-size: 12px; color: var(--clr-text-muted); white-space: nowrap; font-weight: 600; }

/* Stepper */
.flow-stepper {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 1rem;
  scrollbar-width: thin;
}
.flow-step-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  flex: 0 0 auto; min-width: 68px; padding: .5rem .4rem;
  background: var(--clr-card); border: 1.5px solid var(--clr-border); border-radius: var(--radius);
  cursor: pointer; font-size: 10.5px; color: var(--clr-text-muted); transition: all .15s;
}
.flow-step-btn .flow-step-icon { font-size: 17px; }
.flow-step-btn:hover:not(:disabled) { border-color: var(--clr-primary); color: var(--clr-primary); }
.flow-step-btn.active { border-color: var(--clr-primary); background: var(--clr-primary-light); color: var(--clr-primary); font-weight: 700; }
.flow-step-btn.done { color: var(--clr-success); }
.flow-step-btn.disabled, .flow-step-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Step panel + generic card */
.flow-panel { min-height: 200px; }
.flow-card {
  background: var(--clr-card); border: 1.5px solid var(--clr-border); border-radius: var(--radius-lg);
  padding: 1.25rem; box-shadow: var(--shadow);
  animation: flowFadeIn .25s ease;
}
@keyframes flowFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.flow-card-title { font-size: 16px; font-weight: 700; margin-bottom: .75rem; display: flex; align-items: center; gap: 8px; }
.flow-ai-body { font-size: 14.5px; line-height: 1.65; color: var(--clr-text); white-space: normal; }
.flow-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 1.25rem; flex-wrap: wrap; }
.flow-complete-card { text-align: center; }

/* Learning Objectives card */
.objectives-card {
  background: linear-gradient(135deg, var(--clr-primary-light), #fff);
  border: 1.5px solid var(--clr-primary); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-md);
}
.objectives-card-head { font-weight: 700; font-size: 15px; color: var(--clr-primary-dark); margin-bottom: 1rem; }
.objectives-list { list-style: none; display: flex; flex-direction: column; gap: .65rem; margin-bottom: 1.25rem; }
.objectives-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.4; }
.obj-icon { font-size: 18px; flex-shrink: 0; line-height: 1.4; }

@media (max-width: 640px) {
  .flow-step-btn { min-width: 58px; font-size: 9.5px; padding: .4rem .3rem; }
  .flow-step-btn .flow-step-icon { font-size: 15px; }
  .flow-card { padding: 1rem; }
}

/* ============================================
   AI EDUCATIONAL FEEDBACK ENGINE
   ============================================ */
.ai-feedback-card {
  margin-top: .85rem; padding: 1rem; border-radius: var(--radius);
  border: 1.5px solid var(--clr-border); background: var(--clr-bg);
  animation: flowFadeIn .2s ease;
}
.ai-feedback-card.correct { border-color: var(--clr-success); background: var(--clr-success-light); }
.ai-feedback-card.incorrect { border-color: var(--clr-warning); background: var(--clr-warning-light); }
.ai-feedback-head { font-weight: 700; font-size: 13.5px; margin-bottom: .5rem; }
.ai-feedback-body { font-size: 13.5px; line-height: 1.55; }
.fb-row { display: flex; gap: 8px; font-size: 13px; line-height: 1.5; margin-bottom: .4rem; align-items: flex-start; }
.fb-label { flex: 0 0 auto; font-weight: 700; white-space: nowrap; }

/* ============================================
   ADAPTIVE LEARNING — sidebar learner-profile widget
   ============================================ */
.profile-tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; }
.profile-tag { font-size: 10.5px; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.profile-tag.strong { background: var(--clr-success-light); color: var(--clr-success); border: 1px solid var(--clr-success); }
.profile-tag.weak { background: var(--clr-warning-light); color: var(--clr-warning); border: 1px solid var(--clr-warning); }

/* ============================================
   PHASE 3 — Real-World Activity step, Spaced Revision tab
   ============================================ */
.activity-check-row {
  display: flex; align-items: center; gap: 8px; margin-top: 1rem; font-size: 13.5px;
  background: var(--clr-bg); border: 1px dashed var(--clr-border); border-radius: var(--radius);
  padding: .6rem .8rem; cursor: pointer;
}
.activity-check-row input { width: 16px; height: 16px; accent-color: var(--clr-primary); cursor: pointer; }

.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; margin-left: 4px;
  background: var(--clr-danger); color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 700; vertical-align: middle;
}

.revision-card {
  background: var(--clr-card); border: 1.5px solid var(--clr-primary); border-radius: var(--radius-lg);
  padding: 1rem 1.1rem; margin-bottom: .75rem; box-shadow: var(--shadow);
}
.revision-card-head { font-weight: 700; font-size: 14.5px; margin-bottom: .25rem; }
.revision-empty { text-align: center; padding: 2rem 1rem; }
.revision-subhead { font-size: 13px; font-weight: 700; color: var(--clr-text-muted); margin: 1.25rem 0 .5rem; text-transform: uppercase; letter-spacing: .04em; }
.revision-upcoming-list { display: flex; flex-direction: column; gap: 2px; }
.revision-upcoming-row {
  display: flex; justify-content: space-between; font-size: 13px;
  padding: .5rem .25rem; border-bottom: 1px solid var(--clr-border);
}
.revision-upcoming-row:last-child { border-bottom: none; }

.sidebar-gam-row {
  display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; font-weight: 700;
  margin-bottom: 6px; color: var(--clr-text);
}
