/**
 * common.css - 全站共享基础样式
 * 所有前台页面统一引用：<link rel="stylesheet" href="/css/common.css">
 * 包含：CSS 变量、reset、body、footer、toast、通用按钮/卡片/表单/Modal
 * 注意：Header/Nav 由 site-nav.js 自带样式注入，不在此处定义
 */

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

:root {
  --primary: #4f46e5; --primary-light: #6366f1; --primary-dark: #4338ca;
  --success: #10b981; --warning: #f59e0b; --danger: #ef4444;
  --bg: #f8fafc; --bg-soft: #eef2ff; --card: #fff;
  --text: #1e293b; --text-light: #475569; --muted: #64748b;
  --border: #e2e8f0; --border-light: #f1f5f9;
  --radius: 12px; --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 40px rgba(79,70,229,.08), 0 4px 16px rgba(0,0,0,.06);
  --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
  --gradient-soft: linear-gradient(135deg, #eef2ff 0%, #f3e8ff 100%);
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ─── 通用按钮 ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; white-space: nowrap; }
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-light); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ─── 通用卡片 ──────────────────────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.card-hover { transition: all .3s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* ─── 通用表单 ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.form-textarea { min-height: 96px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ─── 通用 Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all .2s; }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 90%; max-width: 480px; max-height: 90vh; overflow: auto; transform: translateY(12px); transition: transform .2s; }
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { border: none; background: transparent; font-size: 24px; cursor: pointer; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; }
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Toast（页面级，与 site-nav.js 注入的 toast 共用 .toast 类） ─────────────── */
.toast { position: fixed; top: 80px; right: 24px; padding: 12px 20px; background: #1e293b; color: #fff; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 9999; opacity: 0; transform: translateY(-8px); transition: all .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }

/* ─── 通用工具类 ─────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; font-weight: 700; }
.grad { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; } .mb-32 { margin-bottom: 32px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.hidden { display: none !important; }
/* 站点级 1200 宽内容容器：所有页面的 header / footer / hero / section 内部内容均受此约束 */
:root { --site-max-width: 1200px; --site-side-pad: 24px; }
.container, .container-narrow, .site-header-inner, .site-footer-inner, .site-content-wrap {
  width: 100%;
  max-width: var(--site-max-width);
  margin: 0 auto;
  padding-left: var(--site-side-pad);
  padding-right: var(--site-side-pad);
}
.sec { padding: 64px 0; }
.sec-title { text-align: center; font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.sec-desc { text-align: center; color: var(--muted); font-size: 16px; margin-bottom: 48px; }

/* ─── 空状态 / 加载 ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; color: var(--muted); }
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 16px; opacity: .4; }
.loading { text-align: center; padding: 60px; color: var(--muted); }
.loading-spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 详情视图（news/help/cases 共用） ─────────────────────────────────────── */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-size: 14px; cursor: pointer; margin-bottom: 24px; padding: 8px 14px; border-radius: 8px; background: var(--bg-soft); border: none; font-weight: 500; }
.back-link:hover { background: var(--primary); color: #fff; }
.detail-title { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1.3; margin-bottom: 16px; }
.detail-meta { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.detail-cat-tag, .detail-industry { display: inline-block; padding: 4px 12px; background: var(--bg-soft); color: var(--primary); font-size: 13px; font-weight: 500; border-radius: 20px; margin-bottom: 16px; }
.detail-content { font-size: 16px; line-height: 1.85; color: var(--text-light); }
.detail-content h1, .detail-content h2, .detail-content h3, .detail-content h4 { color: var(--text); margin: 24px 0 12px; line-height: 1.4; }
.detail-content p { margin-bottom: 16px; }
.detail-content img { max-width: 100%; border-radius: var(--radius); margin: 16px 0; }
.detail-content ul, .detail-content ol { margin: 12px 0 16px 24px; }
.detail-content li { margin-bottom: 6px; }
.detail-content code { background: var(--bg-soft); padding: 2px 6px; border-radius: 4px; font-size: 14px; }
.detail-content pre { background: var(--bg-soft); padding: 16px; border-radius: var(--radius); overflow-x: auto; margin: 16px 0; }

/* ─── 分页（news 等列表页共用） ─────────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 48px; }
.page-btn { min-width: 38px; height: 38px; border: 1px solid var(--border); background: #fff; color: var(--text-light); border-radius: 8px; cursor: pointer; font-size: 14px; 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: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Footer（全站统一） ─────────────────────────────────────────────────────── */
.footer { background: #fff; border-top: 1px solid var(--border); padding: 48px 0 24px; margin-top: 64px; }
.footer-inner { max-width: none; margin: 0; padding: 0; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
.footer-brand .logo-icon { width: 28px; height: 28px; }
.footer-brand .logo-icon svg { width: 16px; height: 16px; }
.footer-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text-light); text-decoration: none; font-size: 14px; transition: color .15s; }
.footer-links a:hover { color: var(--primary); }
.footer-col h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.footer-bottom { max-width: none; margin: 32px 0 0; padding-top: 24px; border-top: 1px solid var(--border-light); text-align: center; color: var(--muted); font-size: 13px; }

/* ─── 公共响应式 ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .sec-title { font-size: 26px; }
  .sec-desc { font-size: 14px; }
}
@media (max-width: 768px) {
  .footer { padding: 32px 0 16px; margin-top: 40px; }
  .footer-inner { gap: 20px; }
  .modal { width: 94%; max-width: none; }
  .modal-header { padding: 16px 20px; }
  .modal-body { padding: 20px; }
  .detail-title { font-size: 24px; }
  .detail-meta { flex-wrap: wrap; gap: 8px; font-size: 13px; }
  .pagination { gap: 4px; }
  .page-btn { min-width: 34px; height: 34px; font-size: 13px; }
}
@media (max-width: 640px) {
  :root { --site-side-pad: 16px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .sec { padding: 40px 0; }
  .sec-title { font-size: 22px; }
  .sec-desc { font-size: 14px; margin-bottom: 32px; }
  .modal { width: 96%; border-radius: 12px; }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; }
  .detail-title { font-size: 20px; }
  .detail-content { font-size: 14px; line-height: 1.7; }
  .back-link { font-size: 13px; padding: 6px 12px; }
  .btn { padding: 8px 16px; font-size: 13px; }
  .btn-lg { padding: 10px 24px; font-size: 14px; }
  .card { padding: 16px; }
  .toast { top: 70px; right: 12px; left: 12px; font-size: 13px; padding: 10px 14px; }
}
@media (max-width: 480px) {
  .page-btn { min-width: 30px; height: 30px; font-size: 12px; }
  .detail-content h1 { font-size: 20px; }
  .detail-content h2 { font-size: 18px; }
  .detail-content h3 { font-size: 16px; }
}
