/**
 * Waywave 渡澜 - 设计系统基础样式
 * 包含：CSS 变量、Reset、基础排版、实用类
 */

/* ========================================
   1. CSS 变量 (Design Tokens)
   ======================================== */
:root {
    /* 品牌色 */
    --brand-primary: #a3e635;      /* 主色-酸橙绿：象征生长、活力与理性突破 */
    --brand-secondary: #0f766e;    /* 辅色-深青色：象征沉淀、稳重与深度 */
    --brand-accent: #facc15;       /* 强调色-香橼黄：用于高亮关键节点或成就 */
    
    /* 语义色 */
    --color-success: #4ade80;      /* 成功 - 明亮的翠绿 */
    --color-warning: #fbbf24;      /* 警告 - 琥珀金 */
    --color-error: #f87171;        /* 错误 - 柔和红 */
    --color-info: #38bdf8;         /* 信息 - 天空蓝 */
    
    /* 中性色（亮色模式） */
    --color-text-primary: #111827;     /* 主要文字 */
    --color-text-secondary: #4b5563;   /* 次要文字 */
    --color-text-muted: #9ca3af;       /* 辅助文字 */
    --color-border: #e5e7eb;           /* 边框 */
    --color-bg: #f9fafb;               /* 背景 */
    --color-bg-elevated: #ffffff;      /* 卡片背景 */
    --color-bg-hover: #f3f4f6;         /* 悬浮背景 */
    
    /* 深色模式色彩 */
    --dark-bg: #0a0a0f;
    --dark-bg-elevated: #12121a;
    --dark-bg-tertiary: #1a1a24;
    --dark-text-primary: #f0f0f5;
    --dark-text-secondary: #8b8b9e;
    --dark-text-muted: #5a5a6e;
    --dark-border: #2a2a3a;
    
    /* 间距系统（8px 基准） */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    
    /* 字号系统 */
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-size-4xl: 40px;
    
    /* 行高 */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* 字重 */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --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 -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 过渡动画 */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* 层级 */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-tooltip: 600;
    --z-toast: 700;
    
    /* 布局宽度 */
    --max-width-sm: 640px;
    --max-width-md: 768px;
    --max-width-lg: 1024px;
    --max-width-xl: 1200px;
    --max-width-2xl: 1440px;
}

/* ========================================
   2. 深色模式
   ======================================== */
body.theme-dark,
.theme-dark {
    --color-text-primary: var(--dark-text-primary);
    --color-text-secondary: var(--dark-text-secondary);
    --color-text-muted: var(--dark-text-muted);
    --color-border: var(--dark-border);
    --color-bg: var(--dark-bg);
    --color-bg-elevated: var(--dark-bg-elevated);
    --color-bg-hover: var(--dark-bg-tertiary);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ========================================
   3. CSS Reset
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Noto Sans SC', 'Sora', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

img, svg, video {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ========================================
   Iconify 图标全局样式
   ======================================== */
.iconify {
    display: inline-flex;
    vertical-align: middle;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

/* 图标与文字组合时的对齐修复 */
.iconify + span,
span + .iconify,
.iconify + :not(.iconify) {
    vertical-align: middle;
}

/* 按钮内图标样式 */
button .iconify,
.btn .iconify,
a .iconify {
    vertical-align: -0.125em;  /* 微调基线对齐 */
}

ul, ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* ========================================
   4. 排版
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--spacing-md);
    color: var(--color-text-secondary);
}

p:last-child {
    margin-bottom: 0;
}

strong, b {
    font-weight: var(--font-weight-semibold);
}

small {
    font-size: var(--font-size-sm);
}

/* ========================================
   5. 实用类
   ======================================== */

/* 文字对齐 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 文字颜色 */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-brand { color: var(--brand-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* 背景色 */
.bg-primary { background-color: var(--brand-primary); }
.bg-elevated { background-color: var(--color-bg-elevated); }

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }

/* Grid */
.grid { display: grid; }

/* 间距 */
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* Margin */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* Padding */
.p-0 { padding: 0; }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }

/* 尺寸 */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* 显示 */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }

/* 溢出 */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* 圆角 */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* 阴影 */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* 动画 */
.transition { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }

/* 容器 */
.container {
    width: 100%;
    max-width: var(--max-width-xl);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
}

/* 无障碍 - 仅屏幕阅读器可见 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   6. 动画关键帧
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes fadeInDown {
    from { 
        opacity: 0; 
        transform: translateY(-10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.animate-fade-in { animation: fadeIn var(--transition-normal) ease-out; }
.animate-fade-in-up { animation: fadeInUp var(--transition-normal) ease-out; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* ========================================
   7. 响应式断点工具
   ======================================== */
@media (max-width: 640px) {
    .sm\:hidden { display: none; }
}

@media (min-width: 641px) {
    .sm\:block { display: block; }
    .sm\:flex { display: flex; }
}

@media (max-width: 768px) {
    .md\:hidden { display: none; }
}

@media (min-width: 769px) {
    .md\:block { display: block; }
    .md\:flex { display: flex; }
}

