/* ============================================================
   工艺工作量与专家信息展示站
   版本: 0.1.0
   说明: 全站公共样式（CSS 变量 / 布局 / 导航 / 表格 / 表单 / 卡片 / 弹窗 / 响应式）
   ============================================================ */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --color-bg: #f3f5f9;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 12px rgba(15, 23, 42, .05);
  --font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部导航 ---------- */
.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 15px;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.nav-links a:hover { background: var(--color-primary-light); color: var(--color-primary); }
.nav-links a.active { background: var(--color-primary); color: #fff; font-weight: 600; }

/* ---------- 主体布局 ---------- */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 40px;
  flex: 1;
}
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 24px; margin-bottom: 4px; }
.page-header p { color: var(--color-text-secondary); font-size: 14px; }

/* ---------- 卡片 / 面板 ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h2::before {
  content: "";
  width: 4px; height: 16px;
  background: var(--color-primary);
  border-radius: 2px;
  display: inline-block;
}

/* ---------- 统计指标 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.stat-item .stat-label { font-size: 13px; color: var(--color-text-secondary); }
.stat-item .stat-value { font-size: 26px; font-weight: 700; color: var(--color-primary); margin-top: 2px; }
.stat-item .stat-unit { font-size: 13px; color: var(--color-text-secondary); font-weight: 400; }

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field label { font-size: 13px; color: var(--color-text-secondary); font-weight: 500; }
.form-field input,
.form-field select,
.form-field textarea {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--color-text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-actions { display: flex; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline {
  background: #fff; color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary-light); }
.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 560px;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.data-table th {
  background: #f8fafc;
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty {
  text-align: center;
  color: var(--color-text-secondary);
  padding: 32px 0 !important;
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  margin: 2px 4px 2px 0;
}
.tag-green { background: #dcfce7; color: #166534; }
.tag-orange { background: #ffedd5; color: #9a3412; }

/* ---------- 图表 ---------- */
.chart-container { display: flex; flex-wrap: wrap; gap: 20px; }
.chart-box { flex: 1 1 320px; min-width: 280px; }
.chart-box h3 { font-size: 14px; color: var(--color-text-secondary); margin-bottom: 10px; font-weight: 600; }
.chart-svg { width: 100%; height: auto; display: block; }

/* ---------- 专家卡片 ---------- */
.expert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.expert-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.expert-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(15, 23, 42, .12); }
.expert-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.expert-card-head h3 { font-size: 16px; }
.expert-card-head .expert-title { font-size: 12px; color: var(--color-text-secondary); }
.expert-card .expert-intro {
  font-size: 13px;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}
.expert-card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--color-surface);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: var(--color-bg);
  cursor: pointer;
  font-size: 16px;
  color: var(--color-text-secondary);
}
.modal-close:hover { background: var(--color-border); }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.detail-row { display: flex; margin-bottom: 10px; font-size: 14px; }
.detail-row .dt { width: 84px; color: var(--color-text-secondary); flex-shrink: 0; }
.detail-row .dd { flex: 1; word-break: break-all; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--color-text);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  transition: all .3s;
  z-index: 300;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 页脚 ---------- */
.site-footer {
  text-align: center;
  padding: 18px;
  font-size: 12px;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .navbar-inner { padding: 0 12px; height: auto; flex-direction: column; align-items: stretch; gap: 4px; padding-bottom: 8px; }
  .nav-brand { justify-content: center; padding-top: 8px; }
  .nav-links { justify-content: center; }
  .container { padding: 16px 12px 32px; }
  .page-header h1 { font-size: 20px; }
  .form-actions { flex-direction: column; }
  .btn { width: 100%; }
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-row .dt { width: auto; }
}
