/* ================================================================
   LearnSphere v5 — Complete Stylesheet
   Theme system: [data-theme="night"] / [data-theme="day"]
   Accent: --accent CSS variable set by JS
   ================================================================ */

/* ── NIGHT THEME (default) ──────────────────────────────────────── */
:root,
[data-theme="night"] {
  --bg:           #050D1A;
  --bg2:          #0A1628;
  --bg3:          #0F1F35;
  --bg4:          #162840;
  --text:         #E2E8F0;
  --text2:        #94A3B8;
  --text3:        #64748B;
  --border:       rgba(255,255,255,0.07);
  --border2:      rgba(255,255,255,0.15);
  --shadow:       0 4px 24px rgba(0,0,0,0.6);
  --shadow2:      0 8px 40px rgba(0,0,0,0.7);
  --accent:       #00D4FF;
  --accent-glow:  rgba(0,212,255,0.13);
  --accent-strong:rgba(0,212,255,0.28);
  --success:      #10B981;
  --warn:         #F59E0B;
  --danger:       #EF4444;
  --nav-bg:       rgba(5,13,26,0.9);
}

/* ── DAY THEME ──────────────────────────────────────────────────── */
[data-theme="day"] {
  --bg:           #F0F4F8;
  --bg2:          #E2ECF4;
  --bg3:          #FFFFFF;
  --bg4:          #F8FAFB;
  --text:         #1A2332;
  --text2:        #3D5166;
  --text3:        #6B7E92;
  --border:       rgba(0,0,0,0.09);
  --border2:      rgba(0,0,0,0.20);
  --shadow:       0 4px 24px rgba(0,0,0,0.10);
  --shadow2:      0 8px 40px rgba(0,0,0,0.15);
  --success:      #059669;
  --warn:         #D97706;
  --danger:       #DC2626;
  --nav-bg:       rgba(240,244,248,0.95);
}

/* ── FONT + SPACING TOKENS ──────────────────────────────────────── */
:root {
  --ff-sans:  'Inter', system-ui, sans-serif;
  --ff-serif: 'Merriweather', Georgia, serif;
  --ff-mono:  'JetBrains Mono', monospace;
  --r:        10px;
  --r2:       16px;
  --r3:       22px;
}

/* ── GLOBAL RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--ff-sans);
  font-size: 15px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-top: 62px;
  transition: background .25s, color .25s;
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }
::selection { background: var(--accent-glow); color: var(--accent); }

a { color: inherit; text-decoration: none; }

@keyframes fadeUp  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 0%,100% { opacity:1; } 50% { opacity:.5; } }

/* ================================================================
   NAVBAR
   ================================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 62px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1rem;
  transition: background .25s, border-color .25s;
}

.nav-logo {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--ff-serif);
  font-size: 1.1rem; font-weight: 700;
  color: var(--text); text-decoration: none;
  flex-shrink: 0;
}
.logo-text { white-space: nowrap; }
.logo-accent { color: var(--accent); }

.nav-links {
  display: flex; align-items: center; gap: 2px;
  flex: 1; overflow-x: auto;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  padding: 0.32rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem; font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  transition: all .15s;
}
.nav-link:hover  { color: var(--text); background: rgba(255,255,255,0.05); }
[data-theme="day"] .nav-link:hover { background: rgba(0,0,0,0.05); }
.nav-link.active { color: var(--accent); background: var(--accent-glow); font-weight: 600; }

.nav-right {
  display: flex; align-items: center; gap: 0.65rem;
  flex-shrink: 0; margin-left: auto;
}

.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border2);
  font-size: 0.95rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.theme-toggle:hover { border-color: var(--accent); }

.accent-dots { display: flex; gap: 5px; align-items: center; }
.adot {
  width: 16px; height: 16px; border-radius: 50%;
  border: none; cursor: pointer; flex-shrink: 0;
  transition: transform .15s;
}
.adot:hover { transform: scale(1.25); }

.nav-user {
  display: flex; align-items: center; gap: 0.45rem;
}
.nav-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-glow); border: 1.5px solid var(--accent);
  color: var(--accent); font-size: 0.78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-username { font-size: 0.8rem; font-weight: 600; color: var(--text2); }

.logout-btn {
  padding: 0.3rem 0.75rem;
  border-radius: 7px; font-size: 0.75rem; font-weight: 600;
  border: 1px solid var(--border2); color: var(--text2);
  background: transparent; transition: all .15s; white-space: nowrap;
}
.logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ================================================================
   PAGE WRAP / LAYOUT
   ================================================================ */
main { min-height: calc(100vh - 62px); }

.page-wrap {
  max-width: 1280px; margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.page-title {
  font-family: var(--ff-serif);
  font-size: 1.8rem; font-weight: 700;
  letter-spacing: -.02em; line-height: 1.2;
  color: var(--text); margin-bottom: 0.3rem;
}
.page-sub  { color: var(--text2); font-size: 0.86rem; }
.accent    { color: var(--accent); }
.back-link { display: inline-block; font-size: 0.78rem; color: var(--text2); margin-bottom: 0.5rem; }
.back-link:hover { color: var(--accent); }

/* Section headers */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 2rem 0 1rem; padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.section-header h2 { font-family: var(--ff-serif); font-size: 1.05rem; font-weight: 700; color: var(--text); }
.link-btn { color: var(--accent); font-size: 0.8rem; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.48rem 1.1rem; border-radius: 8px;
  font-size: 0.83rem; font-weight: 600; font-family: var(--ff-sans);
  cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  transition: all .18s; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 0 20px var(--accent-glow); transform: translateY(-1px); }
[data-theme="day"] .btn-primary { color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border2); color: var(--text2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.btn-danger { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Stats row */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 1.1rem;
  display: flex; align-items: center; gap: 0.9rem;
  transition: all .18s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-icon { font-size: 1.7rem; flex-shrink: 0; }
.stat-num  { display: block; font-family: var(--ff-serif); font-size: 1.7rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-lbl  { display: block; font-size: 0.7rem; color: var(--text2); margin-top: 0.2rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* Course grid */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.1rem; }

.course-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); overflow: hidden;
  text-decoration: none; color: var(--text);
  transition: all .18s; display: block;
}
.course-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: var(--shadow); }
.course-thumb {
  padding: 1.6rem; display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--border); min-height: 100px; position: relative;
}
.course-icon { font-size: 2.4rem; }
.enrolled-badge {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: rgba(16,185,129,.14); border: 1px solid rgba(16,185,129,.3);
  color: var(--success); font-size: 0.65rem; font-weight: 700;
  padding: .15rem .45rem; border-radius: 5px;
}
.course-info { padding: 1rem 1.1rem; }
.course-meta-row { display: flex; gap: .4rem; margin-bottom: .45rem; align-items: center; }
.course-diff {
  display: inline-block; padding: .12rem .45rem; border-radius: 5px;
  font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.course-diff.beginner     { background: rgba(16,185,129,.12); color: var(--success); }
.course-diff.intermediate { background: rgba(245,158,11,.12); color: var(--warn); }
.course-diff.advanced     { background: rgba(239,68,68,.1);   color: var(--danger); }
.course-cat { font-size: .68rem; color: var(--text2); background: var(--bg2); padding: .1rem .4rem; border-radius: 4px; }
.course-card h3 { font-family: var(--ff-serif); font-size: .92rem; font-weight: 700; margin-bottom: .3rem; line-height: 1.35; }
.course-desc  { font-size: .76rem; color: var(--text2); line-height: 1.5; margin-bottom: .65rem; }
.course-footer { display: flex; justify-content: space-between; font-size: .7rem; color: var(--text2); }
.progress-row { display: flex; align-items: center; gap: .55rem; margin-top: .5rem; }
.progress-bar { flex: 1; height: 4px; background: var(--bg2); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 2px; transition: width .5s ease; }

/* Enrolled count badge */
.enrolled-count {
  position: absolute; bottom: .45rem; right: .45rem;
  background: rgba(0,0,0,.4); color: var(--text2); font-size: .65rem;
  padding: .1rem .4rem; border-radius: 5px;
}

/* Educator action buttons */
.educator-actions { display: flex; gap: .4rem; margin-top: .7rem; flex-wrap: wrap; }
.act-btn {
  padding: .25rem .6rem; border-radius: 5px;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text2); font-size: .7rem; cursor: pointer;
  text-decoration: none; transition: all .15s; font-family: var(--ff-sans); font-weight: 500;
}
.act-btn:hover   { border-color: var(--accent); color: var(--accent); }
.act-btn.primary { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }
.act-btn.danger  { color: var(--danger); border-color: rgba(239,68,68,.2); }
.act-btn.danger:hover { background: rgba(239,68,68,.1); }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.qa-card {
  display: flex; align-items: center; gap: .9rem;
  padding: 1.1rem; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--r2);
  text-decoration: none; color: var(--text); transition: all .18s;
}
.qa-card:hover { border-color: var(--border2); background: var(--bg4); transform: translateX(2px); }
.qa-icon { font-size: 1.6rem; flex-shrink: 0; }
.qa-card strong { display: block; font-size: .87rem; font-weight: 600; margin-bottom: .15rem; }
.qa-card p { font-size: .74rem; color: var(--text2); }

/* Feature cards on dashboard */
.feat-card {
  display: flex; align-items: center; gap: .85rem;
  padding: 1.2rem 1.3rem; border-radius: var(--r2);
  background: var(--bg3); border: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: all .18s; position: relative; overflow: hidden;
}
.feat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow2); border-color: var(--border2); }
.feat-icon   { font-size: 2rem; flex-shrink: 0; }
.feat-body   { flex: 1; }
.feat-title  { font-family: var(--ff-serif); font-weight: 700; font-size: .93rem; margin-bottom: .2rem; }
.feat-desc   { font-size: .73rem; color: var(--text2); line-height: 1.4; }
.feat-arrow  { font-size: 1rem; color: var(--text2); transition: transform .18s; }
.feat-card:hover .feat-arrow { transform: translateX(4px); color: var(--accent); }

/* ================================================================
   LOADING / EMPTY STATES / ERRORS
   ================================================================ */
.loading-card {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1rem; min-height: 200px; color: var(--text2);
  grid-column: 1 / -1;
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block;
}
.empty-courses {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1rem; min-height: 200px;
  text-align: center; color: var(--text2); grid-column: 1 / -1;
}
.error-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .75rem; padding: 2.5rem;
  background: rgba(239,68,68,.05); border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--r2); color: var(--text2);
}
.error-card h3  { color: var(--danger); font-family: var(--ff-serif); }
.error-icon     { font-size: 2.5rem; }
.error-hint     { font-size: .8rem; }
.error-hint a   { color: var(--accent); }

/* ================================================================
   FORMS (educator pages)
   ================================================================ */
.form-page { display: block; }
.form-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r2); padding: 2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-bottom: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .72rem; color: var(--text2); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.form-input {
  padding: .62rem .88rem; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--ff-sans); font-size: .87rem;
  outline: none; transition: border-color .18s; width: 100%;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input option { background: var(--bg3); }
.form-textarea { min-height: 130px; resize: vertical; line-height: 1.7; }
.form-textarea.tall { min-height: 260px; }
.code-font { font-family: var(--ff-mono); font-size: .79rem; }
.content-help { font-size: .71rem; color: var(--text2); margin-bottom: .25rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .7rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.error-msg-form {
  background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.3);
  border-radius: 8px; padding: .6rem .95rem; color: var(--danger);
  font-size: .82rem; margin-bottom: 1rem; display: none;
}
.color-pick { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .25rem; }
.color-opt  { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: all .15s; }
.color-opt.active { border-color: var(--text); transform: scale(1.15); }

/* ================================================================
   LECTURE LAYOUT
   ================================================================ */
.lecture-layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 62px); }

.lec-sidebar {
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 1rem 0; overflow-y: auto;
  height: calc(100vh - 62px); position: sticky; top: 62px;
}
.lec-sidebar-header { padding: .65rem 1rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.back-btn { background: none; border: none; color: var(--text2); cursor: pointer; font-size: .8rem; font-family: var(--ff-sans); padding: .28rem .48rem; border-radius: 6px; }
.back-btn:hover { color: var(--accent); }

.sidebar-lec-item { display: flex; align-items: center; gap: .65rem; padding: .52rem 1rem; color: var(--text2); text-decoration: none; font-size: .78rem; transition: all .14s; border-left: 2px solid transparent; }
.sidebar-lec-item:hover { background: var(--bg3); color: var(--text); }
.sidebar-lec-item.active { background: var(--accent-glow); color: var(--accent); border-left-color: var(--accent); }
.slec-num { width: 20px; height: 20px; border-radius: 50%; background: var(--bg3); border: 1px solid var(--border); font-size: .6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text2); }
.sidebar-lec-item.active .slec-num { background: var(--accent); color: #fff; border-color: var(--accent); }
.slec-title { line-height: 1.35; }

.lec-main { padding: 1.75rem 2rem; max-width: 860px; }
.lec-title { font-family: var(--ff-serif); font-size: 1.75rem; font-weight: 700; line-height: 1.25; margin-bottom: .7rem; color: var(--text); }
.lec-meta  { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; flex-wrap: wrap; }
.lec-meta span { font-size: .76rem; color: var(--text2); }
.lec-type-badge { padding: .16rem .48rem; border-radius: 5px; background: var(--bg2); border: 1px solid var(--border); }
.done-badge { background: rgba(16,185,129,.12); color: var(--success); padding: .16rem .55rem; border-radius: 5px; border: 1px solid rgba(16,185,129,.3); font-weight: 600; }
.lec-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.btn-sm { padding: .28rem .75rem; border-radius: 6px; font-size: .76rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); font-family: var(--ff-sans); transition: all .15s; }
.btn-sm:hover     { border-color: var(--accent); color: var(--accent); }
.btn-ai           { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }
.btn-success      { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: var(--success); }
.btn-sm-full      { width: 100%; padding: .48rem; margin-top: .45rem; border-radius: 8px; background: var(--accent); border: none; color: #fff; font-weight: 700; cursor: pointer; font-family: var(--ff-sans); font-size: .82rem; }

.lec-text       { line-height: 1.85; color: var(--text2); }
.lec-text .md-h2 { font-family: var(--ff-serif); font-size: 1.18rem; color: var(--text); margin: 1.4rem 0 .55rem; font-weight: 700; }
.lec-text .md-h3 { font-family: var(--ff-serif); font-size: 1rem; color: var(--text); margin: 1rem 0 .38rem; font-weight: 600; }
.lec-text .md-p  { margin-bottom: .65rem; }
.lec-text .md-li { margin-left: 1.4rem; margin-bottom: .28rem; list-style: disc; }
.lec-text .inline-code { font-family: var(--ff-mono); background: var(--bg2); padding: .08rem .32rem; border-radius: 4px; font-size: .82em; color: var(--accent); border: 1px solid var(--border); }

.code-section   { margin: 1.4rem 0; }
.code-sec-header { display: flex; justify-content: space-between; align-items: center; background: var(--bg2); padding: .55rem 1rem; border-radius: 8px 8px 0 0; border: 1px solid var(--border); border-bottom: none; font-size: .76rem; color: var(--accent); font-weight: 600; }
.code-section pre { border-radius: 0 0 8px 8px; margin: 0; border: 1px solid var(--border); border-top: none; }
.copy-btn { background: none; border: none; color: var(--text2); font-size: .72rem; cursor: pointer; font-family: var(--ff-sans); transition: color .15s; }
.copy-btn:hover { color: var(--accent); }

.notes-panel { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; margin-bottom: 1.4rem; }
.notes-panel h4 { margin-bottom: .55rem; font-size: .86rem; color: var(--text); }
.notes-textarea { width: 100%; min-height: 100px; padding: .6rem; border-radius: 7px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); font-family: var(--ff-sans); font-size: .82rem; resize: vertical; outline: none; line-height: 1.6; }
.notes-textarea:focus { border-color: var(--accent); }

.lec-nav { display: flex; justify-content: space-between; align-items: center; padding-top: 2rem; border-top: 1px solid var(--border); }
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; margin-bottom: 1.4rem; border-radius: var(--r); overflow: hidden; }
.video-wrap iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.ai-panel { position: fixed; right: 0; top: 62px; width: 320px; height: calc(100vh - 62px); background: var(--bg3); border-left: 1px solid var(--border); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s ease; z-index: 50; }
.ai-panel.open { transform: translateX(0); }
.ai-panel-header { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; color: var(--accent); font-weight: 600; font-size: .88rem; }
.ai-toggle { background: none; border: none; color: var(--text2); font-size: 1.2rem; cursor: pointer; }
.ai-chat-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .45rem; }
.chat-msg  { padding: .6rem .8rem; border-radius: 10px; font-size: .8rem; line-height: 1.6; max-width: 92%; }
.chat-msg.user { background: var(--accent-glow); border: 1px solid var(--border2); color: var(--text); align-self: flex-end; border-radius: 10px 10px 3px 10px; }
.chat-msg.ai   { background: var(--bg2); border: 1px solid var(--border); color: var(--text2); align-self: flex-start; border-radius: 10px 10px 10px 3px; }
.ai-chat-input { padding: .7rem; border-top: 1px solid var(--border); display: flex; gap: .45rem; }
.ai-chat-input input { flex: 1; padding: .42rem .7rem; border-radius: 8px; background: var(--bg2); border: 1px solid var(--border); color: var(--text); font-size: .78rem; font-family: var(--ff-sans); outline: none; }
.ai-chat-input input:focus { border-color: var(--accent); }
.ai-chat-input button { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); border: none; color: #fff; cursor: pointer; }
.ai-fab { position: fixed; bottom: 2rem; right: 2rem; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); border: none; font-size: 1.25rem; cursor: pointer; box-shadow: var(--shadow); z-index: 40; transition: all .18s; }
.ai-fab:hover { transform: scale(1.08); }

/* Lecture list */
.lecture-list { margin-bottom: 2rem; }
.lecture-item { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.05rem; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: .45rem; text-decoration: none; color: var(--text); transition: all .15s; }
.lecture-item:hover { border-color: var(--border2); background: var(--bg4); }
.lecture-item.done { border-color: rgba(16,185,129,.2); }
.lec-num { width: 27px; height: 27px; border-radius: 50%; background: var(--bg2); border: 1px solid var(--border); font-size: .73rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text2); }
.lec-num.done { background: rgba(16,185,129,.14); color: var(--success); border-color: rgba(16,185,129,.3); }
.lec-info strong { display: block; font-size: .88rem; }
.lec-info span   { font-size: .73rem; color: var(--text2); }
.lec-arrow span  { font-size: .76rem; color: var(--text2); }
.lecture-manage-list { display: flex; flex-direction: column; gap: .45rem; }
.lec-manage-item { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.05rem; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); transition: all .15s; }
.lec-manage-item:hover { border-color: var(--border2); }
.lec-order { width: 27px; height: 27px; border-radius: 50%; background: var(--accent-glow); border: 1px solid var(--border2); color: var(--accent); font-size: .73rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lec-manage-info strong { display: block; font-size: .88rem; }
.lec-manage-info span   { font-size: .73rem; color: var(--text2); }
.lec-manage-actions { display: flex; gap: .45rem; margin-left: auto; }

/* Course hero */
.course-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.75rem; padding: 1.6rem; border: 1px solid; border-radius: var(--r2); margin-bottom: 2rem; flex-wrap: wrap; }

/* ================================================================
   LEARN PAGE — sidebar + main
   ================================================================ */
.page-layout {
  display: grid; grid-template-columns: 255px 1fr;
  min-height: calc(100vh - 62px);
}
.sidebar {
  background: var(--bg2); border-right: 1px solid var(--border);
  padding: 1.1rem; overflow-y: auto;
  height: calc(100vh - 62px); position: sticky; top: 62px;
  display: flex; flex-direction: column; gap: 1.1rem;
}
.sidebar-title { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text2); margin-bottom: .55rem; }

.topic-list { display: flex; flex-direction: column; gap: .15rem; }
.topic-btn {
  width: 100%; text-align: left; padding: .4rem .65rem; border-radius: 7px;
  background: transparent; border: 1px solid transparent;
  color: var(--text2); font-family: var(--ff-sans); font-size: .78rem; cursor: pointer; transition: all .14s;
}
.topic-btn:hover  { background: var(--bg3); border-color: var(--border); color: var(--text); }
.topic-btn.active { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); font-weight: 600; }

.chat-box {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: .7rem; min-height: 100px; max-height: 200px; overflow-y: auto;
  display: flex; flex-direction: column; gap: .45rem; margin-bottom: .55rem;
}
.chat-input-row { display: flex; gap: .35rem; }
.chat-input { flex: 1; padding: .42rem .68rem; border-radius: 7px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); font-family: var(--ff-sans); font-size: .77rem; outline: none; }
.chat-input:focus { border-color: var(--accent); }
.chat-send { width: 32px; height: 32px; border-radius: 7px; background: var(--accent); border: none; color: #fff; font-size: .95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.learn-main { padding: 1.6rem 1.85rem; overflow-y: auto; }
.search-section { margin-bottom: 1.4rem; }
.search-bar { display: flex; align-items: center; gap: .7rem; background: var(--bg3); border: 1px solid var(--border); border-radius: 12px; padding: .55rem .85rem; margin-bottom: .7rem; transition: border-color .18s; }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-icon { flex-shrink: 0; opacity: .7; }
.search-input { flex: 1; background: transparent; border: none; color: var(--text); font-family: var(--ff-sans); font-size: .9rem; outline: none; }
.search-input::placeholder { color: var(--text2); }
.search-btn { padding: .38rem 1rem; border-radius: 8px; background: var(--accent); border: none; color: #fff; font-family: var(--ff-sans); font-size: .8rem; font-weight: 700; cursor: pointer; flex-shrink: 0; transition: filter .15s; }
.search-btn:hover { filter: brightness(1.1); }

.mode-tabs { display: flex; gap: .3rem; }
.mode-tab { padding: .28rem .75rem; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text2); font-size: .76rem; font-weight: 600; cursor: pointer; font-family: var(--ff-sans); transition: all .14s; }
.mode-tab.active { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; text-align: center; color: var(--text2); gap: .7rem; }
.empty-icon { font-size: 3.2rem; }
.empty-state h2 { font-family: var(--ff-serif); font-size: 1.2rem; color: var(--text); }
.empty-state p  { font-size: .83rem; }

.result-area { margin-bottom: 1.4rem; }
.result-tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); padding-bottom: .6rem; }
.result-tab { padding: .28rem .75rem; border-radius: 6px; border: 1px solid transparent; color: var(--text2); font-size: .76rem; font-weight: 600; cursor: pointer; font-family: var(--ff-sans); background: none; transition: all .14s; }
.result-tab.active { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }
.result-panel { display: none; }
.result-panel.active { display: block; animation: fadeUp .25s ease; }

/* Concept card */
.concept-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r2); overflow: hidden; animation: fadeUp .35s ease; }
.concept-header { padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .7rem; }
.concept-title { font-family: var(--ff-serif); font-size: 1.35rem; font-weight: 700; color: var(--text); }
.concept-difficulty { padding: .18rem .6rem; border-radius: 20px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.concept-difficulty.beginner     { background: rgba(16,185,129,.12); color: var(--success); }
.concept-difficulty.intermediate { background: rgba(245,158,11,.12); color: var(--warn); }
.concept-difficulty.advanced     { background: rgba(239,68,68,.1); color: var(--danger); }
.concept-body { padding: 1.4rem; }
.concept-section { margin-bottom: 1.4rem; }
.concept-section h4 { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); margin-bottom: .6rem; }
.concept-section p  { font-size: .86rem; color: var(--text2); line-height: 1.75; }
.key-points { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.key-points li { display: flex; align-items: flex-start; gap: .55rem; padding: .45rem .7rem; background: var(--bg2); border-radius: 7px; font-size: .82rem; color: var(--text2); }
.key-points li::before { content: '→'; color: var(--accent); flex-shrink: 0; font-weight: 700; }
.related-topics { display: flex; flex-wrap: wrap; gap: .35rem; }
.related-tag { padding: .25rem .65rem; border-radius: 20px; background: var(--bg2); border: 1px solid var(--border); color: var(--text2); font-size: .74rem; cursor: pointer; transition: all .14s; font-family: var(--ff-sans); }
.related-tag:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.formula-display { font-family: var(--ff-mono); font-size: .88rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: .8rem; color: var(--accent); text-align: center; }
.diagram-canvas { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); display: block; }

.quiz-section { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; }
.quiz-question { font-size: .88rem; font-weight: 600; color: var(--text); margin-bottom: .8rem; line-height: 1.5; }
.quiz-options  { display: flex; flex-direction: column; gap: .42rem; }
.quiz-option { padding: .52rem .88rem; border-radius: 8px; background: var(--bg3); border: 1.5px solid var(--border); color: var(--text2); font-size: .82rem; cursor: pointer; transition: all .14s; text-align: left; font-family: var(--ff-sans); }
.quiz-option:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.quiz-option.correct { border-color: var(--success); background: rgba(16,185,129,.1); color: var(--success); }
.quiz-option.wrong   { border-color: var(--danger);  background: rgba(239,68,68,.08); color: var(--danger); }
.quiz-option:disabled { cursor: not-allowed; }
.quiz-feedback { margin-top: .7rem; padding: .62rem .88rem; border-radius: 8px; font-size: .82rem; display: none; }
.quiz-feedback.correct { background: rgba(16,185,129,.07); border: 1px solid rgba(16,185,129,.2); color: var(--success); }
.quiz-feedback.wrong   { background: rgba(239,68,68,.05); border: 1px solid rgba(239,68,68,.15); color: var(--text2); }

.points-grid  { display: flex; flex-wrap: wrap; gap: .35rem; }
.point-pill   { display: flex; align-items: center; gap: .4rem; padding: .38rem .75rem; background: var(--bg3); border: 1px solid var(--border); border-radius: 20px; font-size: .76rem; color: var(--text2); }
.point-pill::before { content: '•'; color: var(--accent); font-size: .88rem; }
.result-actions-row { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .9rem; }
.action-btn { padding: .35rem .82rem; border-radius: 7px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); font-size: .76rem; font-weight: 600; cursor: pointer; font-family: var(--ff-sans); transition: all .14s; }
.action-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.action-btn.primary { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }
.audio-btn { display: inline-flex; align-items: center; gap: .38rem; padding: .32rem .85rem; border-radius: 7px; background: var(--bg2); border: 1px solid var(--border); color: var(--text2); font-size: .76rem; cursor: pointer; font-family: var(--ff-sans); transition: all .14s; }
.audio-btn:hover   { border-color: var(--accent); color: var(--accent); }
.audio-btn.playing { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }

.suggestions-section { margin-top: 2rem; }
.suggestions-section h3 { font-family: var(--ff-serif); font-size: .98rem; margin-bottom: .9rem; color: var(--text); }
.suggestion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; }
.suggestion-card { padding: .85rem; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; transition: all .14s; }
.suggestion-card:hover { border-color: var(--border2); background: var(--bg4); transform: translateY(-1px); }
.suggestion-topic  { font-size: .86rem; font-weight: 600; color: var(--text); margin-bottom: .28rem; }
.suggestion-reason { font-size: .73rem; color: var(--text2); line-height: 1.5; }
.suggestion-diff   { display: inline-block; margin-top: .35rem; padding: .1rem .42rem; border-radius: 5px; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.suggestion-diff.beginner     { background: rgba(16,185,129,.12); color: var(--success); }
.suggestion-diff.intermediate { background: rgba(245,158,11,.12); color: var(--warn); }
.suggestion-diff.advanced     { background: rgba(239,68,68,.1); color: var(--danger); }

.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; min-height: 200px; color: var(--text2); }

/* ================================================================
   CODE LAB
   ================================================================ */
.code-lab-layout { max-width: 1400px; margin: 0 auto; }
.code-lab-header { padding: 1.5rem 2rem 0; }
.code-lab-header h1 { font-family: var(--ff-serif); font-size: 1.55rem; font-weight: 700; color: var(--text); margin-bottom: .22rem; }
.code-lab-header p  { font-size: .83rem; color: var(--text2); }
.code-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; padding: 1.4rem 2rem; align-items: start; }
.code-panel { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r2); overflow: hidden; }
.panel-header { padding: .82rem 1.2rem; border-bottom: 1px solid var(--border); }
.panel-tabs   { display: flex; gap: .3rem; }
.panel-tab    { padding: .28rem .8rem; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--text2); font-size: .78rem; font-weight: 600; cursor: pointer; font-family: var(--ff-sans); transition: all .14s; }
.panel-tab.active { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }
.panel-title  { font-family: var(--ff-serif); font-size: .93rem; font-weight: 700; color: var(--text); }
.panel-body   { padding: 1.2rem; display: none; }
.panel-body.active { display: block; }

.generate-input-area label,
.analyze-input-area label { display: block; font-size: .7rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .45rem; }
.code-textarea { width: 100%; padding: .65rem .85rem; border-radius: 8px; background: var(--bg2); border: 1px solid var(--border); color: var(--text); font-family: var(--ff-sans); font-size: .84rem; outline: none; resize: vertical; min-height: 100px; line-height: 1.65; transition: border-color .15s; margin-bottom: .8rem; }
.code-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.code-textarea.tall { min-height: 190px; font-family: var(--ff-mono); font-size: .78rem; }
.template-suggestions { display: flex; flex-wrap: wrap; gap: .38rem; align-items: center; margin-bottom: .8rem; }
.ts-label { font-size: .7rem; color: var(--text2); white-space: nowrap; margin-right: .15rem; }
.ts-btn { padding: .18rem .58rem; border-radius: 20px; background: var(--bg2); border: 1px solid var(--border); color: var(--text2); font-size: .7rem; cursor: pointer; font-family: var(--ff-sans); transition: all .14s; }
.ts-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }

.code-header-bar { display: flex; justify-content: space-between; align-items: center; background: var(--bg2); padding: .52rem .95rem; border-radius: 8px 8px 0 0; border: 1px solid var(--border); border-bottom: none; font-size: .74rem; color: var(--accent); font-weight: 600; }
.code-header-bar + pre { border-radius: 0 0 8px 8px; margin: 0; border: 1px solid var(--border); border-top: none; }
.libs-badge { font-size: .66rem; color: var(--text2); background: var(--bg3); padding: .1rem .38rem; border-radius: 4px; border: 1px solid var(--border); }
.code-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 240px; text-align: center; color: var(--text2); gap: .6rem; }
.code-empty-state .empty-icon { font-size: 2.4rem; }
.code-empty-state p { font-size: .8rem; }
.result-panel { min-height: 260px; }

.info-tabs   { display: flex; gap: .3rem; margin-bottom: .95rem; }
.info-tab    { padding: .3rem .78rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg2); color: var(--text2); font-size: .74rem; font-weight: 600; cursor: pointer; font-family: var(--ff-sans); transition: all .14s; }
.info-tab.active { background: var(--accent-glow); border-color: var(--border2); color: var(--accent); }
.info-content { display: none; }
.info-content.active { display: block; }

.score-display { display: flex; align-items: center; gap: .95rem; padding: .85rem 1.15rem; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r2); margin-bottom: 1.05rem; }
.score-ring  { width: 54px; height: 54px; border-radius: 50%; border: 4px solid; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.score-value { font-family: var(--ff-serif); font-size: 1.35rem; font-weight: 700; color: var(--text); }
.score-bar   { height: 5px; background: var(--bg2); border-radius: 3px; overflow: hidden; margin: .38rem 0 .18rem; }
.score-fill  { height: 100%; border-radius: 3px; transition: width .8s ease; }
.score-label { font-size: .7rem; color: var(--text2); }
.assessment-box { margin-bottom: 1rem; }
.assessment-box h4 { font-family: var(--ff-serif); font-size: .87rem; margin-bottom: .38rem; color: var(--text); }
.assessment-box p  { font-size: .81rem; color: var(--text2); }
.errors-section h4, .improvements-section h4, .practices-section h4 { font-family: var(--ff-serif); font-size: .87rem; margin-bottom: .5rem; color: var(--text); }
.error-item  { padding: .62rem .88rem; background: rgba(239,68,68,.05); border: 1px solid rgba(239,68,68,.15); border-radius: 8px; margin-bottom: .45rem; }
.error-line  { font-size: .66rem; background: rgba(239,68,68,.12); color: var(--danger); padding: .08rem .35rem; border-radius: 4px; margin-right: .38rem; }
.error-issue { font-size: .8rem; color: var(--text2); margin: .22rem 0; }
.error-fix   { font-size: .74rem; color: var(--text2); }
.no-errors   { padding: .62rem .88rem; background: rgba(16,185,129,.07); border: 1px solid rgba(16,185,129,.2); border-radius: 8px; color: var(--success); font-size: .8rem; }
.improvements-section ul { list-style: none; }
.improvements-section li, .practices-section li { padding: .26rem 0; font-size: .8rem; color: var(--text2); border-bottom: 1px solid var(--border); }
.improvements-section li:last-child, .practices-section li:last-child { border: none; }
.practice-item { display: inline-block; padding: .22rem .58rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; font-size: .7rem; color: var(--text2); margin: .18rem; }
.practices-grid { display: flex; flex-wrap: wrap; gap: .35rem; }
.optimized-section { margin-top: .95rem; }
.expected-output { margin-top: .7rem; padding: .62rem .88rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; }
.eo-label   { font-size: .66rem; color: var(--text2); font-weight: 700; display: block; margin-bottom: .32rem; text-transform: uppercase; letter-spacing: .04em; }
.eo-content { font-family: var(--ff-mono); font-size: .76rem; color: var(--text2); white-space: pre-wrap; }
.gen-result, .analysis-result { animation: fadeUp .3s ease both; }
.explain-content h4 { font-family: var(--ff-serif); font-size: .87rem; margin-bottom: .45rem; color: var(--text); }
.tip-box, .mistakes-box { padding: .72rem .95rem; background: var(--bg2); border-radius: 8px; margin-bottom: .7rem; }
.tip-box h4, .mistakes-box h4 { font-size: .8rem; margin-bottom: .4rem; color: var(--text); font-weight: 700; }
.tip-box p,  .mistakes-box p  { font-size: .8rem; color: var(--text2); }
.mistakes-box ul  { list-style: none; }
.mistakes-box li  { font-size: .8rem; color: var(--text2); padding: .18rem 0; }
.mistakes-box li::before { content: '⚠ '; }
.btn-spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }

/* ================================================================
   DASHBOARD (progress page)
   ================================================================ */
.dashboard-layout { display: grid; grid-template-columns: 290px 1fr; gap: 1.4rem; padding: 1.6rem 2rem; max-width: 1400px; margin: 0 auto; align-items: start; }
.dash-sidebar { display: flex; flex-direction: column; gap: 1rem; }
.dash-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r2); padding: 1.2rem; }
.dash-card h3 { font-family: var(--ff-serif); font-size: .93rem; font-weight: 700; color: var(--text); margin-bottom: .85rem; }
.profile-avatar { font-size: 2.8rem; text-align: center; margin-bottom: .45rem; }
.profile-name   { text-align: center; font-family: var(--ff-serif); font-size: 1.05rem; font-weight: 700; color: var(--text); }
.profile-level  { text-align: center; font-size: .76rem; color: var(--accent); font-weight: 600; margin-bottom: .95rem; }
.profile-stats  { display: flex; flex-direction: column; gap: .45rem; }
.ps-item { display: flex; justify-content: space-between; font-size: .78rem; padding: .32rem 0; border-bottom: 1px solid var(--border); }
.ps-item:last-child { border: none; }
.ps-label { color: var(--text2); }
.ps-val   { color: var(--text); font-weight: 600; }
.level-bar   { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; margin: .38rem 0 .22rem; }
.level-fill  { height: 100%; background: var(--accent); border-radius: 3px; transition: width .6s ease; }
.level-labels { display: flex; justify-content: space-between; font-size: .68rem; color: var(--text2); }
.history-list { display: flex; flex-direction: column; gap: .38rem; max-height: 230px; overflow-y: auto; }
.history-item { display: flex; align-items: center; gap: .55rem; padding: .42rem .58rem; background: var(--bg2); border-radius: 7px; font-size: .76rem; }
.hi-topic { flex: 1; color: var(--text2); }
.hi-time  { font-size: .68rem; color: var(--text2); opacity: .6; }
.hi-type.concept { color: var(--accent); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.hi-type.quiz    { color: var(--success); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.hi-type.code    { color: var(--warn); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.dash-main { display: flex; flex-direction: column; gap: 1.1rem; }
.analytics-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r2); padding: 1.2rem; }
.analytics-card h3 { font-family: var(--ff-serif); font-size: .93rem; font-weight: 700; color: var(--text); margin-bottom: .95rem; }
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: .45rem; }
.topic-mastery-card { padding: .62rem .72rem; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; }
.tm-name  { font-size: .76rem; font-weight: 600; color: var(--text); margin-bottom: .38rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-bar   { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.tm-fill  { height: 100%; border-radius: 2px; background: var(--accent); }
.tm-score { font-size: .66rem; color: var(--text2); margin-top: .22rem; text-align: right; }

/* hljs */
pre code.hljs, .hljs { background: var(--bg2) !important; font-family: var(--ff-mono) !important; font-size: .8rem !important; line-height: 1.6; }

/* animate */
.animate-in { animation: fadeUp .35s ease both; }

/* ================================================================
   PROFESSIONAL POLISH — v6 REFINEMENTS
   ================================================================ */

/* ── Stat cards: colored left accent border ──────────────────────── */
.stat-card {
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg, var(--bg3) 0%, var(--bg2) 100%);
}
.stat-card:nth-child(1) { border-left-color: var(--accent); }
.stat-card:nth-child(2) { border-left-color: var(--success); }
.stat-card:nth-child(3) { border-left-color: #7C3AED; }
.stat-card:nth-child(4) { border-left-color: #F59E0B; }
.stat-icon { font-size: 1.4rem; }
.stat-num  { font-size: 1.5rem; }

/* ── Feature cards: gradient left border ─────────────────────────── */
.feat-card {
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg, var(--bg3) 0%, var(--bg2) 100%);
}
.feat-card:nth-child(1) { border-left-color: var(--success); }
.feat-card:nth-child(2) { border-left-color: #EF4444; }
.feat-card:nth-child(3) { border-left-color: #7C3AED; }

/* ── Course card V2 thumbnails: patterns not big emojis ──────────── */
.cc-thumb {
  height: 130px;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 50%);
}
.cc-icon { font-size: 2.4rem; opacity: 0.85; }

.cc-body { padding: 1.1rem 1.2rem; gap: .45rem; }
.cc-title { font-size: .95rem; line-height: 1.35; }
.cc-desc { font-size: .76rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── CTA: gradient instead of flat ──────────────────────────────── */
.cc-cta {
  background: linear-gradient(135deg, var(--accent), #0099CC);
  font-size: .8rem; font-weight: 700; letter-spacing: .01em;
  border-radius: 0 0 var(--r2) var(--r2);
  padding: .65rem 1rem;
  transition: filter .18s, box-shadow .18s;
}
.cc-cta:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 16px rgba(0,212,255,0.25);
}
.cc-cta.enrolled {
  background: linear-gradient(135deg, var(--success), #059669);
}

/* ── Course card hover glow ──────────────────────────────────────── */
.course-card-v2:hover {
  box-shadow: 0 8px 32px rgba(0,212,255,0.12);
}

/* ── Filter row (search + dropdown) ──────────────────────────────── */
.filter-row {
  display: flex; gap: .65rem; align-items: center;
}
.filter-select {
  padding: .5rem .85rem; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-family: var(--ff-sans); font-size: .82rem;
  outline: none; transition: border-color .18s;
}
.filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.filter-select option { background: var(--bg3); }

/* ── Course overview section ─────────────────────────────────────── */
.course-overview {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem;
  margin-bottom: 2rem;
}
.co-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r2); overflow: hidden;
}
.co-card-header {
  padding: .75rem 1.1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--ff-serif); font-size: .88rem; font-weight: 700; color: var(--text);
}
.co-card-header .co-icon { font-size: 1rem; }
.co-card-body { padding: 1rem 1.1rem; }

/* What you'll learn */
.co-learn-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: .4rem;
}
.co-learn-item {
  display: flex; align-items: flex-start; gap: .5rem;
  font-size: .8rem; color: var(--text2); line-height: 1.5;
  padding: .35rem .5rem; border-radius: 6px;
}
.co-learn-item::before {
  content: '✓'; color: var(--accent); font-weight: 700; flex-shrink: 0; margin-top: .05rem;
}

/* Prerequisites */
.co-prereq-item {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; color: var(--text2); padding: .3rem 0;
  border-bottom: 1px solid var(--border);
}
.co-prereq-item:last-child { border-bottom: none; }
.co-prereq-item::before { content: '→'; color: var(--accent); font-weight: 700; }

/* Skills */
.co-skills {
  display: flex; flex-wrap: wrap; gap: .4rem;
}
.co-skill-tag {
  padding: .28rem .7rem; border-radius: 20px;
  background: var(--accent-glow); border: 1px solid var(--border2);
  color: var(--accent); font-size: .72rem; font-weight: 600;
}

/* Syllabus */
.co-syllabus-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .75rem; border-radius: 8px;
  background: var(--bg2); margin-bottom: .4rem;
  transition: all .14s;
}
.co-syllabus-item:hover { background: var(--bg4); }
.co-syllabus-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-glow); border: 1px solid var(--border2);
  color: var(--accent); font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.co-syllabus-info { flex: 1; }
.co-syllabus-info strong { display: block; font-size: .82rem; color: var(--text); font-weight: 600; }
.co-syllabus-info span { font-size: .7rem; color: var(--text2); }
.co-syllabus-dur { font-size: .7rem; color: var(--text2); flex-shrink: 0; }

/* ── Page header refinement ──────────────────────────────────────── */
.page-title {
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Empty state polish ──────────────────────────────────────────── */
.empty-courses {
  background: linear-gradient(135deg, var(--bg3), var(--bg2));
  border: 1px dashed var(--border2);
  border-radius: var(--r2);
  padding: 3rem 2rem;
}

/* ── Quick action cards hover ────────────────────────────────────── */
.qa-card {
  border-left: 3px solid transparent;
  transition: all .18s;
}
.qa-card:nth-child(1) { border-left-color: #7C3AED; }
.qa-card:nth-child(2) { border-left-color: #F59E0B; }
.qa-card:nth-child(3) { border-left-color: var(--accent); }
.qa-card:nth-child(4) { border-left-color: var(--success); }

/* ── Course grid large view ──────────────────────────────────────── */
.course-grid.large {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

@media (max-width: 700px) {
  .course-overview { grid-template-columns: 1fr; }
  .co-learn-grid   { grid-template-columns: 1fr; }
}


/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 960px) {
  .page-layout      { grid-template-columns: 1fr; }
  .code-panels      { grid-template-columns: 1fr; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .lecture-layout   { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .lec-sidebar { display: none; }
}
@media (max-width: 700px) {
  .stats-row  { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .page-wrap  { padding: 1rem 1rem 3rem; }
  .code-lab-header { padding: 1.1rem 1rem 0; }
  .code-panels { padding: 1rem; }
  .learn-main { padding: 1.1rem; }
  .page-title { font-size: 1.45rem; }
  .navbar     { padding: 0 1rem; }
  .accent-dots { display: none; }
}

/* ================================================================
   DASHBOARD V4 — Reference-aligned UI
   ================================================================ */

/* ── Main layout: left content + right sidebar ───────────────────── */
.dash-v4 { max-width:1360px; margin:0 auto; padding:1.5rem 2rem 3rem; }
.dash-v4-grid {
  display:grid; grid-template-columns:1fr 340px; gap:1.5rem; align-items:start;
}
.dash-v4-main { display:flex; flex-direction:column; gap:1.3rem; }
.dash-v4-side { display:flex; flex-direction:column; gap:1.3rem; }

/* ── Dash header row ─────────────────────────────────────────────── */
.dash-header-row {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:.2rem;
}
.dash-header-row h1 {
  font-family:var(--ff-serif); font-size:1.65rem; font-weight:800; color:var(--text);
}
.dash-search {
  display:flex; align-items:center; gap:.5rem;
  background:var(--bg3); border:1px solid var(--border); border-radius:28px;
  padding:.4rem .5rem .4rem 1rem; min-width:220px;
}
.dash-search input {
  background:none; border:none; outline:none; color:var(--text);
  font-family:var(--ff-sans); font-size:.82rem; flex:1;
}
.dash-search input::placeholder { color:var(--text2); }
.dash-search-btn {
  width:32px; height:32px; border-radius:50%; border:none;
  background:var(--accent); color:#fff; font-size:.9rem; cursor:pointer;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
  transition:filter .15s;
}
.dash-search-btn:hover { filter:brightness(1.12); }

/* ── 4 Stat icon cards row ───────────────────────────────────────── */
.dash-stat-icons {
  display:grid; grid-template-columns:repeat(4,1fr); gap:1rem;
}
.dsi-card {
  background:var(--bg3); border:1px solid var(--border); border-radius:16px;
  padding:1.2rem; text-align:center; transition:transform .18s, box-shadow .18s;
}
.dsi-card:hover { transform:translateY(-3px); box-shadow:0 8px 30px rgba(0,0,0,.25); }
.dsi-icon {
  width:52px; height:52px; border-radius:14px; margin:0 auto .65rem;
  display:flex; align-items:center; justify-content:center; font-size:1.4rem;
}
.dsi-icon.blue    { background:rgba(99,102,241,.15); color:#818CF8; }
.dsi-icon.pink    { background:rgba(236,72,153,.15); color:#F472B6; }
.dsi-icon.cyan    { background:rgba(0,212,255,.15); color:#00D4FF; }
.dsi-icon.orange  { background:rgba(245,158,11,.15); color:#F59E0B; }
.dsi-label { font-size:.72rem; color:var(--text2); margin-bottom:.15rem; font-weight:500; }
.dsi-value { font-family:var(--ff-serif); font-size:1.55rem; font-weight:800; color:var(--text); }

/* ── Statistics + Course Activities row ──────────────────────────── */
.dash-charts-row {
  display:grid; grid-template-columns:1fr 1fr; gap:1.2rem;
}
.dash-chart-card {
  background:var(--bg3); border:1px solid var(--border); border-radius:16px;
  padding:1.2rem 1.4rem;
}
.dash-chart-head {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:.85rem;
}
.dash-chart-head h3 {
  font-family:var(--ff-serif); font-size:.95rem; font-weight:700; color:var(--text);
}
.dash-chart-head .sort-pill {
  display:flex; align-items:center; gap:.35rem;
  font-size:.72rem; color:var(--text2); padding:.25rem .65rem;
  border-radius:20px; background:var(--bg2); border:1px solid var(--border);
}
.dash-chart-head .sort-pill select {
  background:none; border:none; color:var(--accent); font-family:var(--ff-sans);
  font-size:.72rem; font-weight:600; cursor:pointer; outline:none;
}
.dash-chart-head .sort-pill select option { background:var(--bg3); }

/* Donut chart */
.donut-wrap {
  display:flex; align-items:center; justify-content:center; gap:1.5rem;
  padding:.5rem 0;
}
.donut-legend { display:flex; flex-direction:column; gap:.5rem; }
.donut-legend-item {
  display:flex; align-items:center; gap:.45rem; font-size:.76rem; color:var(--text2);
}
.donut-dot {
  width:10px; height:10px; border-radius:50%; flex-shrink:0;
}

/* ── Database / Enrolled courses table ───────────────────────────── */
.dash-table-card {
  background:var(--bg3); border:1px solid var(--border); border-radius:16px;
  overflow:hidden;
}
.dash-table-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:.85rem 1.3rem; border-bottom:1px solid var(--border);
}
.dash-table-head h3 {
  font-family:var(--ff-serif); font-size:.95rem; font-weight:700; color:var(--text);
}
.dash-table-tabs { display:flex; gap:0; }
.dash-table-tab {
  padding:.35rem .85rem; font-size:.76rem; font-weight:600; cursor:pointer;
  color:var(--text2); border-bottom:2px solid transparent; transition:all .14s;
  background:none; border-top:none; border-left:none; border-right:none;
  font-family:var(--ff-sans);
}
.dash-table-tab:hover { color:var(--text); }
.dash-table-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.dash-tbl {
  width:100%; border-collapse:collapse; font-size:.82rem;
}
.dash-tbl thead { background:var(--bg2); }
.dash-tbl th {
  padding:.6rem 1rem; text-align:left; font-size:.7rem; font-weight:700;
  color:var(--text2); text-transform:uppercase; letter-spacing:.04em;
}
.dash-tbl td {
  padding:.7rem 1rem; border-bottom:1px solid var(--border);
  color:var(--text2); vertical-align:middle;
}
.dash-tbl tr:last-child td { border-bottom:none; }
.dash-tbl tr:hover td { background:var(--bg2); }
.dash-tbl-name-cell { display:flex; align-items:center; gap:.6rem; }
.dash-tbl-avatar {
  width:30px; height:30px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:.7rem; font-weight:700; color:#fff; flex-shrink:0;
  background:var(--accent);
}
.dash-tbl-name { color:var(--text); font-weight:600; font-size:.82rem; }
.grade-badge {
  display:inline-block; padding:.15rem .5rem; border-radius:4px;
  font-size:.7rem; font-weight:700;
}
.grade-badge.excellent { color:var(--success); }
.grade-badge.average { color:var(--warn); }
.grade-badge.poor { color:var(--danger); }
.pass-badge {
  display:inline-block; padding:.18rem .55rem; border-radius:20px;
  font-size:.65rem; font-weight:700;
}
.pass-badge.pass { background:rgba(16,185,129,.12); color:var(--success); }
.pass-badge.fail { background:rgba(239,68,68,.1); color:var(--danger); }

/* ── Calendar widget ─────────────────────────────────────────────── */
.dash-calendar-card {
  background:var(--bg3); border:1px solid var(--border); border-radius:16px;
  padding:1.1rem;
}
.cal-header {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:.75rem;
}
.cal-header h3 {
  font-family:var(--ff-serif); font-size:.92rem; font-weight:700; color:var(--text);
}
.cal-nav { display:flex; gap:.35rem; }
.cal-nav-btn {
  width:26px; height:26px; border-radius:50%; border:1px solid var(--border);
  background:var(--bg2); color:var(--text2); cursor:pointer;
  display:flex; align-items:center; justify-content:center; font-size:.7rem;
  transition:all .14s;
}
.cal-nav-btn:hover { border-color:var(--accent); color:var(--accent); }
.cal-grid {
  display:grid; grid-template-columns:repeat(7,1fr); gap:0;
  text-align:center; font-size:.75rem;
}
.cal-day-name {
  padding:.35rem .15rem; color:var(--text2); font-weight:600; font-size:.68rem;
}
.cal-day {
  padding:.4rem .15rem; color:var(--text2); border-radius:50%;
  cursor:default; position:relative; font-size:.78rem;
}
.cal-day.today {
  background:var(--accent); color:#fff; font-weight:700; border-radius:50%;
  width:28px; height:28px; line-height:28px; margin:0 auto;
}
.cal-day.empty { visibility:hidden; }
.cal-events {
  display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.75rem;
  padding-top:.75rem; border-top:1px solid var(--border);
}
.cal-event {
  display:flex; align-items:center; gap:.4rem; font-size:.72rem; color:var(--text2);
}
.cal-event-avatar {
  width:24px; height:24px; border-radius:50%; background:var(--accent-glow);
  border:1.5px solid var(--accent); display:flex; align-items:center;
  justify-content:center; font-size:.55rem; font-weight:700; color:var(--accent);
}

/* ── Notice Board ────────────────────────────────────────────────── */
.dash-notice-card {
  background:var(--bg3); border:1px solid var(--border); border-radius:16px;
  overflow:hidden;
}
.dash-notice-head {
  padding:.75rem 1.1rem; border-bottom:1px solid var(--border);
  font-family:var(--ff-serif); font-size:.92rem; font-weight:700; color:var(--text);
}
.notice-list { padding:.5rem; }
.notice-item {
  display:flex; gap:.7rem; padding:.65rem .6rem; border-radius:10px;
  transition:background .14s; cursor:default;
}
.notice-item:hover { background:var(--bg2); }
.notice-thumb {
  width:44px; height:44px; border-radius:10px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:1.2rem;
}
.notice-info { flex:1; min-width:0; }
.notice-title {
  font-size:.8rem; font-weight:600; color:var(--text); line-height:1.35;
  display:-webkit-box; -webkit-line-clamp:2; line-clamp:2;
  -webkit-box-orient:vertical; overflow:hidden;
}
.notice-by { font-size:.68rem; color:var(--text2); margin-top:.15rem; }

/* ── User profile card (sidebar) ─────────────────────────────────── */
.dash-user-card {
  background:var(--bg3); border:1px solid var(--border); border-radius:16px;
  padding:1.1rem; display:flex; align-items:center; gap:.65rem;
}
.dash-user-avatar {
  width:38px; height:38px; border-radius:50%;
  background:var(--accent-glow); border:2px solid var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:.85rem; font-weight:700; color:var(--accent); flex-shrink:0;
}
.dash-user-info { flex:1; }
.dash-user-name { font-size:.88rem; font-weight:700; color:var(--text); }
.dash-user-role { font-size:.7rem; color:var(--text2); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width:1100px) {
  .dash-v4-grid { grid-template-columns:1fr; }
  .dash-v4-side { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
}
@media (max-width:768px) {
  .dash-v4 { padding:1rem 1rem 2rem; }
  .dash-stat-icons { grid-template-columns:1fr 1fr; }
  .dash-charts-row { grid-template-columns:1fr; }
  .dash-v4-side { grid-template-columns:1fr; }
  .dash-header-row { flex-direction:column; gap:.7rem; align-items:flex-start; }
}

/* ================================================================
   COURSE VIEW V2 — Section/Chapter Interface
   ================================================================ */

/* ── Tabs (Details Content, Report Issue, Discussion) ────────────── */
.cv2-tabs {
  display:flex; gap:0; border-bottom:2px solid var(--border); margin-bottom:1.4rem;
}
.cv2-tab {
  padding:.55rem 1.2rem; font-size:.82rem; font-weight:600;
  color:var(--text2); cursor:pointer; border-bottom:2px solid transparent;
  margin-bottom:-2px; transition:all .15s; background:none; border-top:none;
  border-left:none; border-right:none; font-family:var(--ff-sans);
}
.cv2-tab:hover { color:var(--text); }
.cv2-tab.active { color:var(--text); border-bottom-color:var(--text); font-weight:700; }

/* ── Course meta bar ─────────────────────────────────────────────── */
.cv2-meta-bar {
  display:flex; gap:1.5rem; flex-wrap:wrap; margin-bottom:1.4rem;
  padding:1rem 1.3rem; background:var(--bg3); border:1px solid var(--border);
  border-radius:14px;
}
.cv2-meta-item {
  display:flex; align-items:center; gap:.45rem; font-size:.82rem; color:var(--text2);
}
.cv2-meta-item .cv2-meta-icon { font-size:1rem; }
.cv2-meta-item strong { color:var(--text); font-weight:600; }
.cv2-meta-divider {
  width:1px; background:var(--border); align-self:stretch; margin:0 .25rem;
}

/* ── Trainer / Instructor section ────────────────────────────────── */
.cv2-trainers {
  margin-bottom:1.4rem; padding:1.2rem 1.3rem;
  background:var(--bg3); border:1px solid var(--border); border-radius:14px;
}
.cv2-trainers-head {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:1rem;
}
.cv2-trainers-head h3 {
  font-family:var(--ff-serif); font-size:.95rem; font-weight:700; color:var(--text);
}
.cv2-add-trainer {
  display:flex; align-items:center; gap:.3rem; padding:.3rem .75rem;
  border-radius:8px; border:1px solid var(--border); background:var(--bg2);
  color:var(--text2); font-size:.75rem; font-weight:600; cursor:default;
}
.cv2-trainer-grid { display:flex; flex-wrap:wrap; gap:1.2rem; }
.cv2-trainer-card { display:flex; align-items:center; gap:.65rem; min-width:200px; }
.cv2-trainer-avatar {
  width:42px; height:42px; border-radius:50%;
  background:var(--accent-glow); border:2px solid var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:.9rem; font-weight:700; color:var(--accent); flex-shrink:0;
}
.cv2-trainer-info { }
.cv2-trainer-name { font-size:.85rem; font-weight:700; color:var(--text); }
.cv2-trainer-role { font-size:.7rem; color:var(--text2); }
.cv2-trainer-badge {
  display:inline-block; margin-top:.2rem; padding:.12rem .5rem; border-radius:4px;
  font-size:.62rem; font-weight:700; background:rgba(0,212,255,.1);
  color:var(--accent); border:1px solid rgba(0,212,255,.2);
}

/* ── Page Content — Sections & Chapters ──────────────────────────── */
.cv2-content-section {
  margin-bottom:1.4rem; padding:1.2rem 1.3rem;
  background:var(--bg3); border:1px solid var(--border); border-radius:14px;
}
.cv2-content-head {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:1rem;
}
.cv2-content-head h3 {
  font-family:var(--ff-serif); font-size:.95rem; font-weight:700; color:var(--text);
}
.cv2-content-head .sub {
  font-size:.72rem; color:var(--text2); font-weight:400; margin-left:.5rem;
}
.cv2-add-section {
  display:flex; align-items:center; gap:.3rem; padding:.3rem .75rem;
  border-radius:8px; border:1px solid var(--border); background:var(--bg2);
  color:var(--text2); font-size:.75rem; font-weight:600; cursor:default;
}

/* Section accordion */
.cv2-section-item {
  border:1px solid var(--border); border-radius:10px; margin-bottom:.6rem;
  overflow:hidden;
}
.cv2-section-header {
  display:flex; align-items:center; gap:.6rem; padding:.7rem 1rem;
  cursor:pointer; transition:background .14s; user-select:none;
}
.cv2-section-header:hover { background:var(--bg2); }
.cv2-section-drag {
  color:var(--text2); font-size:.8rem; cursor:grab; flex-shrink:0; opacity:.5;
}
.cv2-section-title { flex:1; font-size:.85rem; font-weight:600; color:var(--text); }
.cv2-section-count { font-size:.72rem; color:var(--text2); }
.cv2-section-toggle {
  width:22px; height:22px; display:flex; align-items:center; justify-content:center;
  color:var(--text2); font-size:.8rem; transition:transform .2s; cursor:pointer;
}
.cv2-section-toggle.open { transform:rotate(180deg); }

/* Chapter items inside section */
.cv2-chapter-list { padding:.2rem .5rem .5rem 1.2rem; display:none; }
.cv2-chapter-list.open { display:block; }
.cv2-chapter-item {
  display:flex; align-items:center; gap:.6rem; padding:.55rem .75rem;
  border-radius:8px; margin-bottom:.3rem; transition:background .14s;
  cursor:pointer;
}
.cv2-chapter-item:hover { background:var(--bg2); }
.cv2-chapter-drag { color:var(--text2); font-size:.7rem; opacity:.4; flex-shrink:0; }
.cv2-chapter-icon {
  width:24px; height:24px; border-radius:6px; background:var(--bg2);
  border:1px solid var(--border); display:flex; align-items:center;
  justify-content:center; font-size:.65rem; color:var(--text2); flex-shrink:0;
}
.cv2-chapter-icon.done { background:var(--success); border-color:var(--success); color:#fff; }
.cv2-chapter-title { flex:1; font-size:.82rem; color:var(--text); }
.cv2-chapter-item.done .cv2-chapter-title { color:var(--text2); text-decoration:line-through; }

.cv2-add-chapter {
  display:flex; align-items:center; gap:.3rem; padding:.4rem .75rem;
  margin-top:.3rem; font-size:.75rem; color:var(--accent); font-weight:600;
  cursor:default;
}
