/* ============================================================
   中考成绩数据平台 - 全局样式
   主题：现代 · 专业 · 蓝青 · 卡片式
   ============================================================ */

:root {
  /* 主色调 */
  --primary-900: #1E3A8A;
  --primary-600: #2563EB;
  --primary-500: #3B82F6;
  --cyan-500: #0EA5E9;
  --cyan-400: #38BDF8;

  /* 背景与文本 */
  --bg: #F1F5F9;
  --bg-card: #FFFFFF;
  --text-900: #0F172A;
  --text-500: #64748B;
  --text-300: #94A3B8;

  /* 功能色 */
  --ok: #10B981;
  --err: #EF4444;
  --warn: #F59E0B;

  /* 圆角 / 阴影 */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
  --shadow: 0 4px 16px rgba(15, 23, 42, .10);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .18);

  --nav-h: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-900);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-500); }

/* ---------- 顶部导航 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(120deg, var(--primary-900) 0%, #1d4ed8 55%, #0369a1 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .5px;
  white-space: nowrap;
}
.brand:hover { color: #fff; opacity: .92; }
.brand svg { flex: none; }
.nav-links { display: flex; gap: 6px; margin-left: 8px; }
.nav-link {
  color: rgba(255,255,255,.82);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  transition: all .18s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.18);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.nav-user { margin-left: auto; }

/* ---------- 布局 ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 28px 24px 56px; }
/* 全宽容器：表格查看页扩展至整个屏幕宽度 */
.container-wide { max-width: none; padding-left: 20px; padding-right: 20px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 600; }
.page-head p { color: var(--text-500); margin-top: 4px; font-size: 14px; }

/* ---------- 统计概览条 ---------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.stat-icon.blue { background: rgba(37,99,235,.12); color: var(--primary-600); }
.stat-icon.cyan { background: rgba(14,165,233,.12); color: var(--cyan-500); }
.stat-icon.green { background: rgba(16,185,129,.12); color: var(--ok); }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-500); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { font-size: 17px; font-weight: 600; }

/* ---------- 提示条 ---------- */
.hint-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(120deg, rgba(14,165,233,.10), rgba(37,99,235,.08));
  border: 1px solid rgba(14,165,233,.25);
  color: #0c4a6e;
  border-radius: var(--radius);
  padding: 13px 18px;
  margin-bottom: 24px;
  font-size: 14px;
}
.hint-bar svg { flex: none; color: var(--cyan-500); }

/* ---------- 表格卡片网格 ---------- */
.table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.table-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid transparent;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.table-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(37,99,235,.35);
}
.tc-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .5px;
}
.file-icon.xlsx { background: rgba(16,185,129,.14); color: #047857; }
.file-icon.json { background: rgba(245,158,11,.16); color: #b45309; }
.file-icon.csv  { background: rgba(59,130,246,.14); color: #1d4ed8; }
.tc-name {
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tc-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-500);
}
.tag.rows { background: rgba(37,99,235,.10); color: var(--primary-600); }
.tag.time { background: rgba(14,165,233,.10); color: #0369a1; }
.tc-actions { margin-top: auto; display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  transition: all .18s ease;
  font-weight: 500;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(120deg, var(--primary-600), var(--cyan-500));
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(37,99,235,.45); transform: translateY(-1px); }
.btn-outline {
  background: #fff;
  color: var(--primary-600);
  border: 1px solid rgba(37,99,235,.40);
}
.btn-outline:hover:not(:disabled) { background: rgba(37,99,235,.06); }
.btn-ghost {
  background: transparent;
  color: var(--text-500);
  border: 1px solid #e2e8f0;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text-900); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.form-field { margin-bottom: 16px; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-500);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text-900);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.search-box { position: relative; min-width: 260px; }
.search-box svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-300);
  pointer-events: none;
}
.search-box .input { padding-left: 36px; }

/* ---------- 表格 ---------- */
/* 表头上方注释（标题 / 说明文字） */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  background: #fff;
}
table.data-table {
  width: 100%;
  table-layout: fixed; /* 固定布局：列宽由 colgroup 控制，确保铺满整个容器、右侧无空白 */
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}
/* 表头上方注释行（对齐表格列，colspan 模拟合并单元格） */
.data-table thead tr.notes-row th {
  position: static;
  background: #f8fafc;
  color: var(--text-600);
  font-weight: 600;
  text-align: center;
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
  cursor: default;
  user-select: text;
  transition: none;
}
.data-table thead tr.notes-row th.notes-th-empty {
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}
/* 真正的数据表头行（吸顶 + 排序） */
.data-table thead tr:last-child th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--text-500);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  user-select: none;
  transition: background .15s ease;
}
.data-table thead tr:last-child th:hover { background: #f1f5f9; color: var(--primary-600); }
.data-table thead tr:last-child th .sort-icon { font-size: 11px; margin-left: 4px; opacity: .5; }
.data-table thead tr:last-child th.sorted-asc .sort-icon { opacity: 1; color: var(--primary-600); }
.data-table thead tr:last-child th.sorted-desc .sort-icon { opacity: 1; color: var(--primary-600); }
.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:hover { background: rgba(14,165,233,.06); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---------- 工具栏 / 分页 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.pager { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-500); }
.pager .btn { padding: 5px 12px; }
.pager-info { white-space: nowrap; }

/* ---------- Sheet Tabs ---------- */
.sheet-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.sheet-tab {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: var(--text-500);
  font-size: 13px;
  cursor: pointer;
  transition: all .18s ease;
  font-family: inherit;
}
.sheet-tab:hover { border-color: var(--primary-500); color: var(--primary-600); }
.sheet-tab.active {
  background: linear-gradient(120deg, var(--primary-600), var(--cyan-500));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(37,99,235,.30);
}

/* ---------- 查询页（APP 风格） ---------- */
/* 查询页隐藏顶部网页导航，呈现纯 APP 体验 */
body.app-body .navbar { display: none; }
.query-wrap { max-width: 480px; margin: 0 auto; }
.app-card {
  background: var(--bg-card);
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(15,23,42,.07);
  padding: 20px;
  margin-bottom: 16px;
}

/* APP 头部（渐变 Hero） */
.app-hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 28px 20px 24px;
  margin-bottom: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #0891b2 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(30,64,175,.30);
}
.app-hero::before, .app-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
}
.app-hero::before { width: 170px; height: 170px; top: -70px; right: -50px; }
.app-hero::after  { width: 130px; height: 130px; bottom: -60px; left: -35px; }
.app-hero-icon {
  position: relative;
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.16);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.app-hero h1 {
  position: relative;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 6px;
}
.app-hero p { position: relative; font-size: 13px; opacity: .88; }

/* 查询表单 */
.query-form .form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-500);
  margin-bottom: 8px;
}
.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 0 14px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input-wrap:focus-within {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.input-wrap svg { color: var(--text-400); flex-shrink: 0; }
.input-wrap .input {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 13px 0;
  font-size: 15px;
}
.input-wrap .input:focus { box-shadow: none; }
.btn-query {
  width: 100%;
  margin-top: 6px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(120deg, var(--primary-600), var(--cyan-500));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(37,99,235,.28);
  transition: transform .12s ease, box-shadow .2s ease;
}
.btn-query:hover { box-shadow: 0 8px 20px rgba(37,99,235,.35); }
.btn-query:active { transform: scale(.97); }
.q-tip {
  font-size: 12px;
  color: var(--text-400);
  text-align: center;
  margin-top: 12px;
  line-height: 1.6;
}

/* 结果展示卡 */
.result-card {
  display: none;
  animation: fadeUp .35s ease;
}
.result-card.show { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 结果头部：头像 + 姓名 + 来源徽章 */
.app-result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 16px;
}
.ar-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-600), var(--cyan-500));
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37,99,235,.30);
}
.ar-info { flex: 1; min-width: 0; }
.ar-name { font-size: 18px; font-weight: 700; }
.ar-no {
  font-size: 12px;
  color: var(--text-500);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge.source-official {
  flex-shrink: 0;
  background: rgba(16,185,129,.15);
  color: #047857;
  font-size: 11px;
  padding: 4px 10px;
}
.badge.source-local {
  flex-shrink: 0;
  background: rgba(245,158,11,.15);
  color: #b45309;
  font-size: 11px;
  padding: 4px 10px;
}

/* 总分卡（渐变焦点） */
.total-score {
  position: relative;
  overflow: hidden;
  text-align: center;
  background: linear-gradient(135deg, #1e40af, #2563eb 55%, #0891b2);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 14px;
  color: #fff;
}
.total-score::after {
  content: '';
  position: absolute;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
  top: -40px; right: -30px;
}
.total-score .ts-label {
  position: relative;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  letter-spacing: 3px;
}
.total-score .ts-value {
  position: relative;
  font-size: 46px;
  font-weight: 800;
  line-height: 1.25;
}

/* 科目：两科一行 */
.score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.score-item {
  background: var(--bg);
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 13px 10px;
  text-align: center;
  animation: fadeUp .3s ease backwards;
}
.score-item .si-label { font-size: 12px; color: var(--text-500); }
.score-item .si-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 3px;
  color: var(--text-900);
}

/* 信息分组列表（APP 设置列表风格） */
.info-list {
  background: var(--bg);
  border: 1px solid #eef2f7;
  border-radius: 12px;
  overflow: hidden;
}
.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  border-bottom: 1px solid #f1f5f9;
}
.info-item:last-child { border-bottom: none; }
.info-item .ii-label { color: var(--text-500); font-size: 13px; flex-shrink: 0; }
.info-item .ii-value { font-weight: 600; text-align: right; font-size: 14px; }

/* 徽章 */
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge.rank { background: rgba(245,158,11,.15); color: #b45309; }
.badge.school { background: rgba(16,185,129,.13); color: #047857; }

/* 空态 / 提示 */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--text-400);
}
.empty svg { opacity: .4; margin-bottom: 10px; }
.empty p { font-size: 14px; line-height: 1.7; }

/* 查询失败 / 自动重新查询状态 */
.retry-card { display: none; }
.retry-box { text-align: center; padding: 10px 6px 2px; }
.retry-icon {
  width: 44px;
  height: 44px;
  color: #dc2626;
  opacity: .9;
  animation: spin 1.2s linear infinite;
}
.retry-title { font-size: 15px; font-weight: 600; color: #b91c1c; margin-top: 12px; }
.retry-reason { font-size: 13px; color: var(--text-400); margin-top: 8px; word-break: break-all; }
.retry-progress { font-size: 12px; color: var(--primary-600); margin-top: 10px; }
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-error { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.25); color: #b91c1c; }
.alert-info { background: rgba(14,165,233,.08); border: 1px solid rgba(14,165,233,.25); color: #0c4a6e; }

/* loading */
.loading {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -4px;
  margin-right: 6px;
}
.btn .loading { border-color: rgba(37,99,235,.25); border-top-color: var(--primary-600); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .navbar-inner { padding: 0 16px; gap: 12px; }
  .container { padding: 18px 14px 40px; }
  .stats-bar { grid-template-columns: 1fr; }
  .search-box { min-width: 100%; }
  .brand span { display: none; }

  /* 移动端表格：更小字号、紧凑间距，内容允许换行完整显示（不省略） */
  .data-table { font-size: 12px; min-width: 0; }
  .data-table thead tr:last-child th { padding: 8px 9px; }
  .data-table tbody td { padding: 7px 9px; }
  .data-table thead tr:last-child th,
  .data-table tbody td {
    white-space: normal;   /* 允许换行，保证内容完整可见 */
    word-break: break-all; /* 长串数字/英文可断行 */
    overflow: visible;
    text-overflow: clip;
  }
  .card { padding: 12px; }
  .table-wrap { border-radius: var(--radius-sm); }
}
