/* 
 * Theme System
 * Based on DESIGN_STYLE.md
 * Single Source of Truth for Design Tokens
 */

:root {
  /* Typography */
  --font-primary:
    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Monaco, monospace;

  /* Type Scale */
  --text-xs: 10px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 20px;
  --text-3xl: 24px;
  --text-4xl: 30px;
  --text-5xl: 36px;

  /* Line Height */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Spacing System (4px baseline) */
  --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;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Layout */
  --nav-width: 1024px;
  --main-width: 720px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Color System - Light Mode (Default) */
  --ds-gray-50: #f9f9f9;
  --ds-gray-100: #f5f5f5;
  --ds-gray-200: #e0e0e0;
  --ds-gray-300: #d1d5db;
  --ds-gray-400: #9ca3af;
  --ds-gray-500: #757575; /* muted text */
  --ds-gray-600: #4b5563;
  --ds-gray-700: #424242; /* secondary text */
  --ds-gray-800: #212121;
  --ds-gray-900: #1a1a1a; /* primary text */
  --ds-gray-1000: #000000;

  /* Semantic Colors - Light */
  --theme-bg: #ffffff;
  --theme-bg-secondary: #f5f5f5;
  --theme-bg-tertiary: #f9f9f9;
  --theme-text-primary: var(--ds-gray-900);
  --theme-text-secondary: var(--ds-gray-700);
  --theme-text-muted: var(--ds-gray-500);
  --theme-border: var(--ds-gray-200);
  --theme-link: var(--ds-gray-700);

  --theme-primary: #424242;
  --theme-primary-hover: #212121;

  --theme-secondary: #e0e0e0;
  --theme-secondary-hover: #bdbdbd;
  --theme-secondary-text: #424242;

  --theme-danger: #f44336;
  --theme-danger-hover: #d32f2f;

  --theme-success: #4caf50;
  --theme-success-bg: #e8f5e8;
  --theme-success-text: #2e7d32;

  --theme-warning: #ff9800;
  --theme-warning-bg: #fff3e0;
  --theme-warning-text: #f57c00;

  /* Status Colors */
  --status-active-color: #10b981;
  --status-inactive-color: #ef4444;
  --status-warning-color: #f59e0b;

  /* Form Elements */
  --input-bg: #ffffff;
  --input-border: var(--ds-gray-200);
  --input-text: var(--ds-gray-700);
  --input-placeholder: var(--ds-gray-400);

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

/* Dark Mode Overrides */
[data-theme="dark"] {
  /* Grayscale Mapping Reversal */
  --ds-gray-50: #1d1e20;
  --ds-gray-100: #2a2a2a;
  --ds-gray-200: #4a4a4f;
  --ds-gray-300: #6b7280;
  --ds-gray-400: #9ca3af;
  --ds-gray-500: #a8a8a8;
  --ds-gray-700: #e0e0e0;
  --ds-gray-900: #f0f0f0;

  /* Semantic Colors - Dark */
  --theme-bg: #1d1e20;
  --theme-bg-secondary: #2a2a2a;
  --theme-bg-tertiary: #252628;
  --theme-text-primary: #f0f0f0;
  --theme-text-secondary: #e0e0e0;
  --theme-text-muted: #a8a8a8;
  --theme-border: #4a4a4f;
  --theme-link: #c0c0c0;

  --theme-primary: #e0e0e0;
  --theme-primary-hover: #ffffff;

  --theme-secondary: #4a4a4f;
  --theme-secondary-hover: #6b7280;
  --theme-secondary-text: #e0e0e0;

  --theme-danger: #ef5350;
  --theme-danger-hover: #e57373;

  --theme-success: #66bb6a;
  --theme-success-bg: rgba(102, 187, 106, 0.15);
  --theme-success-text: #81c784;

  --theme-warning: #ffa726;
  --theme-warning-bg: rgba(255, 167, 38, 0.15);
  --theme-warning-text: #ffb74d;

  /* Form Elements */
  --input-bg: #2d2d2d;
  --input-border: #404040;
  --input-text: #e0e0e0;
  --input-placeholder: #757575;

  /* Status Colors */
  --status-active-color: #34d399;
  --status-inactive-color: #f87171;
  --status-warning-color: #fbbf24;
}
