/* =====================================================================
   统一设计系统组件类 (阶段5.1)
   与 app.css 现有设计令牌保持一致；仅固化此前缺失的规范类，
   已有类（.btn-primary / .badge-success / .card-hover / .empty-state /
   .shadow-brand 等）继续沿用 app.css，避免重复覆盖。
   引入方式：在 layouts 中 <link rel="stylesheet" href="/static/css/design-system.css">
   ===================================================================== */

/* ---------- 页面结构 ---------- */
.page-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:20px;flex-wrap:wrap}
.page-title{font-size:20px;font-weight:700;color:#0f172a;line-height:1.3}
.page-subtitle{font-size:13px;color:#64748b;margin-top:2px}

/* ---------- 指标卡 ---------- */
.stat-card{background:#fff;border:1px solid #e2e8f0;border-radius:16px;padding:20px;
  transition:transform .25s ease,box-shadow .25s ease,border-color .25s ease}
.stat-card:hover{transform:translateY(-2px);box-shadow:0 12px 30px -12px rgba(15,23,42,.18)}

/* ---------- 按钮（次级，中性） ---------- */
.btn-secondary{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:9px 16px;border-radius:12px;font-weight:600;background:#fff;color:#334155;
  border:1px solid #e2e8f0;box-shadow:0 4px 12px -6px rgba(15,23,42,.15);cursor:pointer;
  transition:.2s;text-decoration:none}
.btn-secondary:hover{border-color:#cbd5e1;background:#f8fafc}
.btn-secondary:disabled{opacity:.55;cursor:not-allowed}

/* ---------- 徽标（补全 warning / info） ---------- */
.badge-warning{display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:7px;
  font-size:12px;font-weight:600;background:#fef3c7;color:#b45309}
.badge-info{display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:7px;
  font-size:12px;font-weight:600;background:#dbeafe;color:#1d4ed8}

/* ---------- 表单元素 ---------- */
.form-label{display:block;font-size:13px;font-weight:600;color:#334155;margin-bottom:6px}
.form-help{font-size:12px;color:#94a3b8;margin-top:4px}
.form-error{font-size:12px;color:#be123c;margin-top:4px}

/* ---------- 通用间距/圆角（可选工具类） ---------- */
.radius-2xl{border-radius:16px}
.shadow-card{box-shadow:0 1px 3px rgba(15,23,42,.08),0 8px 24px -12px rgba(15,23,42,.12)}
.gap-section{margin-top:24px}

/* ---------- 评分色阶（统一映射，对应设计系统文档 §2.4） ----------
   单一事实来源：分数→颜色由 helpers.php 的 scoreLevel/scoreColorHex 决定，
   这里仅提供渲染类。页面禁止各自写三元取色。
   色阶：>=80 翠绿 / >=60 琥珀 / >0 玫红 / 0 灰 */
.score-text-high{color:#10b981}
.score-text-mid{color:#f59e0b}
.score-text-low{color:#f43f5e}
.score-text-zero{color:#94a3b8}

.score-chip{display:inline-flex;align-items:center;justify-content:center;min-width:34px;
  padding:2px 10px;border-radius:8px;font-weight:700;font-size:13px;line-height:1.4}
.score-chip.high{color:#047857;background:#d1fae5}
.score-chip.mid{color:#b45309;background:#fef3c7}
.score-chip.low{color:#be123c;background:#ffe4e6}
.score-chip.zero{color:#64748b;background:#f1f5f9}

/* 环形/条形进度分数（--ring-color 由 scoreColorHex() 注入） */
.score-ring{--ring-color:#94a3b8;width:120px;height:120px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:conic-gradient(var(--ring-color) calc(var(--p,0)*1%),#eef2f7 0);
  position:relative}
.score-ring::before{content:"";position:absolute;inset:12px;border-radius:50%;background:#fff}
.score-ring>span{position:relative;font-size:34px;font-weight:800;color:var(--ring-color)}

/* ---------- 统一空状态（自包含，对应整改方案 2.3.3） ---------- */
.geo-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;padding:48px 20px;color:#94a3b8}
.geo-empty__icon{font-size:34px;margin-bottom:10px;color:#cbd5e1}
.geo-empty__title{font-size:15px;font-weight:600;color:#475569;margin-bottom:4px}
.geo-empty__desc{font-size:13px;color:#94a3b8;max-width:360px;line-height:1.6;margin-bottom:14px}
.geo-empty__action{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}

/* ---------- 统一闪信（成功/错误/警告/信息，前台+用户中心+后台共用） ---------- */
.geo-flash{display:flex;align-items:center;gap:12px;padding:12px 16px;border-radius:14px;
  font-size:14px;font-weight:500;margin-bottom:18px;border:1px solid transparent;
  position:relative;animation:geo-flash-in .35s cubic-bezier(.16,1,.3,1)}
.geo-flash i:first-child{font-size:17px;flex-shrink:0}
.geo-flash>span{flex:1;line-height:1.5}
.geo-flash-close{margin-left:auto;background:transparent;border:none;cursor:pointer;
  opacity:.55;font-size:14px;padding:2px 4px;border-radius:6px;transition:.2s;flex-shrink:0}
.geo-flash-close:hover{opacity:1}
.geo-flash-success{background:#ecfdf5;border-color:#a7f3d0;color:#047857}
.geo-flash-success .geo-flash-close:hover{background:#d1fae5}
.geo-flash-error{background:#fef2f2;border-color:#fecaca;color:#b91c1c}
.geo-flash-error .geo-flash-close:hover{background:#fee2e2}
.geo-flash-warning{background:#fffbeb;border-color:#fde68a;color:#b45309}
.geo-flash-warning .geo-flash-close:hover{background:#fef3c7}
.geo-flash-info{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
.geo-flash-info .geo-flash-close:hover{background:#dbeafe}
@keyframes geo-flash-in{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}

/* ---------- 卡片 / 面板 / 仪表盘网格 ---------- */
.card-panel{background:#fff;border:1px solid #e2e8f0;border-radius:16px;padding:22px;
  box-shadow:0 1px 3px rgba(15,23,42,.06),0 8px 24px -16px rgba(15,23,42,.12)}
.card-panel__title{font-size:15px;font-weight:700;color:#0f172a;display:flex;align-items:center;gap:8px;margin-bottom:14px}
.card-panel__title i{color:#6366f1}
.dash-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px}
.table-row-hover tbody tr{transition:background-color .15s}
.table-row-hover tbody tr:hover{background:#f8fafc}
.section-gap{margin-top:28px}

/* ---------- 统一错误页（404 / 403 / 500 共用） ---------- */
.geo-error{max-width:520px;margin:0 auto;padding:56px 20px 64px;text-align:center;display:flex;flex-direction:column;align-items:center}
.geo-error__badge{width:120px;height:120px;border-radius:30px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#6366f1,#06b6d4);box-shadow:0 20px 45px -15px rgba(99,102,241,.55);
  margin-bottom:26px;position:relative}
.geo-error__badge i{font-size:46px;color:#fff}
.geo-error__badge span{position:absolute;bottom:-14px;right:-14px;min-width:46px;height:46px;padding:0 10px;border-radius:14px;
  background:#fff;border:1px solid #e2e8f0;box-shadow:0 8px 20px -10px rgba(15,23,42,.3);
  display:flex;align-items:center;justify-content:center;font-size:20px;font-weight:800;color:#6366f1}
.geo-error.rose .geo-error__badge{background:linear-gradient(135deg,#f43f5e,#fb7185);box-shadow:0 20px 45px -15px rgba(244,63,94,.5)}
.geo-error.rose .geo-error__badge span{color:#e11d48}
.geo-error.amber .geo-error__badge{background:linear-gradient(135deg,#f59e0b,#fbbf24);box-shadow:0 20px 45px -15px rgba(245,158,11,.5)}
.geo-error.amber .geo-error__badge span{color:#b45309}
.geo-error__title{font-size:24px;font-weight:800;color:#0f172a;margin-bottom:8px}
.geo-error__desc{font-size:14px;color:#64748b;line-height:1.7;max-width:380px;margin-bottom:26px}
.geo-error__actions{display:flex;gap:12px;flex-wrap:wrap;justify-content:center}

/* ---------- 侧边栏折叠（收起为图标栏，用户中心/后台共用） ---------- */
.geo-side{transition:width .2s ease}
.geo-side--collapsed{width:64px!important}
.geo-side--collapsed .geo-side-text{display:none}
.geo-side--collapsed .side-link,.geo-side--collapsed .admin-link{justify-content:center;padding-left:0;padding-right:0;white-space:nowrap;overflow:hidden}
.geo-side--collapsed .side-link i,.geo-side--collapsed .admin-link i{margin:0;opacity:1}
.geo-side--collapsed .group-label span,.geo-side--collapsed .admin-group-label span{display:none}
.geo-side--collapsed .group-label,.geo-side--collapsed .admin-group-label{justify-content:center;padding-left:0;padding-right:0}
.geo-side--collapsed .group-label i{display:none}
.geo-side--collapsed nav{padding-left:10px;padding-right:10px}
.geo-side--collapsed .mt-1{margin-top:2px}
.geo-side--collapsed .side-link span,.geo-side--collapsed .admin-link span{display:none}
/* 分组标题可点击按钮（手风琴触发区） */
.geo-group-btn,.admin-group-label{cursor:pointer;user-select:none}

/* ---------- 卡片小标题 / 滚动渐入动画 ---------- */
.card-title-sm{font-size:16px;font-weight:700;color:#0f172a;display:flex;align-items:center;gap:8px}
/* Alpine 初始化前隐藏带 x-cloak 的元素，避免闪烁 */
[x-cloak]{display:none !important}
/* 滚动渐入：仅 JS 添加 .reveal-ready 时隐藏，无 JS 时内容正常显示 */
.reveal-ready{opacity:0;transform:translateY(18px);transition:opacity .6s ease,transform .6s ease}
.reveal-in{opacity:1;transform:none}
@media (prefers-reduced-motion: reduce) {
  .reveal-ready{opacity:1;transform:none;transition:none}
}
