/* ============================================================
   课堂讨论与AI问题聚类预警系统 — 全局样式
   设计原则：克制、不花哨，适合教室投影；体积小、加载快（无外部字体/库）
   ============================================================ */

:root {
  --bg: #1b222c;
  --panel: #232c3a;
  --panel-2: #2a3544;
  --line: #3a4657;
  --text: #e7ecf3;
  --muted: #9aa9bc;
  --accent: #5f8db5;
  --accent-2: #85aecf;
  --ok: #5f9e7c;
  --warn: #c25f54;
  --warn-bg: rgba(194, 95, 84, 0.13);
  --radius: 10px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
          "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }

/* ---------- 布局 ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 16px; }
.page-narrow { max-width: 520px; margin: 0 auto; padding: 24px 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px 20px;
}
.topbar .brand { font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.topbar .spacer { flex: 1; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.card h3 { font-size: 15px; margin-bottom: 10px; color: var(--text); font-weight: 600; }
.card .desc { color: var(--muted); font-size: 13px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 8px 18px; border-radius: 8px; font-size: 14px; cursor: pointer;
  font-family: var(--font); transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: #32405a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #6d9dc2; }
.btn-danger { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-danger:hover { background: #d47064; }
.btn-ghost { background: transparent; }
.btn-lg { padding: 10px 26px; font-size: 15px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.input, .textarea {
  width: 100%; background: #1e2631; border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); padding: 10px 12px;
  font-size: 15px; font-family: var(--font); outline: none;
  transition: border-color .15s;
}
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 96px; resize: vertical; }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }

/* 学号后两位：加粗提示 */
.id2-hint b { color: var(--accent-2); font-weight: 700; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.badge-ok { color: #b7e0c9; border-color: rgba(95, 158, 124, .55); background: rgba(95, 158, 124, .12); }
.badge-pause { color: #e3cf9a; border-color: rgba(206, 172, 90, .55); background: rgba(206, 172, 90, .12); }
.badge-warn { color: #f0b3ab; border-color: rgba(194, 95, 84, .6); background: var(--warn-bg); }
.badge-off { color: #b9b9b9; background: #3a3a3a; border-color: #555; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 14, 20, .66);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.overlay.show { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; box-shadow: var(--shadow); width: 420px; max-width: 92vw;
  max-height: 88vh; overflow: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 12px; }

/* 预警弹窗：占据约 60% 屏幕，居中 */
.modal-alert {
  width: 60vw; height: 60vh; max-width: 60vw; max-height: 60vh;
  display: flex; flex-direction: column;
  border-color: rgba(194, 95, 84, .65);
}
.modal-alert h3 { color: #f0b3ab; font-size: 22px; }
.modal-alert .alert-body { flex: 1; overflow: auto; margin: 8px 0 16px; }
.modal-alert .alert-label { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal-alert .alert-summary { color: var(--muted); margin-bottom: 14px; }
.modal-alert .alert-samples { list-style: none; }
.modal-alert .alert-samples li {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px;
}

/* ---------- 通知 ---------- */
.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 22px; border-radius: 8px; z-index: 300; box-shadow: var(--shadow);
  font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none;
  max-width: 80vw;
}
.toast.show { opacity: 1; }
.toast.error { border-color: var(--warn); color: #f0b3ab; }
.toast.ok { border-color: rgba(95, 158, 124, .6); color: #b7e0c9; }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px;
}

/* ---------- 关闭页 ---------- */
.closed-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.closed-box { text-align: center; }
.closed-box .icon { font-size: 44px; margin-bottom: 10px; }
.closed-box h1 { font-size: 22px; margin-bottom: 8px; }
.closed-box p { color: var(--muted); }
