/* ============================================================
   聪策略 · theme.css — 全站统一设计系统（新标准 · 根路径）
   v2026-07-12  统一的视觉与令牌基座，供 /components.css 与所有
   新标准页面（zcfz 等）直接引用。旧模块（css/theme.css）仅作
   历史兼容，新页面一律以本文件为唯一权威来源。
   ============================================================ */

/* ── Google Fonts ── */

/* ============================================================
   一、设计 Token（CSS 变量）
   ============================================================ */
:root {
  /* 主色调 */
  --bg:            #fefaf6;
  --surface:       #ffffff;
  --ink:           #2d2a26;
  --ink-soft:      #6b6560;
  --muted:         #a09890;
  --border:        #e8e0d8;
  --border-light:  #f0eae4;
  --accent:        #e8652d;
  --accent-hover:  #d4541e;
  --accent-soft:   rgba(232,101,45,0.08);
  --accent-bg:     #fff3ed;
  --green:         #3b9b6e;
  --green-bg:      #edf7f1;
  --red:           #d94343;
  --red-bg:        #fef0f0;
  --blue:          #4a90c4;
  --blue-bg:       #eef5fa;
  /* orange aliases */
  --orange:        #e8652d;
  --orange-deep:   #d4541e;
  --orange-light:  #fff3ed;
  --orange-bg:     rgba(232,101,45,.07);
  --border-strong: #ddd9d1;
  --gold:          #b08a3e;
  --warm-surface:  #faf6f0;
  --warm-dark:     #3d3832;
  --shadow:        0 1px 2px rgba(45,42,38,0.04), 0 4px 16px rgba(45,42,38,0.05);
  --shadow-hover:  0 2px 4px rgba(45,42,38,0.05), 0 12px 32px rgba(45,42,38,0.08);

  /* 字体 */
  --display: 'Songti SC', 'STSong', 'SimSun', Georgia, serif;
  --body:    -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;

  /* 间距 (8px 体系) */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 20px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;
  --spacing-3xl: 40px;
  --spacing-4xl: 48px;
  --spacing-5xl: 64px;
  --spacing-6xl: 80px;

  /* 圆角 */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;          /* 基础圆角（组件默认） */
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* ============================================================
   二、深色主题
   ============================================================ */
[data-theme="dark"] {
  --bg:            #1a1817;
  --surface:       #262422;
  --ink:           #e8e4e0;
  --ink-soft:      #a09890;
  --muted:         #6b6560;
  --border:        #3d3832;
  --border-light:  #33302d;
  --accent-soft:   rgba(232,101,45,0.12);
  --accent-bg:     rgba(232,101,45,0.15);
  --warm-surface:  #2d2a26;
  --warm-dark:     #141312;
  --shadow:        0 2px 12px rgba(0,0,0,0.2);
  --shadow-hover:  0 6px 24px rgba(0,0,0,0.3);
  --green-bg:      rgba(59,155,110,0.12);
  --red-bg:        rgba(217,67,67,0.12);
  --blue-bg:       rgba(74,144,196,0.12);
}

/* ============================================================
   三、全局重置
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ============================================================
   四、布局工具类
   ============================================================ */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px; }
@media (max-width: 480px) { .wrap { padding: 0 16px; } }

section { padding: 80px 0; }
@media (max-width: 768px) { section { padding: 48px 0; } }
@media (max-width: 480px) { section { padding: 40px 0; } }

/* 区块标题区 */
.section-header { text-align: center; margin-bottom: 48px; }
.section-label {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  border-radius: 999px;
}
.section-title {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
  margin: 12px 0 14px;
  color: var(--ink);
}
.section-desc { color: var(--ink-soft); max-width: 48ch; margin: 0 auto; line-height: 1.6; font-size: 15px; }

/* ============================================================
   五、按钮系统
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.18s ease;
  font-family: var(--body);
  line-height: 1.4;
  white-space: nowrap;
}
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(232,101,45,.25); }
.btn-outline { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); padding: 8px 16px; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: 14px; }
.btn:disabled, .btn.loading { opacity: 0.6; pointer-events: none; }

/* ============================================================
   六、卡片系统
   ============================================================ */

/* 功能卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 860px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .card-grid { grid-template-columns: 1fr; } }

/* 功能卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}
.card-link { cursor: pointer; }
.card-link:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-hover); }
.card-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.card-badge {
  position: absolute; top: 16px; right: 16px;
  font-size: 11px; color: var(--muted);
  background: var(--warm-surface);
  border: 1px solid var(--border-light);
  padding: 3px 9px; border-radius: 999px;
}
.card h4 { font-family: var(--display); font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.card p { flex: 1; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.card-more { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--accent); }
.card-more .arr { transition: transform 0.2s; display: inline-block; }
.card-link:hover .card-more .arr { transform: translateX(3px); }

/* 数据卡片（工具页内用） */
.data-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.data-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.data-card-title { font-family: var(--display); font-size: 18px; font-weight: 700; }
.data-card-value { font-family: var(--display); font-size: 28px; font-weight: 700; color: var(--accent); }
.data-card-sub { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

/* ============================================================
   七、表单系统
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.form-input {
  width: 100%; height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--body);
  color: var(--ink);
  background: var(--surface);
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-input::placeholder { color: var(--muted); }
.form-error { color: var(--red); font-size: 13px; margin-top: 4px; }
.form-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ============================================================
   八、弹窗系统
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  max-width: min(420px, 92vw);
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--warm-surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--border); color: var(--ink); }
.modal-title { font-family: var(--display); font-size: 22px; font-weight: 700; margin-bottom: 8px; text-align: center; }
.modal-subtitle { color: var(--ink-soft); font-size: 14px; text-align: center; margin-bottom: 24px; }

/* ============================================================
   九、顶栏（Header）+ 导航
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(254,250,246,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}
[data-theme="dark"] .site-header { background: rgba(26,24,23,0.88); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}
@media (max-width: 480px) { .header-inner { padding: 0 16px; } }

.header-logo {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.header-logo img { width: 32px; height: 32px; border-radius: 8px; }

.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all 0.15s;
}
.header-nav a:hover, .header-nav a.active { color: var(--accent); background: var(--accent-soft); }

.header-actions { display: flex; align-items: center; gap: 8px; }

/* 用户菜单 */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  font-family: var(--body);
}
.user-menu-dropdown {
  display: none;
  position: absolute; top: 100%; right: 0;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  min-width: 160px;
  box-shadow: var(--shadow-hover);
}
.user-menu-dropdown.active { display: block; }
.user-menu-dropdown a, .user-menu-dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--body);
}
.user-menu-dropdown a:hover, .user-menu-dropdown button:hover { background: var(--accent-soft); color: var(--accent); }

/* 汉堡菜单（移动端） */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border: none; background: none;
  cursor: pointer; padding: 0;
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--ink); position: relative; transition: 0.2s; }
.hamburger span::before, .hamburger span::after { content: ''; display: block; width: 20px; height: 2px; background: var(--ink); position: absolute; transition: 0.2s; }
.hamburger span::before { top: -6px; }
.hamburger span::after { top: 6px; }

/* 移动端导航 */
.mobile-nav {
  display: none;
  position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 99;
  padding: 20px;
  flex-direction: column;
  gap: 4px;
}
.mobile-nav.active { display: flex; }
.mobile-nav a {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.mobile-nav a:hover, .mobile-nav a.active { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 768px) {
  .header-nav { display: none; }
  .hamburger { display: flex; }
}

/* ============================================================
   十、页脚
   ============================================================ */
.site-footer {
  background: var(--warm-dark);
  color: rgba(255,255,255,0.65);
  padding: 48px 0 32px;
  font-size: 14px;
}
.site-footer a { color: rgba(255,255,255,0.75); transition: color 0.2s; }
.site-footer a:hover { color: #fff; }
.footer-inner {
  max-width: 1080px; margin: 0 auto;
  padding: 0 28px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 20px;
}
.footer-brand { font-family: var(--display); font-size: 18px; color: #fff; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-copy { color: rgba(255,255,255,0.4); font-size: 13px; }
@media (max-width: 480px) { .footer-inner { flex-direction: column; text-align: center; } }

/* ============================================================
   十一、工具类
   ============================================================ */
/* 状态标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-accent { background: var(--accent-bg); color: var(--accent); }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

/* 加载动画 */
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* Loading 全屏 */
.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 0;
}
.loading-overlay .spinner { width: 32px; height: 32px; border-width: 3px; }

/* Toast */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-hover);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}
.toast-success { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.toast-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-light); }
.data-table th { font-weight: 600; color: var(--ink-soft); font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tr:hover td { background: var(--accent-soft); }
.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border-light); margin-bottom: 24px; }
.tab {
  padding: 10px 20px; font-size: 14px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.15s; font-family: var(--body);
}
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 24px; }
.page-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); font-size: 14px; cursor: pointer;
  color: var(--ink); font-family: var(--body);
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 响应式表格 */
@media (max-width: 768px) {
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 10px 12px; }
}

/* Flex 工具 */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--muted); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ═══════════════════════════════════════════════════════════
   Mobile & WeChat Optimization (v2026-07-15)
   ═══════════════════════════════════════════════════════════ */

/* Design Tokens 扩展 */
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* 微信内置浏览器 + iOS WKWebView 平滑滚动 */
html {
  -webkit-overflow-scrolling: touch;
}

/* iOS 输入框聚焦防缩放 — 所有输入控件最小 16px */
input, select, textarea {
  font-size: 16px;
}

/* 按钮最小触摸目标 (Apple HIG: 44x44) */
@media (max-width: 768px) {
  .btn, button, [role="button"], .icon-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* 尊重用户动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 页脚移动端优化 */
@media (max-width: 480px) {
  .site-footer {
    padding: 32px 0 24px;
    font-size: 13px;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
    padding: 0 16px;
  }
  .footer-links {
    justify-content: center;
    gap: 16px;
  }
}

/* wrap 容器移动端收紧 */
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
}

/* 微信浏览器 100vh 修复（配合 shared.js 中 --vh 变量） */
.in-wechat {
  min-height: calc(var(--vh, 1vh) * 100);
}
