/* ===================================
   CSS Custom Properties (Variables)
   =================================== */

:root {
  /* Colors */
  --primary-color: #1e3a8a;      /* 科技蓝 - 主色调 */
  --primary-dark: #1e2a5a;       /* 深科技蓝 */
  --primary-light: #3b82f6;      /* 浅科技蓝 */
  --secondary-color: #f97316;    /* 活力橙 - 辅助色 */
  --secondary-dark: #ea580c;     /* 深活力橙 */
  --secondary-light: #fb923c;    /* 浅活力橙 */
  
  /* Text Colors */
  --text-primary: #1f2937;        /* 主要文字颜色 */
  --text-secondary: #6b7280;     /* 次要文字颜色 */
  --text-muted: #9ca3af;         /* 弱化文字颜色 */
  --text-inverse: #ffffff;       /* 反色文字 */
  --text-link: var(--primary-light); /* 链接颜色 */
  
  /* Background Colors */
  --bg-primary: #ffffff;         /* 主要背景 */
  --bg-secondary: #f9fafb;       /* 次要背景 */
  --bg-tertiary: #f3f4f6;        /* 三级背景 */
  --bg-dark: #1f2937;            /* 深色背景 */
  --bg-overlay: rgba(0, 0, 0, 0.5); /* 遮罩背景 */
  
  /* Border Colors */
  --border-primary: #e5e7eb;     /* 主要边框 */
  --border-secondary: #d1d5db;   /* 次要边框 */
  --border-light: #f3f4f6;       /* 浅色边框 */
  --border-focus: var(--primary-color); /* 焦点边框 */
  
  /* Status Colors */
  --success-color: #10b981;      /* 成功 */
  --warning-color: #f59e0b;      /* 警告 */
  --error-color: #ef4444;        /* 错误 */
  --info-color: #3b82f6;         /* 信息 */
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 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);
  
  /* Border Radius */
  --radius-sm: 0.25rem;          /* 4px */
  --radius-md: 0.375rem;         /* 6px */
  --radius-lg: 0.5rem;           /* 8px */
  --radius-xl: 0.75rem;          /* 12px */
  --radius-2xl: 1rem;            /* 16px */
  --radius-full: 9999px;
  
  /* Spacing */
  --spacing-xs: 0.25rem;         /* 4px */
  --spacing-sm: 0.5rem;           /* 8px */
  --spacing-md: 0.75rem;          /* 12px */
  --spacing-lg: 1rem;             /* 16px */
  --spacing-xl: 1.25rem;          /* 20px */
  --spacing-2xl: 1.5rem;         /* 24px */
  --spacing-3xl: 2rem;           /* 32px */
  --spacing-4xl: 2.5rem;          /* 40px */
  --spacing-5xl: 3rem;           /* 48px */
  --spacing-6xl: 4rem;           /* 64px */
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* Font Sizes */
  --text-xs: 0.75rem;            /* 12px */
  --text-sm: 0.875rem;           /* 14px */
  --text-base: 1rem;              /* 16px */
  --text-lg: 1.125rem;           /* 18px */
  --text-xl: 1.25rem;            /* 20px */
  --text-2xl: 1.5rem;            /* 24px */
  --text-3xl: 1.875rem;          /* 30px */
  --text-4xl: 2.25rem;           /* 36px */
  --text-5xl: 3rem;              /* 48px */
  --text-6xl: 3.75rem;           /* 60px */
  
  /* Font Weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-all: all var(--transition-normal);
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  
  /* Container */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;
  
  /* Breakpoints */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* Dark theme (future implementation) */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #0f172a;
    --border-primary: #374151;
    --border-secondary: #4b5563;
  }
}

/* ===================================
   Base Styles & Reset
   =================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Links */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: var(--transition-all);
}

a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Buttons */
button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  transition: var(--transition-all);
}

button:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

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

/* Form Elements */
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  transition: var(--transition-all);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Lists */
ul,
ol {
  list-style: none;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for better keyboard navigation */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ===================================
   Utility Classes
   =================================== */

/* Container */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--spacing-lg);
  padding-right: var(--spacing-lg);
}

@media (min-width: 640px) {
  .container {
    padding-left: var(--spacing-xl);
    padding-right: var(--spacing-xl);
  }
}

/* Text utilities */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-fill-color: transparent;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Spacing utilities */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.ml-0 { margin-left: 0; }
.mr-0 { margin-right: 0; }

.p-0 { padding: 0; }
.pt-0 { padding-top: 0; }
.pb-0 { padding-bottom: 0; }
.pl-0 { padding-left: 0; }
.pr-0 { padding-right: 0; }

/* Display utilities */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.grid { display: grid; }

/* Position utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Loading states */
.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* Transitions */
.fade-in {
  animation: fadeIn var(--transition-normal) ease-in-out;
}

.slide-up {
  animation: slideUp var(--transition-normal) ease-out;
}

/* ===================================
   Animations
   =================================== */

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  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%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -30px, 0);
  }
  70% {
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}