/* ============================================================
   CowAgent Premium Design System v2.0
   Tech Luxury — 深色玻璃质感 + 霓虹渐变 + 精致动效
   ============================================================ */

/* 2026-09-14 性能精简：移除 Google Fonts @import。
   原 @import 是 <head> 内 CSS 的外链 @import，属渲染阻塞链：
   /chat → premium.css → fonts.googleapis.com（实测 155KB 传输 / 571KB 解码，
   再拉 fonts.gstatic.com）——国内访问慢或不通时首屏被整体拖住。
   项目已有本地自托管 Inter（static/vendor/fonts/inter/inter.css，见其文件头
   说明「redistributed locally to avoid runtime dependency on fonts.googleapis.com」），
   中文改由系统字体承担，与全站既有 fallback 行为一致。
   JetBrains Mono / Noto Sans SC 仍保留在字体栈内：本机已装则命中，未装则回落。 */

:root {
  /* === 核心深色背景 === */
  --bg-primary: #0a0a0f;
  --bg-secondary: #0f0f18;
  --bg-tertiary: #14141f;
  --bg-card: rgba(20, 20, 35, 0.6);
  --bg-card-hover: rgba(25, 25, 45, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-border: rgba(255, 255, 255, 0.08);

  /* === 霓虹强调色 === */
  --neon-blue: #00d4ff;
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-green: #10b981;
  --neon-amber: #f59e0b;
  --neon-red: #ef4444;

  /* === 渐变组合 === */
  --gradient-cool: linear-gradient(135deg, #00d4ff 0%, #a855f7 50%, #ec4899 100%);
  --gradient-blue-purple: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --gradient-green-blue: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --gradient-amber-red: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  --gradient-mesh: radial-gradient(ellipse at 20% 50%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
                   radial-gradient(ellipse at 80% 20%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
                   radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);

  /* === 文字层级 === */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #00d4ff;

  /* === 阴影与发光 === */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(0, 212, 255, 0.3);
  --shadow-glow-purple: 0 0 20px rgba(168, 85, 247, 0.3);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.3);

  /* === 圆角 === */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* === 动效 === */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;

  /* === 字体 === */
  --font-display: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* === 基础重置 === */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-display);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* === 背景网格装饰 === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-mesh);
  pointer-events: none;
  z-index: 0;
}

/* === 玻璃质感卡片 === */
.premium-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.premium-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* === 发光边框卡片 === */
.glow-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-glass-border);
  overflow: hidden;
}

.glow-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-cool);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out-expo);
}

.glow-card:hover::before {
  opacity: 0.5;
}

/* === 霓虹文字 === */
.neon-text {
  background: var(--gradient-cool);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === 徽章/标签 === */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.025em;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--neon-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--neon-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-blue {
  background: rgba(0, 212, 255, 0.15);
  color: var(--neon-blue);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

/* === 按钮系统 === */
.premium-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.premium-btn-primary {
  background: var(--gradient-blue-purple);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.premium-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.4);
}

.premium-btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--bg-glass-border);
}

.premium-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* === 滚动条 === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* === 动画 */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 212, 255, 0.3); }
  50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.6); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-out-expo) both;
}

.animation-delay-100 { animation-delay: 100ms; }
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-300 { animation-delay: 300ms; }
.animation-delay-400 { animation-delay: 400ms; }

/* === 侧边栏图标发光 === */
.sidebar-item:hover .item-icon,
.sidebar-item.active .item-icon {
  filter: drop-shadow(0 0 6px currentColor);
}

.sidebar-item.active {
  background: var(--bg-glass);
}

.sidebar-item.active .item-icon {
  color: var(--neon-blue);
}

/* === 数据统计大数字 === */
.stat-large {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === 分隔线 === */
.divider-gradient {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bg-glass-border), transparent);
  margin: 16px 0;
}

/* === 顶部导航栏 === */
.top-bar {
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bg-glass-border);
}

/* === 搜索框 === */
.premium-search {
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 13px;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.premium-search:focus {
  outline: none;
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.premium-search::placeholder {
  color: var(--text-muted);
}

/* ============================================================
   浅色主题 token 双态（审计 A-2 / §2.8.2 浅色主题结论 (c)）
   --neon-* / --gradient-* / --shadow-glow-* 语义上是深色玻璃底的
   霓虹 token；浅色下覆盖为同色相 600/700 阶，白底对比度全部 ≥4.5:1：
     green #047857 ≈5.0:1 · amber #b45309 ≈5.1:1 · purple #7e22ce ≈6.0:1
     cyan #0e7490  ≈5.3:1 · blue #0284c7  ≈4.9:1 · pink #be185d ≈6.4:1
     red  #dc2626  ≈4.5:1
   深色不受影响（:root 定义仍生效）。
   ============================================================ */
html:not(.dark) {
  --neon-blue: #0284c7;
  --neon-purple: #7e22ce;
  --neon-pink: #be185d;
  --neon-green: #047857;
  --neon-amber: #b45309;
  --neon-red: #dc2626;
  --text-accent: #0284c7;
  --gradient-cool: linear-gradient(135deg, #0284c7 0%, #7e22ce 50%, #be185d 100%);
  --gradient-blue-purple: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --gradient-green-blue: linear-gradient(135deg, #047857 0%, #0e7490 100%);
  --gradient-amber-red: linear-gradient(135deg, #b45309 0%, #dc2626 100%);
  --shadow-glow-blue: none;
  --shadow-glow-purple: none;
  --shadow-glow-green: none;
}

/* 浅色 .neon-text：去掉透明字渐变，回退为可读纯色
   （防 background-clip 不支持时 -webkit-text-fill-color:transparent 整字隐形，
    见审计 §2.8.2 浅色结论 (d)） */
html:not(.dark) .neon-text {
  background: none;
  -webkit-text-fill-color: initial;
  color: #15803d;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .neon-text {
    background: none;
    -webkit-text-fill-color: initial;
    color: var(--neon-green);
  }
}
