/* ============ 错题本云平台 - 全局样式 ============ */
:root {
  --primary: #4F63F0;
  --primary-2: #7A5BF0;
  --primary-3: #9B6BF5;
  --ink: #1E2745;
  --ink-2: #4A5370;
  --muted: #79809C;
  --line: #E6E9F2;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --ok: #12B76A;
  --warn: #F79009;
  --danger: #F04438;
  --shadow-sm: 0 2px 8px rgba(31, 39, 69, 0.06);
  --shadow-md: 0 10px 30px rgba(31, 39, 69, 0.10);
  --shadow-lg: 0 20px 50px rgba(31, 39, 69, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ============ 顶部导航 ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-radius: 13px;
  box-shadow: 0 6px 16px rgba(79, 99, 240, 0.35);
  flex-shrink: 0;
}
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.nav { display: flex; gap: 8px; }
.nav-btn {
  border: none; cursor: pointer;
  background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 500;
  padding: 9px 16px; border-radius: 10px;
  transition: all .2s;
  font-family: inherit;
}
.nav-btn:hover { background: #EEF1FB; color: var(--primary); }
.nav-btn.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79, 99, 240, 0.35); }

/* ============ 视图切换 ============ */
.view { display: none; }
.view.active { display: block; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ Hero（学生查询） ============ */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #3F55E8 0%, var(--primary-2) 52%, #8A5CF0 100%);
  color: #fff;
  padding: 72px 0 44px;
}
.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .28;
  background: radial-gradient(circle at 30% 30%, #fff, transparent 70%);
  pointer-events: none;
}
.b1 { width: 420px; height: 420px; top: -160px; right: -80px; }
.b2 { width: 300px; height: 300px; bottom: -140px; left: -60px; opacity: .18; }
.b3 { width: 180px; height: 180px; top: 20px; left: 42%; opacity: .14; }

.hero-inner { position: relative; z-index: 2; text-align: center; }
.hero h1 { font-size: 40px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 18px rgba(0,0,0,.15); }
.hero-sub { margin-top: 12px; font-size: 16px; opacity: .92; }

.search-card {
  margin: 36px auto 0;
  max-width: 860px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px 28px;
  color: var(--ink);
}
.search-row { display: flex; align-items: flex-end; gap: 16px; }
.search-row .field { flex: 1; min-width: 0; }
.field { text-align: left; }
.field label {
  display: block;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 7px;
}
.search-row .btn-lg { flex-shrink: 0; }

.hero-stats {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 44px;
}
.hero-stats .stat { text-align: center; }
.hero-stats .stat b { display: block; font-size: 26px; font-weight: 800; }
.hero-stats .stat span { font-size: 13px; opacity: .85; }

/* ============ 按钮 & 输入 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 11px;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 99, 240, 0.32);
}
.btn-primary:hover { box-shadow: 0 10px 22px rgba(79, 99, 240, 0.42); transform: translateY(-1px); }
.btn-outline {
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #F6F8FF; }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #FFD5D1; }
.btn-danger:hover { background: #FFF3F2; }
.btn-lg { padding: 15px 30px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

.input, select.input, input[type="text"], input[type="password"] {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 99, 240, 0.15);
}
select.input { appearance: auto; }

/* ============ 查询结果 ============ */
.results-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.results-head h3 { font-size: 17px; }
.results-head .count { color: var(--primary); font-weight: 700; }

.result-list { display: flex; flex-direction: column; gap: 12px; }
.result-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: all .2s;
}
.result-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #C9D4FF; }
.rc-icon {
  width: 46px; height: 46px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: #EEF1FF;
  color: var(--primary);
  flex-shrink: 0;
}
.rc-main { flex: 1; min-width: 0; }
.rc-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-meta { display: flex; align-items: center; gap: 10px; margin-top: 5px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
}
.badge-subject { background: #EEF1FF; color: var(--primary); }
.badge-cat { background: #E9FBF2; color: var(--ok); }
.badge-status { background: #FFF4E5; color: var(--warn); }
.rc-actions { display: flex; gap: 8px; flex-shrink: 0; }

.empty-state {
  background: var(--card);
  border: 1.5px dashed #D5DBEA;
  border-radius: var(--radius);
  padding: 54px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-state .es-icon { font-size: 40px; margin-bottom: 10px; }
.empty-state h4 { color: var(--ink-2); font-size: 16px; margin-bottom: 6px; }
.hint-tip { text-align: center; color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: calc(100vh - 68px - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  background:
    radial-gradient(800px 400px at 15% 0%, rgba(79,99,240,.10), transparent 60%),
    radial-gradient(700px 400px at 90% 100%, rgba(154,107,245,.10), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  text-align: center;
}
.login-logo {
  width: 66px; height: 66px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(79,99,240,.35);
}
.login-card h2 { font-size: 21px; font-weight: 700; }
.login-sub { color: var(--muted); font-size: 13px; margin: 8px 0 26px; }
.login-card form { text-align: left; display: flex; flex-direction: column; gap: 16px; }
.login-card .form-row { display: flex; flex-direction: column; gap: 7px; }
.login-card .form-row label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login-tip { margin-top: 20px; font-size: 12px; color: var(--muted); background: #F6F8FF; border-radius: 10px; padding: 10px 12px; }

/* ============ 管理面板 ============ */
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.dash-title h2 { font-size: 24px; font-weight: 800; }
.dash-title p { color: var(--muted); font-size: 13px; margin-top: 2px; }

.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-card .sc-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sc-i1 { background: #EEF1FF; color: var(--primary); }
.sc-i2 { background: #E9FBF2; color: var(--ok); }
.sc-i3 { background: #FFF4E5; color: var(--warn); }
.sc-i4 { background: #F3EEFF; color: var(--primary-2); }
.stat-card b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-card span { font-size: 12px; color: var(--muted); }

.dash-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dash-tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 11px;
  cursor: pointer;
  transition: all .2s;
}
.dash-tab:hover { border-color: #C9D4FF; color: var(--primary); }
.dash-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(79,99,240,.3);
}

.dash-panel { display: none; }
.dash-panel.active { display: block; animation: fadeIn .3s ease; }

.panel-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px;
}

/* ---- 上传区 ---- */
.dropzone {
  border: 2px dashed #C9D4FF;
  border-radius: 14px;
  background: #FAFBFF;
  padding: 48px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #F0F3FF; }
.dz-icon { color: var(--primary); margin-bottom: 12px; }
.dz-text { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.dz-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }

.pending-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  background: #F6F8FF;
  border-radius: 11px;
  padding: 12px 16px;
}
.pending-bar .count-tag { font-weight: 700; color: var(--primary); }
.pending-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; }
table.table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 13.5px; }
.table thead th {
  background: #F7F8FD;
  text-align: left;
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.table tbody td { padding: 11px 14px; border-bottom: 1px solid #F0F2F9; vertical-align: middle; }
.table tbody tr:hover { background: #FAFBFF; }
.table tbody tr:last-child td { border-bottom: none; }
.tb-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-actions { display: flex; gap: 6px; justify-content: flex-end; }
.inline-input {
  width: 100%;
  min-width: 88px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.inline-input:focus { border-color: var(--primary); }
.badge-high { background: #E9FBF2; color: var(--ok); }
.badge-medium { background: #FFF4E5; color: var(--warn); }
.badge-low { background: #FFEDEC; color: var(--danger); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .search-input { flex: 1; min-width: 200px; }
.toolbar .input { width: auto; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.page-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: transparent; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- 名单 ---- */
.roster-head { margin-bottom: 18px; }
.roster-head h3 { font-size: 16px; margin-bottom: 6px; }
.roster-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.roster-info-card {
  margin-top: 18px;
  background: #F6F8FF;
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
}
.roster-info-card b { color: var(--primary); }

/* ---- 设置 ---- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.settings-col h3 { font-size: 16px; margin-bottom: 16px; }
.settings-col .form-row { margin-bottom: 14px; }
.settings-col .form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.settings-col .btn { margin-top: 4px; }

/* ============ 底部 ============ */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 22px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.site-footer .foot-icp { margin-top: 6px; font-size: 12px; }
.site-footer .foot-icp a {
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
.site-footer .foot-icp a:hover { color: var(--primary); text-decoration: underline; }

/* ============ Toast ============ */
#toastWrap {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #1E2745;
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: toastIn .3s ease;
  max-width: 86vw;
}
.toast.success { background: #0E9F6E; }
.toast.error { background: #D92D20; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px); } }

/* ============ Modal ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(23, 30, 60, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  animation: toastIn .25s ease;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-head h3 { font-size: 17px; }
.modal-close {
  border: none; background: none;
  font-size: 22px; color: var(--muted);
  cursor: pointer; line-height: 1;
  padding: 4px 8px; border-radius: 8px;
}
.modal-close:hover { background: #F2F4FB; color: var(--ink); }
.modal-body { padding: 18px 24px 22px; }
.modal-body .form-row { margin-bottom: 14px; }
.modal-body .form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }

/* ---- PDF 页面内预览 ---- */
.modal-preview {
  max-width: 1000px;
  width: 95vw;
  display: flex;
  flex-direction: column;
  padding-bottom: 14px;
}
.modal-preview .modal-head { align-items: center; }
.pv-actions { display: flex; gap: 8px; align-items: center; }
.modal-preview .modal-body { padding: 14px 16px 0; }
.pv-body iframe {
  width: 100%;
  height: 74vh;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.pv-tip { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 16px 0; }

/* ============ 响应式 ============ */
@media (max-width: 820px) {
  .header-inner { flex-direction: column; height: auto; padding: 14px 0; gap: 12px; }
  .brand-sub { display: none; }
  .hero h1 { font-size: 28px; }
  .hero { padding: 48px 0 36px; }
  .search-row { flex-direction: column; align-items: stretch; }
  .search-row .btn-lg { width: 100%; }
  .hero-stats { gap: 26px; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .result-card { flex-wrap: wrap; }
  .rc-actions { width: 100%; justify-content: flex-end; }
  .dash-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 480px) {
  .hero-stats { gap: 18px; }
  .hero-stats .stat b { font-size: 20px; }
  .pv-actions { flex-wrap: wrap; }
  .modal-preview { width: 100vw; max-width: none; }
  .modal-preview .modal-body { padding: 10px 8px 0; }
  .pv-body iframe { height: 66vh; min-height: 320px; }
}
