/* ============================================================
   Design Tokens — Single source of truth for all design values.
   Import BEFORE styles.css to make tokens available everywhere.
   ============================================================ */

:root {
  /* === Core Palette === */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-elevated: #21262d;
  --border: #30363d;
  --border-bright: #484f58;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #c7c1c1;

  /* === Semantic Colors === */
  --green: #3fb950;
  --green-dim: #238636;
  --red: #f85149;
  --red-dim: #da3633;
  --blue: #58a6ff;
  --purple: #bc8cff;
  --yellow: #d29922;
  --gold: #e3b341;
  --orange: #f0883e;

  /* Primary accent */
  --accent: #58a6ff;

  /* Aliases for direction/sentiment */
  --positive: #3fb950;
  --negative: #f85149;

  /* Asset class colors */
  --color-stock: #58a6ff;
  --color-crypto: #f0883e;
  --color-forex: #bc8cff;

  /* Glow effects */
  --glow-green: 0 0 8px rgba(63, 185, 80, 0.3);
  --glow-blue: 0 0 8px rgba(88, 166, 255, 0.3);
  --glow-red: 0 0 8px rgba(248, 81, 73, 0.3);

  /* === Spacing Scale (4px base) === */
  --space-0: 0px;
  --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;

  /* === Typography Scale === */
  --text-xs: 10px;
  --text-sm: 11px;
  --text-base: 12px;
  --text-md: 13px;
  --text-lg: 14px;
  --text-xl: 16px;
  --text-2xl: 20px;
  --text-3xl: 24px;

  /* Font stacks */
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Line heights */
  --leading-tight: 1.2;
  --leading-normal: 1.4;
  --leading-relaxed: 1.6;

  /* === Layout === */
  --sidebar-w: 56px;
  /* matches styles.css */
  --header-h: 40px;
  --status-bar-h: 24px;

  /* === Radii === */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  /* === Shadows === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.4);
  /* legacy alias */

  /* === Transitions === */
  --transition-fast: 100ms ease;
  --transition-base: 150ms ease;
  --transition-slow: 300ms ease;
  --transition: 150ms ease;
  /* legacy alias */

  /* === Z-Index Scale === */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-overlay: 50;
  --z-modal: 100;
  --z-tooltip: 200;
  --z-toast: 300;
}

/* === Tooltip Popup Styles === */
.tooltip-popup {
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--z-tooltip);
  max-width: 280px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.tooltip-popup.visible {
  opacity: 1;
}

/* Help icon (?) */
.help-icon {
  display: inline-flex;
  /* align-items: center; */
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: var(--space-1);
  border-radius: var(--radius-full);
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  cursor: help;
  vertical-align: middle;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.help-icon:hover,
.help-icon:focus {
  color: var(--blue);
  border-color: var(--blue);
  outline: none;
}