/* Discord Trader — Terminal Luxe Theme System
 * Matches crypto-trader aesthetic: Bloomberg density + luxury fintech
 * CSS Custom Properties for light/dark mode
 */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  color-scheme: dark light;

  /* Font Stacks — Terminal Luxe */
  --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* Font Sizes */
  --text-2xs: 0.625rem;     /* 10px */
  --text-xs: 0.6875rem;     /* 11px */
  --text-sm: 0.8125rem;     /* 13px */
  --text-base: 0.875rem;    /* 14px — tighter than before */
  --text-lg: 1rem;           /* 16px */
  --text-xl: 1.25rem;       /* 20px */
  --text-2xl: 1.5rem;       /* 24px */
  --text-3xl: 2rem;         /* 32px */
  --text-4xl: 2.5rem;       /* 40px */

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

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* Spacing Scale (4px base) */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;
  --space-1: 0.25rem;
  --space-1-5: 0.375rem;
  --space-2: 0.5rem;
  --space-2-5: 0.625rem;
  --space-3: 0.75rem;
  --space-3-5: 0.875rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;
  --radius-2xl: 14px;
  --radius-full: 9999px;

  /* Component Sizing (Compact) */
  --height-input: 30px;
  --height-input-sm: 24px;
  --height-input-lg: 38px;
  --height-button: 26px;
  --height-button-sm: 20px;
  --height-button-lg: 34px;
  --height-header: 44px;
  --height-tab-bar: 32px;
  --height-table-row: 44px;

  /* Widths */
  --width-modal-sm: 400px;
  --width-modal-md: 500px;
  --width-modal-lg: 640px;
  --width-modal-xl: 800px;
  --width-sidebar: 280px;

  /* Timing Functions */
  --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-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ── Dark Mode (default) — Midnight Terminal ── */
[data-theme="dark"] {
  /* Background Hierarchy */
  --bg-base: #080b12;
  --bg-elevated: #0d1117;
  --bg-surface: #151b24;
  --bg-hover: #1c2330;
  --bg-active: #242b38;

  /* Text Hierarchy */
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #484f58;
  --text-inverse: #080b12;

  /* Border & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Trading Colors — Cyan/Coral */
  --color-profit: #00d4aa;
  --color-profit-muted: #00b88a;
  --color-profit-bg: rgba(0, 212, 170, 0.12);
  --color-loss: #ff3b5c;
  --color-loss-muted: #e0334f;
  --color-loss-bg: rgba(255, 59, 92, 0.12);

  /* Status Colors */
  --color-info: #3b9eff;
  --color-info-bg: rgba(59, 158, 255, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-success: #00d4aa;
  --color-success-bg: rgba(0, 212, 170, 0.12);
  --color-danger: #ff3b5c;
  --color-danger-bg: rgba(255, 59, 92, 0.12);

  /* Accent Colors */
  --accent-primary: #3b9eff;
  --accent-primary-hover: #2b8ae6;
  --accent-primary-bg: rgba(59, 158, 255, 0.12);
  --accent-secondary: #7c6cff;

  /* Trading Mode Indicators — Blue/Amber */
  --mode-paper: #3b9eff;
  --mode-paper-bg: rgba(59, 158, 255, 0.12);
  --mode-live: #ff9f1a;
  --mode-live-bg: rgba(255, 159, 26, 0.12);

  /* Instrument Types */
  --color-calls: #3b9eff;
  --color-calls-bg: rgba(59, 158, 255, 0.12);
  --color-puts: #a78bfa;
  --color-puts-bg: rgba(167, 139, 250, 0.12);
  --color-shares: #7c6cff;
  --color-shares-bg: rgba(124, 108, 255, 0.12);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 30px rgba(0, 0, 0, 0.7);
}

/* ── Light Mode — Warm Parchment ── */
[data-theme="light"] {
  /* Background Hierarchy */
  --bg-base: #f6f5f0;
  --bg-elevated: #ffffff;
  --bg-surface: #fafaf8;
  --bg-hover: #f0eeea;
  --bg-active: #e8e6e2;

  /* Text Hierarchy */
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;

  /* Border & Dividers */
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.18);

  /* Trading Colors */
  --color-profit: #059669;
  --color-profit-muted: #10b981;
  --color-profit-bg: rgba(5, 150, 105, 0.08);
  --color-loss: #dc2626;
  --color-loss-muted: #ef4444;
  --color-loss-bg: rgba(220, 38, 38, 0.08);

  /* Status Colors */
  --color-info: #2563eb;
  --color-info-bg: rgba(37, 99, 235, 0.08);
  --color-warning: #d97706;
  --color-warning-bg: rgba(217, 119, 6, 0.08);
  --color-success: #059669;
  --color-success-bg: rgba(5, 150, 105, 0.08);
  --color-danger: #dc2626;
  --color-danger-bg: rgba(220, 38, 38, 0.08);

  /* Accent Colors */
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-bg: rgba(37, 99, 235, 0.08);
  --accent-secondary: #7c3aed;

  /* Trading Mode Indicators */
  --mode-paper: #2563eb;
  --mode-paper-bg: rgba(37, 99, 235, 0.08);
  --mode-live: #d97706;
  --mode-live-bg: rgba(217, 119, 6, 0.08);

  /* Instrument Types */
  --color-calls: #2563eb;
  --color-calls-bg: rgba(37, 99, 235, 0.08);
  --color-puts: #7c3aed;
  --color-puts-bg: rgba(124, 58, 237, 0.08);
  --color-shares: #4f46e5;
  --color-shares-bg: rgba(79, 70, 229, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 30px rgba(0, 0, 0, 0.15);
}

/* ── System preference fallbacks ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg-base: #080b12;
    --bg-elevated: #0d1117;
    --bg-surface: #151b24;
    --bg-hover: #1c2330;
    --bg-active: #242b38;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #484f58;
    --text-inverse: #080b12;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.14);
    --color-profit: #00d4aa;
    --color-profit-muted: #00b88a;
    --color-profit-bg: rgba(0, 212, 170, 0.12);
    --color-loss: #ff3b5c;
    --color-loss-muted: #e0334f;
    --color-loss-bg: rgba(255, 59, 92, 0.12);
    --color-info: #3b9eff;
    --color-info-bg: rgba(59, 158, 255, 0.12);
    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.12);
    --color-success: #00d4aa;
    --color-success-bg: rgba(0, 212, 170, 0.12);
    --color-danger: #ff3b5c;
    --color-danger-bg: rgba(255, 59, 92, 0.12);
    --accent-primary: #3b9eff;
    --accent-primary-hover: #2b8ae6;
    --accent-primary-bg: rgba(59, 158, 255, 0.12);
    --accent-secondary: #7c6cff;
    --mode-paper: #3b9eff;
    --mode-paper-bg: rgba(59, 158, 255, 0.12);
    --mode-live: #ff9f1a;
    --mode-live-bg: rgba(255, 159, 26, 0.12);
    --color-calls: #3b9eff;
    --color-calls-bg: rgba(59, 158, 255, 0.12);
    --color-puts: #a78bfa;
    --color-puts-bg: rgba(167, 139, 250, 0.12);
    --color-shares: #7c6cff;
    --color-shares-bg: rgba(124, 108, 255, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.04);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 20px 30px rgba(0, 0, 0, 0.7);
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg-base: #f6f5f0;
    --bg-elevated: #ffffff;
    --bg-surface: #fafaf8;
    --bg-hover: #f0eeea;
    --bg-active: #e8e6e2;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.18);
    --color-profit: #059669;
    --color-profit-muted: #10b981;
    --color-profit-bg: rgba(5, 150, 105, 0.08);
    --color-loss: #dc2626;
    --color-loss-muted: #ef4444;
    --color-loss-bg: rgba(220, 38, 38, 0.08);
    --color-info: #2563eb;
    --color-info-bg: rgba(37, 99, 235, 0.08);
    --color-warning: #d97706;
    --color-warning-bg: rgba(217, 119, 6, 0.08);
    --color-success: #059669;
    --color-success-bg: rgba(5, 150, 105, 0.08);
    --color-danger: #dc2626;
    --color-danger-bg: rgba(220, 38, 38, 0.08);
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-primary-bg: rgba(37, 99, 235, 0.08);
    --accent-secondary: #7c3aed;
    --mode-paper: #2563eb;
    --mode-paper-bg: rgba(37, 99, 235, 0.08);
    --mode-live: #d97706;
    --mode-live-bg: rgba(217, 119, 6, 0.08);
    --color-calls: #2563eb;
    --color-calls-bg: rgba(37, 99, 235, 0.08);
    --color-puts: #7c3aed;
    --color-puts-bg: rgba(124, 58, 237, 0.08);
    --color-shares: #4f46e5;
    --color-shares-bg: rgba(79, 70, 229, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 30px rgba(0, 0, 0, 0.15);
  }
}
