/**
 * Global Theme Variables
 * 
 * This file defines the design system for the entire application.
 * All colors, spacing, typography, and other design tokens are centralized here.
 * 
 * Usage: var(--variable-name)
 * Example: color: var(--color-primary);
 */

:root {
  /* ============================================
     COLOR PALETTE
     ============================================ */
  
  /* Primary Colors */
  --color-primary: dodgerblue;
  --color-primary-hover: #0066cc;
  --color-primary-light: #e7f3ff;
  --color-primary-dark: #0056b3;
  
  /* Secondary Colors */
  --color-secondary: #6c757d;
  --color-secondary-hover: #545b62;
  --color-secondary-light: #f8f9fa;
  
  /* Semantic Colors */
  --color-success: #28a745;
  --color-success-hover: #218838;
  --color-success-light: #d4edda;
  
  --color-danger: #dc3545;
  --color-danger-hover: #c82333;
  --color-danger-light: #f8d7da;
  
  --color-warning: #ffc107;
  --color-warning-hover: #e0a800;
  --color-warning-light: #fff3cd;
  
  --color-info: #17a2b8;
  --color-info-hover: #138496;
  --color-info-light: #d1ecf1;
  
  /* Neutral Colors */
  --color-white: #ffffff;
  --color-black: #000000;
  --color-gray-50: #f9f9f9;
  --color-gray-100: #f8f9fa;
  --color-gray-200: #e9ecef;
  --color-gray-300: #dee2e6;
  --color-gray-400: #ced4da;
  --color-gray-500: #adb5bd;
  --color-gray-600: #6c757d;
  --color-gray-700: #495057;
  --color-gray-800: #343a40;
  --color-gray-900: #212529;
  
  /* Text Colors */
  --color-text-primary: #212529;
  --color-text-secondary: #6c757d;
  --color-text-muted: #adb5bd;
  --color-text-inverse: #ffffff;
  --color-text-disabled: #6c757d;
  
  /* Background Colors */
  --color-bg-body: #f8f9fa;
  --color-bg-surface: #ffffff;
  --color-bg-hover: #f5f5f5;
  --color-bg-disabled: #e9ecef;
  
  /* Border Colors */
  --color-border-light: #e0e0e0;
  --color-border-medium: #ccc;
  --color-border-dark: #999;
  --color-border-disabled: #dee2e6;
  
  /* ============================================
     SPACING
     ============================================ */
  --spacing-xs: 0.25rem;    /* 4px */
  --spacing-sm: 0.5rem;     /* 8px */
  --spacing-md: 1rem;       /* 16px */
  --spacing-lg: 1.5rem;     /* 24px */
  --spacing-xl: 2rem;       /* 32px */
  --spacing-2xl: 3rem;      /* 48px */
  --spacing-3xl: 4rem;      /* 64px */
  
  /* ============================================
     TYPOGRAPHY
     ============================================ */
  --font-family-base: Arial, sans-serif;
  --font-family-heading: Arial, sans-serif;
  --font-family-mono: 'Courier New', monospace;
  
  /* Font Sizes */
  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 2rem;     /* 32px */
  
  /* 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;
  
  /* ============================================
     BORDERS & RADIUS
     ============================================ */
  --border-width-thin: 1px;
  --border-width-medium: 2px;
  --border-width-thick: 4px;
  
  --border-radius-sm: 4px;
  --border-radius-md: 6px;
  --border-radius-lg: 8px;
  --border-radius-xl: 12px;
  --border-radius-full: 50%;
  
  /* ============================================
     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);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 0 10px rgba(0, 0, 0, 0.08);
  
  /* ============================================
     TRANSITIONS
     ============================================ */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  
  /* ============================================
     Z-INDEX LAYERS
     ============================================ */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-tooltip: 1100;
  
  /* ============================================
     LAYOUT
     ============================================ */
  --container-max-width: 480px;
  --container-padding: var(--spacing-md);
  
  /* ============================================
     COMPONENT-SPECIFIC
     ============================================ */
  
  /* Buttons */
  --button-padding-y: 0.6rem;
  --button-padding-x: 1.5rem;
  --button-border-radius: var(--border-radius-sm);
  --button-font-weight: var(--font-weight-medium);
  
  /* Inputs */
  --input-padding-y: 0.6rem;
  --input-padding-x: 0.75rem;
  --input-border-color: var(--color-border-medium);
  --input-border-radius: var(--border-radius-sm);
  --input-focus-border-color: var(--color-primary);
  --input-focus-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
  
  /* Cards */
  --card-bg: var(--color-bg-surface);
  --card-padding: var(--spacing-md);
  --card-border-radius: var(--border-radius-lg);
  --card-shadow: var(--shadow-card);
  
  /* Modals */
  --modal-backdrop-bg: rgba(0, 0, 0, 0.5);
  --modal-bg: var(--color-white);
  --modal-border-radius: var(--border-radius-lg);
  --modal-padding: var(--spacing-lg);
  --modal-max-width: 500px;
  
  /* ============================================
     SIMPLIFIED ALIASES (for component convenience)
     ============================================ */
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-dark);
  --primary-light: var(--color-primary-light);
  --danger: var(--color-danger);
  --danger-dark: var(--color-danger-hover);
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --background: var(--color-bg-body);
  --border: var(--color-border-light);
  --card-hover: var(--color-bg-hover);
}


/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] {
  /* Primary Colors */
  --color-primary: #4da3ff;
  --color-primary-hover: #66b3ff;
  --color-primary-light: #1a3a52;
  --color-primary-dark: #3d8fdb;

  /* Semantic Colors */
  --color-success: #4ade80;
  --color-success-hover: #5fe88d;
  --color-success-light: #1a3a28;

  --color-danger: #f87171;
  --color-danger-hover: #fa8585;
  --color-danger-light: #4a2020;

  --color-warning: #fbbf24;
  --color-warning-hover: #fcd34d;
  --color-warning-light: #3a2f0f;

  --color-info: #38bdf8;
  --color-info-hover: #5dc9fc;
  --color-info-light: #1a2f3a;

  /* Text Colors */
  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-text-inverse: #1e293b;
  --color-text-disabled: #475569;

  /* Background Colors */
  --color-bg-body: #0f172a;
  --color-bg-surface: #1e293b;
  --color-bg-hover: #334155;
  --color-bg-disabled: #1e293b;

  /* Border Colors */
  --color-border-light: #334155;
  --color-border-medium: #475569;
  --color-border-dark: #64748b;
  --color-border-disabled: #334155;

  /* Neutral Colors - Dark adjusted */
  --color-gray-50: #1e293b;
  --color-gray-100: #1e293b;
  --color-gray-200: #334155;
  --color-gray-300: #475569;
  --color-gray-400: #64748b;
  --color-gray-500: #94a3b8;
  --color-gray-600: #cbd5e1;
  --color-gray-700: #e2e8f0;
  --color-gray-800: #f1f5f9;
  --color-gray-900: #f8fafc;

  /* Shadows - Lighter for dark mode */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 0 10px rgba(0, 0, 0, 0.5);

  /* Modals */
  --modal-backdrop-bg: rgba(0, 0, 0, 0.8);
  --modal-bg: var(--color-bg-surface);

  /* Inputs */
  --input-border-color: var(--color-border-medium);
  --input-focus-shadow: 0 0 0 2px rgba(77, 163, 255, 0.3);

  /* Cards */
  --card-bg: var(--color-bg-surface);
}


/* ============================================
   DARK MODE SUPPORT (Future Implementation)
   ============================================ */
@media (prefers-color-scheme: dark) {
  /* Auto mode will use data-theme attribute set by JS */
}


/* Manual dark mode class override (deprecated - use data-theme) */
.dark-mode {
  --color-text-primary: #f8f9fa;
  --color-text-secondary: #adb5bd;
  --color-bg-body: #212529;
  --color-bg-surface: #343a40;
  --color-border-light: #495057;
  --color-border-medium: #6c757d;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Spacing Utilities */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: var(--spacing-xs) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-md) !important; }
.mt-4 { margin-top: var(--spacing-lg) !important; }

.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }
.mb-4 { margin-bottom: var(--spacing-lg) !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: var(--spacing-xs) !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-md) !important; }
.p-4 { padding: var(--spacing-lg) !important; }

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

.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-success { color: var(--color-success) !important; }

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

/* Display Utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-block { display: inline-block !important; }

/* Flex Utilities */
.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.align-center { align-items: center !important; }
.gap-1 { gap: var(--spacing-xs) !important; }
.gap-2 { gap: var(--spacing-sm) !important; }
.gap-3 { gap: var(--spacing-md) !important; }
