/**
 * Design Tokens System
 * Centralized design values using CSS Custom Properties
 * 
 * Benefits:
 * - Consistent design across the application
 * - Easy theme switching (light/dark)
 * - Runtime theme customization
 * - Better maintainability
 * 
 * Usage in Tailwind:
 * - bg-surface-primary ? var(--color-surface-primary)
 * - text-content-primary ? var(--color-content-primary)
 */

:root {
  /* ========================================
     Color Tokens - Light Theme (Default)
     ======================================== */
  
  /* Surface Colors - Backgrounds */
  --color-surface-primary: #ffffff;
  --color-surface-secondary: #f9fafb;      /* gray-50 */
  --color-surface-tertiary: #f3f4f6;       /* gray-100 */
  --color-surface-elevated: #ffffff;
  --color-surface-overlay: rgba(0, 0, 0, 0.5);
  
  /* Content Colors - Text */
  --color-content-primary: #111827;        /* gray-900 */
  --color-content-secondary: #374151;      /* gray-700 */
  --color-content-tertiary: #6b7280;       /* gray-500 */
  --color-content-muted: #9ca3af;          /* gray-400 */
  --color-content-inverse: #ffffff;
  
  /* Interactive Colors - Buttons, Links */
  --color-interactive-primary: #0d9488;    /* teal-600 */
  --color-interactive-primary-hover: #0f766e; /* teal-700 */
  --color-interactive-primary-active: #115e59; /* teal-800 */
  --color-interactive-secondary: #2563eb;  /* blue-600 */
  --color-interactive-secondary-hover: #1d4ed8; /* blue-700 */
  
  /* Accent Colors */
  --color-accent-success: #22c55e;         /* green-500 */
  --color-accent-warning: #eab308;         /* yellow-500 */
  --color-accent-error: #ef4444;           /* red-500 */
  --color-accent-info: #3b82f6;            /* blue-500 */
  
  /* Border Colors */
  --color-border-primary: #e5e7eb;         /* gray-200 */
  --color-border-secondary: #d1d5db;       /* gray-300 */
  --color-border-focus: #14b8a6;           /* teal-500 */
  
  /* ========================================
     Spacing Tokens
     Based on 4px grid (0.25rem)
     ======================================== */
  
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  
  /* Semantic Spacing */
  --space-xs: var(--space-1);
  --space-sm: var(--space-2);
  --space-md: var(--space-4);
  --space-lg: var(--space-6);
  --space-xl: var(--space-8);
  --space-2xl: var(--space-12);
  --space-3xl: var(--space-16);
  
  /* ========================================
     Typography Tokens
     ======================================== */
  
  /* Font Families */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 
               "Liberation Mono", "Courier New", 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 */
  
  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  
  /* ========================================
     Border Radius Tokens
     ======================================== */
  
  --radius-none: 0;
  --radius-sm: 0.125rem;  /* 2px */
  --radius-md: 0.375rem;  /* 6px */
  --radius-lg: 0.5rem;    /* 8px */
  --radius-xl: 0.75rem;   /* 12px */
  --radius-2xl: 1rem;     /* 16px */
  --radius-full: 9999px;
  
  /* ========================================
     Shadow Tokens
     ======================================== */
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* ========================================
     Transition Tokens
     ======================================== */
  
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 500ms;
  
  --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);
  
  /* ========================================
     Z-Index Tokens
     ======================================== */
  
  --z-base: 0;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-popover: 60;
  --z-tooltip: 70;
}

/* ========================================
   Dark Theme Overrides
   ======================================== */

.dark {
  /* Surface Colors */
  --color-surface-primary: #111827;        /* gray-900 */
  --color-surface-secondary: #1f2937;      /* gray-800 */
  --color-surface-tertiary: #374151;       /* gray-700 */
  --color-surface-elevated: #1f2937;
  --color-surface-overlay: rgba(0, 0, 0, 0.75);
  
  /* Content Colors */
  --color-content-primary: #f9fafb;        /* gray-50 */
  --color-content-secondary: #e5e7eb;      /* gray-200 */
  --color-content-tertiary: #9ca3af;       /* gray-400 */
  --color-content-muted: #6b7280;          /* gray-500 */
  --color-content-inverse: #111827;
  
  /* Interactive Colors */
  --color-interactive-primary: #2dd4bf;    /* teal-400 */
  --color-interactive-primary-hover: #14b8a6; /* teal-500 */
  --color-interactive-primary-active: #0d9488; /* teal-600 */
  --color-interactive-secondary: #60a5fa;  /* blue-400 */
  --color-interactive-secondary-hover: #3b82f6; /* blue-500 */
  
  /* Border Colors */
  --color-border-primary: #374151;         /* gray-700 */
  --color-border-secondary: #4b5563;       /* gray-600 */
  --color-border-focus: #2dd4bf;           /* teal-400 */
  
  /* Shadows - darker for dark mode */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

/* ========================================
   Utility Classes using Design Tokens
   ======================================== */

/* Background utilities */
.bg-surface-primary { background-color: var(--color-surface-primary); }
.bg-surface-secondary { background-color: var(--color-surface-secondary); }
.bg-surface-tertiary { background-color: var(--color-surface-tertiary); }
.bg-surface-elevated { background-color: var(--color-surface-elevated); }

/* Text utilities */
.text-content-primary { color: var(--color-content-primary); }
.text-content-secondary { color: var(--color-content-secondary); }
.text-content-tertiary { color: var(--color-content-tertiary); }
.text-content-muted { color: var(--color-content-muted); }

/* Interactive utilities */
.text-interactive-primary { color: var(--color-interactive-primary); }
.bg-interactive-primary { background-color: var(--color-interactive-primary); }
.hover\:bg-interactive-primary-hover:hover { background-color: var(--color-interactive-primary-hover); }

/* Border utilities */
.border-primary { border-color: var(--color-border-primary); }
.border-secondary { border-color: var(--color-border-secondary); }
.focus\:border-focus:focus { border-color: var(--color-border-focus); }

/* Spacing utilities */
.gap-token-sm { gap: var(--space-sm); }
.gap-token-md { gap: var(--space-md); }
.gap-token-lg { gap: var(--space-lg); }
.p-token-sm { padding: var(--space-sm); }
.p-token-md { padding: var(--space-md); }
.p-token-lg { padding: var(--space-lg); }
