/* STAT-157 交互式深度学习学习系统 - 样式 */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --sidebar-bg: #1a1f2e;
  --sidebar-text: #aab3c5;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

#app { display: flex; min-height: 100vh; }

/* ===== 侧边栏 ===== */
#sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 20px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand h1 { font-size: 17px; color: #fff; font-weight: 600; }
.brand p { font-size: 12px; opacity: .7; }

#module-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-module { margin-bottom: 4px; }
.nav-module-title {
  padding: 8px 20px; font-size: 12px; font-weight: 600;
  color: #6b7a94; text-transform: uppercase; letter-spacing: .5px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer; font-size: 13.5px;
  transition: background .15s; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(59,130,246,.15); border-left-color: var(--accent); color: #fff; }
.nav-item .nav-num { font-size: 11px; color: #6b7a94; min-width: 22px; }
.nav-item .nav-check { margin-left: auto; font-size: 12px; color: var(--green); }
.nav-item.done .nav-num { color: var(--green); }

.progress-card { margin: 10px 20px 0; padding: 14px; background: rgba(255,255,255,.06); border-radius: var(--radius); }
.progress-head { display: flex; justify-content: space-between; font-size: 13px; color: #cdd5e0; margin-bottom: 8px; }
.progress-bar { height: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #8b5cf6); transition: width .4s; border-radius: 3px; }
.progress-detail { font-size: 11.5px; color: #7d8aa3; margin-top: 8px; line-height: 1.6; }

/* ===== 主区域 ===== */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
#breadcrumb { font-size: 13px; color: var(--text-light); }
#content { padding: 28px; max-width: 980px; width: 100%; margin: 0 auto; }

/* ===== 首页 ===== */
.hero { background: linear-gradient(135deg, #1e3a8a, #3b82f6 60%, #8b5cf6); color: #fff; border-radius: 16px; padding: 40px; margin-bottom: 24px; }
.hero h2 { font-size: 26px; margin-bottom: 10px; }
.hero p { opacity: .9; font-size: 14.5px; max-width: 640px; }
.hero .hero-stats { display: flex; gap: 32px; margin-top: 22px; }
.hero .stat { text-align: center; }
.hero .stat b { display: block; font-size: 24px; }
.hero .stat span { font-size: 12.5px; opacity: .8; }

.section-title { font-size: 18px; font-weight: 600; margin: 28px 0 14px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.module-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.module-card h3 { font-size: 15.5px; margin-bottom: 6px; }
.module-card p { font-size: 13px; color: var(--text-light); }
.module-card .card-tag { display: inline-block; font-size: 11px; background: #eff6ff; color: var(--accent-dark); padding: 2px 8px; border-radius: 10px; margin-top: 8px; }

/* ===== 讲义页面 ===== */
.lecture-header { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; margin-bottom: 20px; }
.lecture-header .lec-no { font-size: 12.5px; color: var(--accent); font-weight: 600; letter-spacing: 1px; }
.lecture-header h2 { font-size: 22px; margin: 6px 0 8px; }
.lecture-header .lec-desc { color: var(--text-light); font-size: 14px; }
.lec-meta { display: flex; gap: 18px; margin-top: 12px; font-size: 12.5px; color: var(--text-light); }
.lec-meta .done-badge { color: var(--green); font-weight: 600; }

.lecture-body { display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.panel h3 { font-size: 16.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel h3 .panel-icon { font-size: 18px; }
.panel h4 { font-size: 14.5px; margin: 18px 0 8px; color: var(--accent-dark); }
.panel p { margin-bottom: 10px; }
.panel ul, .panel ol { margin: 0 0 12px 22px; }
.panel li { margin-bottom: 6px; }

.formula-block { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px; margin: 12px 0; overflow-x: auto; text-align: center; }

.code-block {
  background: #f1f5f9; color: #1f2937;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; margin: 12px 0;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12.5px; line-height: 1.6;
  overflow-x: auto; white-space: pre;
}

.key-point { border-left: 4px solid var(--accent); background: #f0f6ff; padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 10px 0; font-size: 14px; }
.key-point.warn { border-left-color: var(--orange); background: #fffbeb; }
.key-point.danger { border-left-color: var(--red); background: #fef2f2; }

/* ===== 可视化 ===== */
.viz-box { margin: 16px 0; }
.viz-box .viz-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.viz-canvas-wrap { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.viz-canvas-wrap canvas { display: block; width: 100%; }
.viz-controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 10px; font-size: 13px; }
.viz-controls label { display: flex; align-items: center; gap: 6px; color: var(--text-light); }
.viz-controls input[type=range] { width: 120px; accent-color: var(--accent); }
.viz-controls input[type=number] { width: 64px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.viz-controls select { padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; }
.btn { padding: 6px 16px; border: none; border-radius: 8px; font-size: 13px; cursor: pointer; background: var(--accent); color: #fff; transition: background .15s; }
.btn:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--text-light); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f3f4f6; color: var(--text); }
.btn-sm { padding: 4px 12px; font-size: 12.5px; }
.viz-note { font-size: 12.5px; color: var(--text-light); margin-top: 8px; }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-light); margin-top: 8px; }
.viz-legend .lg { display: flex; align-items: center; gap: 5px; }
.viz-legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ===== 测验 ===== */
.quiz-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.quiz-q { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px dashed var(--border); }
.quiz-q:last-child { border-bottom: none; }
.quiz-q .q-text { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.quiz-q .q-text .q-no { color: var(--accent); margin-right: 6px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 14px; transition: all .15s; background: #fff;
}
.quiz-option:hover { border-color: var(--accent); background: #f5f9ff; }
.quiz-option.selected { border-color: var(--accent); background: #eff6ff; font-weight: 500; }
.quiz-option.correct { border-color: var(--green); background: #ecfdf5; color: #065f46; }
.quiz-option.wrong { border-color: var(--red); background: #fef2f2; color: #991b1b; }
.quiz-result { font-size: 13.5px; margin-top: 10px; padding: 10px 14px; border-radius: 8px; display: none; }
.quiz-result.show { display: block; }
.quiz-result.pass { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.quiz-result.fail { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.quiz-explain { margin-top: 8px; font-size: 13px; color: var(--text-light); }
.quiz-submit-row { text-align: center; margin-top: 10px; }

/* ===== 导航按钮 ===== */
.lecture-nav { display: flex; justify-content: space-between; margin-top: 24px; gap: 12px; }
.lecture-nav .btn { flex: 1; padding: 12px; font-size: 14px; }

/* ===== 响应式 ===== */
@media (max-width: 860px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; min-width: 0; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
  .brand { border-bottom: none; padding: 12px 16px; }
  #module-nav { display: none; }
  .progress-card { display: none; }
  #content { padding: 16px; }
  .hero { padding: 24px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
