/* 物理科学与技术学院2024级本科生学情分析 - 样式（珞珈学术蓝） */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy: #12294b;
  --navy-2: #1b3a68;
  --gold: #b8912f;
  --gold-soft: #f4ecd8;
  --ink: #1c2733;
  --mut: #5b6b7d;
  --line: #dfe5ec;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --green: #1a7f37;
  --blue: #2f6fb2;
  --amber: #b8791a;
  --red: #c03434;
  --defer: #c03434;
  --blue-soft: #e9f1fa;
  --serif: Georgia, "Songti SC", "STSong", "SimSun", serif;
}

html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.page { max-width: 960px; margin: 0 auto; padding: 0 16px 64px; }

/* ---------- 页脚 ---------- */
.page-footer {
  text-align: center; margin-top: 30px;
  font-size: 12px; color: var(--mut); letter-spacing: .5px;
}

/* ---------- 头部横幅 ---------- */
.banner {
  width: 100vw; margin-left: calc(50% - 50vw);
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 70%, #27497e 100%);
  color: #fff; padding: 34px 24px 30px; margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.banner::after {
  content: ""; position: absolute; right: -40px; top: -60px;
  width: 220px; height: 220px;
  border: 1px solid rgba(184, 145, 47, .35); border-radius: 50%;
}
.banner::before {
  content: ""; position: absolute; right: 10px; top: -20px;
  width: 140px; height: 140px;
  border: 1px solid rgba(184, 145, 47, .22); border-radius: 50%;
}
.banner > * { position: relative; max-width: 912px; margin-left: auto; margin-right: auto; }
.banner .eyebrow {
  font-size: 12px; letter-spacing: 4px; color: #cdb977;
  text-transform: uppercase; margin-bottom: 8px;
}
.banner h1 {
  font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: 1px;
}
.banner .sub { margin-top: 8px; font-size: 13px; color: #a8bcd6; }
.banner .rule { width: 44px; height: 3px; background: var(--gold); margin-top: 14px; border-radius: 2px; }

/* ---------- 登录 ---------- */
.login-card {
  max-width: 380px; margin: 16vh auto 0; padding: 36px 32px 30px;
  background: var(--card-bg); border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 8px; text-align: center;
  box-shadow: 0 4px 20px rgba(18, 41, 75, .08);
}
.login-card .eyebrow {
  font-size: 11px; letter-spacing: 4px; color: var(--gold);
  text-transform: uppercase; margin-bottom: 8px;
}
.login-card h1 {
  font-family: var(--serif); font-size: 17px; color: var(--navy);
  margin-bottom: 24px; letter-spacing: .5px; line-height: 1.55;
}
.login-card input {
  width: 100%; padding: 11px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 6px; outline: none;
  transition: border-color .15s;
}
.login-card input:focus { border-color: var(--navy-2); }
.login-card button {
  width: 100%; margin-top: 14px; padding: 11px; font-size: 15px; letter-spacing: 2px;
  color: #fff; background: var(--navy); border: none;
  border-radius: 6px; cursor: pointer; transition: background .15s;
}
.login-card button:hover { background: var(--navy-2); }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; }
.login-note {
  margin-top: 16px; padding: 7px 10px; font-size: 12px;
  color: #8a6d1a; background: #fdf8e0; border-radius: 6px;
}

/* ---------- 分组选择 chips ---------- */
.chips { margin-bottom: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.chip {
  padding: 6px 16px; font-size: 13px; text-decoration: none;
  color: var(--mut); background: var(--card-bg);
  border: 1px solid var(--line); border-radius: 999px;
  transition: all .15s;
}
.chip:hover { border-color: var(--navy); color: var(--navy); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* 分组区域色块 */
.chip-group {
  border-radius: 10px; padding: 10px 12px 12px; margin-bottom: 10px;
}
.grp-admin { background: #eef2f8; border: 1px solid #d9e2ee; }
.grp-spc { background: #e9f2fb; border: 1px solid #cee0f2; }
.grp-head {
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  color: var(--navy); margin-bottom: 8px;
}
.grp-spc .grp-head { color: var(--blue); }
.grp-body { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-group .chip { background: #fff; }
/* 选中态需覆盖上面的白色背景（同特异性、后者优先） */
.chip-group .chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* GPA 计算方式提示 */
.calc-note {
  margin: 4px 0 2px; padding: 7px 12px;
  font-size: 12px; line-height: 1.5; color: #8a6d1a;
  background: #fdf8e0; border-radius: 6px;
}

/* ---------- 统计条 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card-bg); border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  padding: 14px 16px; border-radius: 6px;
}
.stat-label { display: block; font-size: 12px; color: var(--mut); }
.stat-value {
  display: block; font-family: var(--serif); font-size: 24px; font-weight: 600;
  color: var(--navy); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-stats .stat { border-top-color: var(--blue); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 20px 22px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(18, 41, 75, .05);
}
.card-title {
  font-family: var(--serif); font-size: 17px; color: var(--navy);
  padding-bottom: 10px; border-bottom: 2px solid var(--gold-soft);
  margin-bottom: 14px; position: relative;
}
.card-title::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 36px; height: 2px; background: var(--gold);
}
.card-danger { border-color: #ecc9c9; }
.card-danger .card-title { color: var(--red); }
.card-ok { border-color: #c4dcc9; }
/* 卡片标题右侧的小字提示 */
.title-hint {
  float: right; font-size: 12px; font-weight: 400; letter-spacing: 0;
  color: var(--mut); font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-top: 4px;
}

/* ---------- 学生表格 ---------- */
/* 姓名搜索框 */
.stu-search { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stu-search input {
  flex: 1; max-width: 320px; padding: 8px 12px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 6px; outline: none;
  background: var(--bg); transition: border-color .15s, background .15s;
}
.stu-search input:focus { border-color: var(--navy-2); background: var(--card-bg); }
#stu-count { font-size: 12.5px; color: var(--mut); white-space: nowrap; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* 所有列收缩到内容宽（width:1%），剩余空间按内容比例均匀分配 */
.stu-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.stu-table th, .stu-table td { width: 1%; }
.stu-table th {
  font-size: 12px; color: var(--mut); font-weight: 500; text-align: left;
  padding: 10px 12px; border-bottom: 2px solid var(--navy); letter-spacing: 1px;
  white-space: nowrap;
}
.stu-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stu-table tbody tr { cursor: pointer; transition: background .12s; }
.stu-table tbody tr:hover { background: var(--gold-soft); }
.stu-table tbody tr:last-child td { border-bottom: none; }
.stu-name { font-weight: 600; color: var(--navy); }
.td-major { color: var(--mut); font-size: 13px; }
.badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  font-size: 11px; line-height: 1.6; font-weight: 400;
  color: var(--blue); background: var(--blue-soft);
  border-radius: 4px; vertical-align: 1px;
}
.badge-lg { font-size: 13px; padding: 2px 10px; vertical-align: 2px; }

/* ---------- 个人页 ---------- */
.back-btn {
  display: inline-block; margin: 4px 0 14px; padding: 7px 16px;
  font-size: 13px; color: var(--navy-2); text-decoration: none;
  background: var(--card-bg); border: 1px solid var(--line);
  border-radius: 999px; transition: all .15s;
}
.back-btn:hover { border-color: var(--navy); color: var(--navy); background: var(--gold-soft); }
.stu-header h1 {
  font-family: var(--serif); font-size: 24px; color: var(--navy);
  margin-bottom: 14px; letter-spacing: 1px;
}

.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 18px;
}
.info-grid > div { padding: 6px 0; border-bottom: 1px dashed #edf0f4; }
.info-grid dt { font-size: 12px; color: var(--mut); }
.info-grid dd { font-size: 14px; word-break: break-all; }
.info-grid dd.v-none { color: var(--mut); }

/* 基本信息中的特殊情况标注（占整行）；用 .info-grid > div.info-special
   提高优先级，压过 .info-grid > div 的 padding:6px 0 */
.info-grid > div.info-special {
  grid-column: 1 / -1; border-radius: 6px; padding: 12px 16px;
  background: #fdf3e4; border-bottom: none;
}
.info-special dt { color: var(--amber); margin-bottom: 2px; }
.info-special dd { color: #7a5a12; font-weight: 600; white-space: pre-wrap; }

/* ---------- AI 学情分析卡片（数智教育风格，浅色） ---------- */
.ai-card {
  background: linear-gradient(135deg, #f2f6fc 0%, #e6eef9 55%, #dfeafa 100%);
  border: 1px solid #c5d8ef;
  position: relative; overflow: hidden;
}
.ai-card::before {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(94,160,255,.20), transparent 70%);
}
.ai-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(122,162,214,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122,162,214,.10) 1px, transparent 1px);
  background-size: 22px 22px;
}
.ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; position: relative; z-index: 1; }
.ai-logo {
  width: 30px; height: 30px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 8px; color: #fff; font-size: 15px;
  box-shadow: 0 2px 10px rgba(99,140,255,.35);
}
.ai-title { font-family: var(--serif); font-size: 17px; color: var(--navy); margin: 0; letter-spacing: 1px; }
.ai-badge {
  margin-left: auto; font-size: 11px; color: #4c71a3;
  border: 1px solid rgba(90,130,185,.35); border-radius: 999px;
  padding: 3px 10px; letter-spacing: .5px;
  background: rgba(255,255,255,.55); white-space: nowrap;
}
.ai-block { padding: 10px 0; border-bottom: 1px dashed rgba(90,130,185,.3); position: relative; z-index: 1; }
.ai-block:last-child { border-bottom: none; padding-bottom: 0; }
.ai-sub { font-size: 14px; font-weight: 700; color: #3f6db0; letter-spacing: 2px; margin-bottom: 6px; }
.ai-text {
  font-size: 13.5px; color: #26384e; line-height: 1.8;
  white-space: pre-wrap; word-break: break-word;
}
.ai-text.none { color: #8aa0b8; }

/* ---------- 成长简历 ---------- */
.resume-block { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.resume-block:last-child { border-bottom: none; padding-bottom: 0; }
.resume-sub { font-size: 13px; color: var(--navy-2); font-weight: 600; margin-bottom: 4px; letter-spacing: 1px; }
.resume-text {
  font-size: 13.5px; color: var(--ink); line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}
.resume-text.none { color: var(--mut); }

.rank-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
/* 图表高度包含折线图 + 图下数据表（graphic 绘制，每行一个学期） */
#chart { width: 100%; height: 410px; }
#gpa-chart { width: 100%; height: 300px; }

/* GPA 分布比例条（HTML 实现，填充宽度=占比百分比） */
.dist-list { margin-top: 4px; }
.dist-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.dist-label {
  width: 72px; text-align: left; font-size: 12.5px;
  color: var(--mut); font-family: var(--serif); flex: none;
}
.dist-track { flex: 1; height: 14px; background: #f0f3f7; border-radius: 7px; min-width: 0; }
.dist-fill { height: 100%; border-radius: 7px; min-width: 4px; }
.dist-count {
  width: 60px; text-align: right; flex: none;
  font-size: 12.5px; color: var(--mut); font-family: var(--serif);
}
.dist-pct {
  width: 48px; text-align: right; flex: none;
  font-size: 13.5px; font-weight: 700; font-family: var(--serif);
}

.sem-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.sem-stat { font-size: 13px; color: var(--mut); font-family: var(--serif); }

.group-title {
  font-size: 12px; color: var(--gold); letter-spacing: 2px;
  margin: 9px 0 3px; font-weight: 600;
}

/* 课程组表头（课程 / 成绩 / 学分） */
.course-head {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 4px; margin-bottom: 1px;
  font-size: 11px; color: var(--mut); letter-spacing: 1px;
  border-bottom: 1px solid var(--line);
}
.course-head .h-name { flex: 1; min-width: 0; }
.course-head .h-score { width: 58px; text-align: right; }
.course-head .h-credit { width: 40px; text-align: right; }

.course-list { list-style: none; }
.course {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px; font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.course:last-child { border-bottom: none; }
.c-name { flex: 1; min-width: 0; }
.c-tag { color: var(--mut); font-size: 12px; }
.c-score { width: 58px; text-align: right; font-weight: 600; font-family: var(--serif); }
.c-credit { width: 40px; text-align: right; color: var(--mut); font-size: 12px; }
.course.fail .c-score, .course.defer .c-score { color: var(--red); }
.course.withdraw .c-score { color: var(--mut); }
.course.fail .c-name, .course.defer .c-name { color: var(--red); }

.owed-total { float: right; font-size: 14px; color: var(--red); font-weight: 600; }
.owed-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.owed-table th {
  font-size: 12px; color: var(--mut); font-weight: 500; letter-spacing: 1px;
  padding: 8px; text-align: left; border-bottom: 2px solid var(--navy); white-space: nowrap;
}
.owed-table td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); }
.owed-table td:not(.owed-name) { white-space: nowrap; }
.owed-name { word-break: break-all; }
.reason { padding: 1px 8px; border-radius: 4px; font-size: 12px; }
.reason-fail { color: var(--red); background: #fdeeee; }
.reason-defer { color: var(--defer); background: #fdeeee; }
.reason-miss { color: var(--mut); background: #eef1f4; }
.no-owed { color: var(--green); font-size: 14px; padding: 6px 0; }

/* ---------- 班级情况 ---------- */
.cls-meta {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 6px;
}
.cls-meta > div { background: var(--bg); border-radius: 6px; padding: 10px 12px; }
.cls-meta span { display: block; font-size: 11px; color: var(--mut); }
.cls-meta b { font-family: var(--serif); font-size: 16px; color: var(--navy); font-weight: 600; }

.sub-title { font-size: 13px; color: var(--mut); margin: 16px 0 8px; letter-spacing: 1px; }

.metric-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mchip {
  padding: 5px 12px; font-size: 12.5px; color: var(--mut);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.mchip b { color: var(--navy); font-family: var(--serif); margin-left: 2px; }
.mchip.w1 { background: #fdeeee; border-color: #f2c9c9; color: var(--red); }
.mchip.w1 b { color: var(--red); }
.mchip.w2 { background: #fdf3e4; border-color: #f0dcb8; color: var(--amber); }
.mchip.w2 b { color: var(--amber); }
.mchip.w3 { background: #fdf8e0; border-color: #efe3ae; color: #8a6d1a; }
.mchip.w3 b { color: #8a6d1a; }

/* 学业预警徽章 */
.badge-warn, .badge-warn-lg {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  font-size: 11px; line-height: 1.7; border-radius: 4px; vertical-align: 1px;
}
.badge-warn.w1, .badge-warn-lg.w1 { background: #fdeeee; color: var(--red); }
.badge-warn.w2, .badge-warn-lg.w2 { background: #fdf3e4; color: var(--amber); }
.badge-warn.w3, .badge-warn-lg.w3 { background: #fdf8e0; color: #8a6d1a; }
.badge-warn-lg { font-size: 13px; padding: 3px 12px; vertical-align: 2px; }

/* 个人页信息网格中的预警高亮 */
.info-warn { border-radius: 6px; padding: 6px 10px !important; border-bottom: none !important; }
.info-warn dd { font-weight: 700; }
.info-warn.w1 { background: #fdeeee; }
.info-warn.w1 dd, .info-warn.w1 dt { color: var(--red); }
.info-warn.w2 { background: #fdf3e4; }
.info-warn.w2 dd, .info-warn.w2 dt { color: var(--amber); }
.info-warn.w3 { background: #fdf8e0; }
.info-warn.w3 dd, .info-warn.w3 dt { color: #8a6d1a; }

/* ---------- 手机端 ---------- */
@media (max-width: 640px) {
  .page { padding: 0 12px 48px; }
  .banner { padding: 26px 20px 22px; margin-bottom: 16px; }
  .banner h1 { font-size: 20px; }
  .banner .sub { font-size: 12px; }
  .stats { gap: 8px; }
  .stat { padding: 10px; }
  .stat-value { font-size: 18px; }
  .card { padding: 16px; }
  .card-title { font-size: 15px; }
  .stu-table { font-size: 13px; }
  .stu-table th, .stu-table td { padding: 8px; }
  .badge { margin-left: 3px; font-size: 10px; }
  .badge-warn { margin-left: 3px; font-size: 10px; }
  .stu-header h1 { font-size: 20px; }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .rank-stats { gap: 8px; }
  .rank-stats .stat-value { font-size: 17px; }
  #chart { height: 360px; }
  #gpa-chart { height: 230px; }
  .dist-label { width: 66px; font-size: 11.5px; }
  .dist-count { width: 52px; }
  .dist-pct { width: 42px; }
  .c-score { width: 46px; }
  .course-head .h-score { width: 46px; }
  .owed-table { font-size: 12.5px; }
  .owed-table td, .owed-table th { padding: 6px 4px; }
  .mchip { font-size: 12px; padding: 4px 10px; }
  .cls-meta { grid-template-columns: repeat(2, 1fr); }
  .login-card { margin: 12vh auto 0; padding: 28px 22px 24px; }
  .calc-note { font-size: 11px; }
}
