/* ==================================
   Deepsea - Base Styles
   深海暗池基础样式系统
   ================================== */

/* ========== CSS Custom Properties ========== */
:root {
  /* === Color Palette === */
  /* Abyss Gradient 深海渐变 */
  --color-abyss-dark: #040B16;
  --color-abyss-mid: #021A2D;

  /* Primary Colors 主色 */
  --color-primary: #1AA7D6;
  --color-primary-light: #2BC4F4;
  --color-primary-dark: #157BA3;

  /* Secondary Colors 次级色 */
  --color-secondary: #32FCE0;
  --color-secondary-light: #5FFDE9;
  --color-secondary-dark: #1EDAC2;

  /* Accent Colors 强调色 */
  --color-accent: #FF9E4D;
  --color-accent-light: #FFB770;
  --color-accent-dark: #E68539;

  /* Status Colors 状态色 */
  --color-success: #39E68F;
  --color-warning: #FFB648;
  --color-error: #FF4D6D;
  --color-info: #1AA7D6;

  /* Neutral Colors 中性色 */
  --color-text-primary: #F5F8FC;
  --color-text-secondary: #A9BCD6;
  --color-text-muted: #6B7F9D;
  --color-text-inverse: #040B16;

  /* Background Colors */
  --color-bg-primary: #040B16;
  --color-bg-secondary: #0A1628;
  --color-bg-tertiary: #142238;
  --color-bg-card: rgba(26, 167, 214, 0.05);
  --color-bg-overlay: rgba(4, 11, 22, 0.95);

  /* Border Colors */
  --color-border: rgba(169, 188, 214, 0.15);
  --color-border-hover: rgba(169, 188, 214, 0.3);
  --color-border-focus: var(--color-primary);

  /* === Typography === */
  /* Font Families */
  --font-display: 'Orbitron', 'SF Pro Display', -apple-system, system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  --font-chinese: 'Source Han Sans SC', 'Noto Sans SC', sans-serif;

  /* Font Sizes */
  --font-size-h1: 3rem;        /* 48px */
  --font-size-h2: 2rem;        /* 32px */
  --font-size-h3: 1.5rem;      /* 24px */
  --font-size-h4: 1.25rem;     /* 20px */
  --font-size-h5: 1.125rem;    /* 18px */
  --font-size-body: 1rem;      /* 16px */
  --font-size-small: 0.875rem; /* 14px */
  --font-size-xs: 0.75rem;     /* 12px */

  /* Font Weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* === Spacing === */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  --space-4xl: 6rem;     /* 96px */

  /* === Border Radius === */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* === Shadows === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.25);
  --shadow-glow-primary: 0 0 20px rgba(26, 167, 214, 0.3);
  --shadow-glow-secondary: 0 0 20px rgba(50, 252, 224, 0.3);
  --shadow-glow-accent: 0 0 20px rgba(255, 158, 77, 0.3);

  /* === Transitions === */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;
  --transition-ocean: 800ms cubic-bezier(0.4, 0, 0.2, 1);

  /* === 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;
}

/* ========== Reset & Base Styles ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: linear-gradient(180deg, var(--color-abyss-dark) 0%, var(--color-abyss-mid) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 中文字体优化 */
body:lang(zh), body:lang(zh-CN) {
  font-family: var(--font-chinese), var(--font-body);
}

/* Noise Texture Overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-md);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--font-size-h1);
}

h2 {
  font-size: var(--font-size-h2);
}

h3 {
  font-size: var(--font-size-h3);
}

h4 {
  font-size: var(--font-size-h4);
}

h5 {
  font-size: var(--font-size-h5);
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-primary-light);
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

em, i {
  font-style: italic;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-bg-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  color: var(--color-secondary);
}

pre {
  background: var(--color-bg-tertiary);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

pre code {
  background: none;
  padding: 0;
}

/* 数字使用等宽字体 */
.num, .price, .odds, .metric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ========== Lists ========== */
ul, ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

li {
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
}

ul.unstyled, ol.unstyled {
  list-style: none;
  padding-left: 0;
}

/* ========== Images & Media ========== */
img, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

/* ========== Tables ========== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-lg);
}

th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
}

td {
  color: var(--color-text-secondary);
}

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

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

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

/* ========== Utility Classes ========== */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-sm {
  max-width: 960px;
}

.container-lg {
  max-width: 1680px;
}

/* Flexbox Utilities */
.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;
}

.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

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

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

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

/* Display Utilities */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* Visibility */
.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;
}

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.p-0 { padding: 0; }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* ========== Responsive Typography ========== */
@media (max-width: 992px) {
  :root {
    --font-size-h1: 2.5rem;  /* 40px */
    --font-size-h2: 1.75rem; /* 28px */
    --font-size-h3: 1.375rem; /* 22px */
  }
}

@media (max-width: 768px) {
  :root {
    --font-size-h1: 2rem;     /* 32px */
    --font-size-h2: 1.5rem;   /* 24px */
    --font-size-h3: 1.25rem;  /* 20px */
    --font-size-body: 0.9375rem; /* 15px */
  }

  .container {
    padding: 0 var(--space-md);
  }
}

@media (max-width: 576px) {
  :root {
    --font-size-h1: 1.75rem;  /* 28px */
    --font-size-h2: 1.375rem; /* 22px */
    --font-size-h3: 1.125rem; /* 18px */
  }
}
