/* 学校管理系统 · 全局样式（迁移自原型） */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5; color: #1a1a2e; min-height: 100vh;
}

/* ===== 顶部导航 ===== */
.topbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff; padding: 14px 24px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(30,58,138,.3);
}
.logo { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.logo .icon { background: rgba(255,255,255,.2); border-radius: 8px; padding: 4px 8px; font-size: 20px; }
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top-nav-link { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.85); text-decoration: none; padding: 6px 12px; border-radius: 8px; transition: all .15s; }
.top-nav-link:hover { background: rgba(255,255,255,.18); color: #fff; }
.user-chip { font-size: 13px; background: rgba(255,255,255,.15); padding: 6px 14px; border-radius: 20px; }
.user-chip a { color: #fff; text-decoration: none; margin-left: 10px; opacity: .85; }
.user-chip a:hover { opacity: 1; text-decoration: underline; }

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.page-sub { color: #6b7280; font-size: 14px; margin-bottom: 24px; }
.warn-box { background:#fffbeb; border:1px solid #fde68a; color:#92400e; border-radius:10px; padding:12px 14px; font-size:14px; }

/* ===== 卡片 ===== */
.card {
  background: #fff; border-radius: 16px; padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 18px;
  border: 1px solid #eef0f4;
}

/* ===== 作业列表 ===== */
.hw-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px; border: 1px solid #e5e7eb; border-radius: 12px;
  margin-bottom: 12px; cursor: pointer; transition: all .2s; text-decoration: none; color: inherit;
}
.hw-item:hover { border-color: #2563eb; box-shadow: 0 4px 16px rgba(37,99,235,.12); transform: translateY(-1px); }
.hw-left { display: flex; gap: 14px; align-items: center; }
.hw-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: #fef3c7; }
.hw-icon.graded { background: #d1fae5; }
.hw-icon.overdue { background: #fee2e2; }
.hw-name { font-weight: 600; font-size: 15px; }
.hw-meta { font-size: 12.5px; color: #6b7280; margin-top: 3px; }
.status-badge { font-size: 12.5px; padding: 5px 12px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.status-badge.pending { background: #fef3c7; color: #b45309; }
.status-badge.graded { background: #d1fae5; color: #047857; }
.status-badge.overdue { background: #fee2e2; color: #b91c1c; }
.mode-tag { font-size: 11px; font-weight: 600; background: #ede9fe; color: #6d28d9; border-radius: 6px; padding: 2px 7px; margin-left: 6px; vertical-align: 2px; }
.dl-link { color: #2563eb; cursor: pointer; text-decoration: underline; font-weight: 600; }
.dl-link:hover { color: #1d4ed8; }

/* ===== 答题 ===== */
.progress-bar { background: #e5e7eb; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 22px; }
.progress-fill { background: linear-gradient(90deg,#2563eb,#16a34a); height: 100%; border-radius: 4px; }
.q-num { font-size: 13px; color: #2563eb; font-weight: 700; margin-bottom: 8px; }
.q-type-tag { font-size: 11px; background: #eff6ff; color: #2563eb; padding: 3px 10px; border-radius: 12px; margin-left: 8px; }
.q-text { font-size: 16.5px; line-height: 1.65; margin-bottom: 18px; font-weight: 500; }
.option {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border: 2px solid #e5e7eb; border-radius: 12px; margin-bottom: 10px;
  cursor: pointer; transition: all .15s; font-size: 15px;
}
.option:hover { border-color: #93c5fd; background: #f8faff; }
.option.selected { border-color: #2563eb; background: #eff6ff; }
.option input { display: none; }
.option .opt-label {
  width: 30px; height: 30px; border-radius: 50%; background: #f3f4f6;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #6b7280; flex-shrink: 0;
}
.option.selected .opt-label { background: #2563eb; color: #fff; }
.fill-input {
  border: none; border-bottom: 3px solid #2563eb;
  font-size: 17px; padding: 4px 8px; text-align: center; outline: none;
  background: #eff6ff; border-radius: 6px 6px 0 0; font-family: inherit; min-width: 120px;
}

.btn {
  border: none; border-radius: 12px; padding: 13px 32px; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: all .2s; font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg,#2563eb,#1d4ed8); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,99,235,.35); }
.btn-ghost { background: #f3f4f6; color: #374151; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 4px 0 18px; padding: 14px 16px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; }
.fb-label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: #374151; }
.fb-select { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; min-width: 160px; background: #fff; }
.btn-success { background: linear-gradient(135deg,#16a34a,#15803d); color: #fff; }
.btn-warn { background: linear-gradient(135deg,#f59e0b,#d97706); color: #fff; border: 1px solid #f59e0b; }
.btn-warn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(217,119,6,.35); }

/* ===== 结果页 ===== */
.score-hero { text-align: center; padding: 30px 0 10px; }
.score-circle {
  width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
}
.score-inner {
  width: 96px; height: 96px; border-radius: 50%; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-val { font-size: 34px; font-weight: 800; }
.score-total { font-size: 13px; color: #9ca3af; }
.score-label { font-size: 15px; color: #374151; font-weight: 600; }

.result-item { padding: 18px; border-radius: 12px; margin-bottom: 12px; border: 1.5px solid; }
.result-item.correct { background: #f0fdf4; border-color: #bbf7d0; }
.result-item.wrong { background: #fef2f2; border-color: #fecaca; }
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
.result-tag { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 12px; white-space: nowrap; }
.result-tag.correct { background: #dcfce7; color: #15803d; }
.result-tag.wrong { background: #fee2e2; color: #b91c1c; }
.result-q { font-size: 14.5px; line-height: 1.6; color: #374151; }
.result-ans { font-size: 13.5px; margin-top: 6px; color: #6b7280; }

/* ===== 教师看板 ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-box { background: #fff; border-radius: 14px; padding: 20px; text-align: center; border: 1px solid #eef0f4; }
.stat-num { font-size: 30px; font-weight: 800; }
.stat-num.blue { color: #2563eb; } .stat-num.green { color: #16a34a; }
.stat-num.orange { color: #ea580c; } .stat-num.purple { color: #7c3aed; }
.stat-label { font-size: 13px; color: #6b7280; margin-top: 4px; }

table.grade-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grade-table th { text-align: left; padding: 10px 12px; background: #f8fafc; color: #475569; font-weight: 600; border-bottom: 2px solid #e2e8f0; }
.grade-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; }
.grade-table tr:hover td { background: #f8faff; }
.grade-badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.gb-a { background: #dcfce7; color: #15803d; } .gb-b { background: #dbeafe; color: #1d4ed8; }
.gb-c { background: #fef3c7; color: #b45309; } .gb-d { background: #fee2e2; color: #b91c1c; }

.wrong-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.wrong-text { flex: 1; font-size: 13.5px; }
.wrong-pct-wrap { width: 180px; background: #f1f5f9; border-radius: 8px; height: 10px; overflow: hidden; }
.wrong-pct { height: 100%; border-radius: 8px; background: linear-gradient(90deg,#f87171,#dc2626); }
.wrong-pct-num { font-size: 12.5px; font-weight: 700; color: #dc2626; width: 42px; text-align: right; }

.section-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.section-title .dot { width: 6px; height: 18px; background: #2563eb; border-radius: 3px; }

.nav-back { color: #2563eb; cursor: pointer; font-size: 14px; margin-bottom: 14px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
.nav-back:hover { text-decoration: underline; }

/* ===== 登录 ===== */
.login-wrap { max-width: 420px; margin: 40px auto; }
.login-role { display: flex; background: #f3f4f6; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.login-role button {
  flex: 1; border: none; padding: 10px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; background: transparent; color: #6b7280; font-family: inherit;
}
.login-role button.active { background: #fff; color: #1e3a8a; }
.form-label { font-size: 13px; color: #374151; font-weight: 600; display: block; margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  font-size: 15px; outline: none; transition: border .2s; font-family: inherit;
}
.form-input:focus { border-color: #2563eb; }
.form-row { margin-bottom: 16px; }
.error-box { background: #fee2e2; color: #b91c1c; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.hint-box { margin-top: 18px; padding: 10px 14px; background: #eff6ff; border-radius: 10px; font-size: 12.5px; color: #1e40af; line-height: 1.7; }

/* ===== 出题页 ===== */
.q-editor { border: 2px dashed #cbd5e1; border-radius: 12px; padding: 18px; margin-bottom: 14px; background: #fafbfc; }
.q-editor .opt-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.opt-letter { width: 28px; height: 28px; border-radius: 50%; background: #e5e7eb; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #475569; flex-shrink: 0; }
.mini-btn { border: none; background: #fee2e2; color: #b91c1c; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 12px; font-weight: 600; }
.add-btn { border: 1.5px dashed #93c5fd; background: #f8faff; color: #2563eb; border-radius: 12px; padding: 12px; width: 100%; cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit; }
.add-btn:hover { background: #eff6ff; }

@media (max-width: 640px) {
  .container { padding: 14px 10px; }
  .card { padding: 16px; }
  .topbar { padding: 12px 14px; }
  .user-chip { font-size: 12px; }
}

/* ===== 选课面板（我的教学班） ===== */
.group-label { font-weight:600; color:#1f2937; margin-top:10px; }
.subj-block { margin:8px 0 4px; }
.subj-name { font-weight:500; color:#374151; margin-bottom:6px; }
.opt-row { display:flex; flex-wrap:wrap; gap:10px; }
.opt {
  display:inline-flex; align-items:center; gap:7px; cursor:pointer;
  border:1px solid #d1d5db; border-radius:999px; padding:7px 14px; font-size:14px;
  background:#fff; transition:all .12s;
}
.opt:hover { border-color:#6366f1; }
.opt input { accent-color:#4f46e5; }
.opt-on { background:#eef2ff; border-color:#6366f1; color:#3730a3; font-weight:500; }
.success-box {
  background:#ecfdf5; border:1px solid #a7f3d0; color:#065f46;
  border-radius:10px; padding:10px 14px; font-size:14px;
}

/* ===== 顶栏学期切换器 ===== */
.term-switch { display:flex; align-items:center; gap:6px; margin-left:auto; padding:0 12px; }
.ts-label { font-size:12px; color:#6b7280; }
.term-select { padding:6px 8px; border:1px solid #d1d5db; border-radius:8px; font-size:13px; background:#fff; cursor:pointer; }

/* ============================================================
   响应式导航：桌面左侧固定侧栏 + 手机底部 Tab + 抽屉
   ============================================================ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 232px;
  background: linear-gradient(180deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff; display: flex; flex-direction: column;
  padding: 16px 12px; z-index: 200; box-shadow: 2px 0 16px rgba(30,58,138,.25);
}
.sb-brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 14px; font-weight: 700; font-size: 16px; }
.sb-logo { background: rgba(255,255,255,.2); border-radius: 9px; padding: 5px 8px; font-size: 18px; }
.sb-title { white-space: nowrap; }
.sb-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-top: 6px; }
.sb-sec { font-size: 11px; letter-spacing: .08em; color: rgba(255,255,255,.55); margin: 14px 8px 4px; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px;
  color: rgba(255,255,255,.85); text-decoration: none; font-size: 14.5px; font-weight: 500; transition: all .15s;
}
.side-link .si { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.side-link:hover { background: rgba(255,255,255,.16); color: #fff; }
.side-link.active { background: #fff; color: #1e3a8a; font-weight: 700; }
.sb-foot { border-top: 1px solid rgba(255,255,255,.18); padding-top: 12px; margin-top: 8px; }
.sb-foot .term-switch { margin: 0 0 10px; padding: 0; }
.sb-foot .term-select { width: 100%; background: rgba(255,255,255,.95); }
.sb-foot .user-chip { background: rgba(255,255,255,.15); border-radius: 10px; padding: 9px 12px; font-size: 13px; line-height: 1.7; }
.sb-foot .user-chip a { color: #fff; opacity: .85; margin-left: 8px; }

/* 仅当用户已登录（含侧栏）时，桌面端内容区右移 */
html.has-sidebar body { padding-left: 232px; }

/* 手机端底部 Tab + 抽屉遮罩（默认隐藏） */
.mobile-tab { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 960px) {
  html.has-sidebar body { padding-left: 0; padding-bottom: 68px; }

  /* 侧栏变为可滑出的抽屉 */
  .sidebar { width: 264px; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 199; }

  /* 底部 Tab */
  .mobile-tab {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: #fff; border-top: 1px solid #e5e7eb; box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .mt-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: none; cursor: pointer; text-decoration: none;
    color: #64748b; font-size: 11px; font-family: inherit; padding: 4px 2px; max-width: 96px;
  }
  .mt-item .mt-ico { font-size: 20px; line-height: 1; }
  .mt-item.active { color: #2563eb; font-weight: 700; }
  .mt-item.active .mt-ico { transform: translateY(-1px); }

  .container { max-width: 100%; }
  /* 窄屏下常见元素堆叠，避免横向溢出 */
  .hw-item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar > * { flex: 1 1 auto; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 640px) {
  .container { padding: 14px 10px; }
  .card { padding: 16px; }
  .user-chip { font-size: 12px; }
}
