/* ============================================================
   design-system.css — 设计系统规范 v2.0
   8px基线网格 · 语义化颜色 · 动效系统
   ============================================================ */

/* ── 间距系统 (8px基准) ── */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  
  /* ── 语义化颜色系统 ── */
  --color-success: #52c41a;
  --color-success-light: #f6ffed;
  --color-success-dark: #389e0d;
  
  --color-warning: #faad14;
  --color-warning-light: #fffbe6;
  --color-warning-dark: #d48806;
  
  --color-error: #f5222d;
  --color-error-light: #fff1f0;
  --color-error-dark: #cf1322;
  
  --color-info: #1677ff;
  --color-info-light: #e6f4ff;
  --color-info-dark: #0958d9;
  
  /* ── 灰度色阶 ── */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* ── 字体层级 (Type Scale) ── */
  --text-xs: 12px;    /* 辅助文字 */
  --text-sm: 13px;    /* 标签/说明 */
  --text-base: 15px;  /* 正文 */
  --text-lg: 17px;    /* 小标题 */
  --text-xl: 20px;    /* 中标题 */
  --text-2xl: 24px;   /* 大标题 */
  --text-3xl: 30px;   /* 主标题 */
  --text-4xl: 36px;   /* Hero标题 */
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* ── 圆角系统 ── */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  /* ── 阴影系统 ── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --shadow-primary: 0 4px 24px rgba(22,119,255,0.15);
  
  /* ── 动效时间曲线 ── */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
}

/* ── 实用工具类 ── */

/* 间距工具类 */
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }

.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Flex布局工具 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

/* 文字工具 */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* 文字截断 */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 卡片变体 */
.card-hover {
  transition: transform var(--duration-normal) var(--ease-default),
              box-shadow var(--duration-normal) var(--ease-default);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* 按钮变体 */
.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover {
  background: var(--color-success-dark);
}

.btn-warning {
  background: var(--color-warning);
  color: #fff;
}
.btn-warning:hover {
  background: var(--color-warning-dark);
}

/* 动画关键帧 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 动画工具类 */
.animate-pulse { animation: pulse 2s var(--ease-default) infinite; }
.animate-bounce { animation: bounce 1s var(--ease-bounce) infinite; }
.animate-slide-up { animation: slideUp var(--duration-slow) var(--ease-out); }
.animate-fade-in { animation: fadeIn var(--duration-normal) var(--ease-out); }

/* 数字高亮样式 - 用于计算结果 */
.number-highlight {
  font-family: 'SF Mono', Monaco, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
}

/* 结果卡片 - 税后工资高亮 */
.result-card-highlight {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-primary);
  position: relative;
  overflow: hidden;
}

.result-card-highlight::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 表单聚焦增强 */
.input-enhanced:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,0.1);
  transform: translateY(-1px);
  transition: all var(--duration-fast) var(--ease-out);
}

/* 地图城市标记脉冲 */
.map-marker-active {
  position: relative;
}
.map-marker-active::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary);
  transform: translate(-50%, -50%);
  animation: markerPulse 2s infinite;
}

@keyframes markerPulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* 表格行悬停效果 */
.table-row-hover {
  transition: background-color var(--duration-fast) var(--ease-default);
}
.table-row-hover:hover {
  background-color: var(--primary-light);
}

/* 加载状态 */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* 深色主题适配 */
[data-theme="dark"] {
  --gray-50: #0f172a;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748b;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--gray-700) 25%, var(--gray-600) 50%, var(--gray-700) 75%);
}
