/* ===== 26届 RDFZ-EDP 蹭饭地图 ===== */

/* ---------- 全局 ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --red:       #b71c1c;
  --red-dark:  #7f0000;
  --red-light: #fce4ec;
  --green:     #2e7d32;
  --green-bg:  #e8f5e9;
  --orange:    #e65100;
  --blue:      #1565c0;
  --blue-bg:   #e3f2fd;

  --bg:        #f4f5f7;
  --card:      #ffffff;
  --input:     #ffffff;
  --hover:     #f0f1f3;
  --th:        #f7f8fa;
  --row-hover: #fafbfc;
  --border:    #e2e5ea;
  --border-soft: #eef0f2;

  --text:      #1a1a2e;
  --text-soft: #5f6368;
  --muted:     #9aa0a6;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
               system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--red); text-decoration: underline; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  position: relative;
  z-index: 10;
}
.topbar .logo { width: 44px; height: 44px; flex-shrink: 0; }
.topbar h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.topbar .subtitle {
  font-size: 12px;
  opacity: .85;
  margin-top: 1px;
  font-weight: 400;
}
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  opacity: .9;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.topbar nav a:hover {
  background: rgba(255,255,255,.15);
  opacity: 1;
  text-decoration: none;
}

/* ---------- 容器 / 卡片 ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 24px 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-lg); }

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- 统计卡片 ---------- */
.stat-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 22px;
  min-width: 120px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.stat-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-box .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--red);
  line-height: 1.1;
}
.stat-box .lbl { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ---------- 地图 ---------- */
.map-layout { display: flex; gap: 20px; align-items: flex-start; }
.map-wrap { flex: 1; min-width: 0; }
.sidebar { width: 340px; flex-shrink: 0; position: sticky; top: 24px; }
#chart { width: 100%; height: 640px; }
.legend-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}

/* ---------- 省份人员侧栏 ---------- */
#sidebar-content { max-height: 620px; overflow-y: auto; }
.member-item {
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 2px;
  transition: background .15s;
}
.member-item:hover { background: var(--row-hover); border-radius: 6px; padding-left: 6px; }
.member-item:last-child { border-bottom: none; }
.member-item .m-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.member-item .m-meta { font-size: 12px; color: var(--muted); margin: 2px 0; }
.member-item .m-contact { font-size: 13px; line-height: 1.7; word-break: break-all; }

.tag {
  display: inline-block;
  background: var(--red-light);
  color: var(--red);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.form-field { display: flex; flex-direction: column; }
.form-field.full { grid-column: 1 / -1; }
.form-field label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-soft);
}
.form-field label .req { color: var(--red); margin-left: 2px; }
.form-field input,
.form-field select,
.form-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--input);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(183,28,28,.12);
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--muted); opacity: .7; }
.form-field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-field input[readonly] { background: var(--bg); cursor: default; }

/* 可搜索大学下拉 */
.combobox { position: relative; }
.combobox input { width: 100%; }
.combobox-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 270px;
  overflow-y: auto;
  background: var(--input);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 50;
  display: none;
  box-shadow: var(--shadow-lg);
}
.combobox-list.show { display: block; }
.combobox-item {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  transition: background .1s;
}
.combobox-item:last-child { border-bottom: none; }
.combobox-item:hover,
.combobox-item.active { background: var(--red-light); }
.combobox-item .cb-prov { color: var(--muted); font-size: 11px; margin-left: 8px; }

/* 开关行 */
.switch-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.switch-row input[type="checkbox"] { accent-color: var(--red); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); box-shadow: 0 2px 8px rgba(183,28,28,.3); }
.btn-ghost {
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--hover); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.btn-ok { background: var(--green); color: #fff; }
.btn-ok:hover { background: #1b5e20; }
.btn-no { background: var(--orange); color: #fff; }
.btn-no:hover { background: #bf360c; }
.actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 管理后台 ---------- */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--border);
}
.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--red);
  border-bottom-color: var(--red);
  font-weight: 700;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th,
table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  background: var(--th);
  font-weight: 700;
  color: var(--text-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
table.data tr:hover { background: var(--row-hover); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 登录 */
.login-box { max-width: 380px; margin: 40px auto; }
.login-box input { width: 100%; }

/* ---------- 提示 Toast ---------- */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { background: #c62828; color: #fff; }
.toast.ok  { background: var(--green); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 14px; }

/* ---------- 弹层（管理员编辑） ---------- */
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 900; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .map-layout { flex-direction: column; }
  .sidebar { width: 100%; flex-shrink: 1; position: static; }
  .sidebar #sidebar-content { max-height: 360px; }
  .form-grid { grid-template-columns: 1fr; }
  #chart { height: 480px; }
  .container { padding: 16px 12px; }
  .card { padding: 16px 18px; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 18px; }
  .topbar .subtitle { display: none; }
  .stat-box { padding: 12px 16px; min-width: 100px; }
  .stat-box .num { font-size: 24px; }
  .section-title { font-size: 15px; }
  .btn { padding: 9px 16px; font-size: 13px; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .topbar .logo { width: 32px; height: 32px; }
  .topbar nav a { font-size: 12px; padding: 5px 8px; }
  .container { padding: 10px 8px; }
  .card { padding: 14px; border-radius: var(--radius-sm); }
  #chart { height: 340px; }
  .stat-row { gap: 8px; }
  .stat-box { padding: 10px 12px; min-width: 80px; border-radius: var(--radius-sm); }
  .stat-box .num { font-size: 22px; }
  .stat-box .lbl { font-size: 11px; }
  .form-grid { gap: 12px; }
  .form-field input,
  .form-field select,
  .form-field textarea { padding: 8px 10px; font-size: 13px; }
  .combobox-list { max-height: 200px; }
  .toast { max-width: 90vw; font-size: 13px; padding: 10px 16px; }
  .login-box { margin: 20px 0; }
  .tabs { gap: 0; }
  .tab { padding: 8px 12px; font-size: 13px; }
  .actions { gap: 8px; }
}
