/**
 * StreetWarz Idle - Design System Tokens
 * Central source of truth for all design values
 * Version: 1.0.0
 */

:root {
  /* ===== BRAND COLORS ===== */
  --sw-brand-primary: #ff6b35;        /* Signature orange */
  --sw-brand-secondary: #f7931e;      /* Supporting orange */
  --sw-brand-accent: #4facfe;         /* Blue accent */
  --sw-brand-highlight: #00ffff;      /* Cyan highlight */

  /* ===== SEMANTIC COLORS ===== */
  --sw-success: #22c55e;              /* Success actions */
  --sw-warning: #f59e0b;              /* Warnings */
  --sw-danger: #ef4444;               /* Errors/danger */
  --sw-info: #06b6d4;                 /* Information */

  /* ===== NEUTRAL PALETTE ===== */
  --sw-white: #ffffff;
  --sw-gray-50: #f9fafb;
  --sw-gray-100: #f3f4f6;
  --sw-gray-200: #e5e7eb;
  --sw-gray-300: #d1d5db;
  --sw-gray-400: #9ca3af;
  --sw-gray-500: #6b7280;
  --sw-gray-600: #4b5563;
  --sw-gray-700: #374151;
  --sw-gray-800: #1f2937;
  --sw-gray-900: #111827;
  --sw-black: #000000;

  /* ===== DARK THEME COLORS ===== */
  --sw-dark-bg-primary: #0f0f23;      /* Main background */
  --sw-dark-bg-secondary: #1a1a2e;    /* Secondary surfaces */
  --sw-dark-bg-tertiary: #16213e;     /* Elevated surfaces */
  --sw-dark-surface: #252545;         /* Interactive surfaces */
  --sw-dark-border: #3a3a5c;          /* Borders and dividers */

  /* ===== GAME SPECIFIC COLORS ===== */
  --sw-money-color: #00ff00;          /* Money/cash displays */
  --sw-xp-color: #4facfe;             /* Experience points */
  --sw-health-color: #ff4757;         /* Health bars */
  --sw-energy-color: #ffa726;         /* Energy/stamina */
  --sw-prestige-color: #9c27b0;       /* Prestige elements */

  /* ===== TYPOGRAPHY ===== */
  --sw-font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sw-font-family-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
  --sw-font-family-display: 'Orbitron', 'Inter', sans-serif;

  /* Font Sizes */
  --sw-text-xs: 0.75rem;      /* 12px */
  --sw-text-sm: 0.875rem;     /* 14px */
  --sw-text-base: 1rem;       /* 16px */
  --sw-text-lg: 1.125rem;     /* 18px */
  --sw-text-xl: 1.25rem;      /* 20px */
  --sw-text-2xl: 1.5rem;      /* 24px */
  --sw-text-3xl: 1.875rem;    /* 30px */
  --sw-text-4xl: 2.25rem;     /* 36px */
  --sw-text-5xl: 3rem;        /* 48px */

  /* Font Weights */
  --sw-font-light: 300;
  --sw-font-normal: 400;
  --sw-font-medium: 500;
  --sw-font-semibold: 600;
  --sw-font-bold: 700;
  --sw-font-extrabold: 800;

  /* Line Heights */
  --sw-leading-tight: 1.25;
  --sw-leading-normal: 1.5;
  --sw-leading-relaxed: 1.75;

  /* ===== SPACING SCALE ===== */
  --sw-space-0: 0;
  --sw-space-px: 1px;
  --sw-space-0-5: 0.125rem;   /* 2px */
  --sw-space-1: 0.25rem;      /* 4px */
  --sw-space-1-5: 0.375rem;   /* 6px */
  --sw-space-2: 0.5rem;       /* 8px */
  --sw-space-2-5: 0.625rem;   /* 10px */
  --sw-space-3: 0.75rem;      /* 12px */
  --sw-space-3-5: 0.875rem;   /* 14px */
  --sw-space-4: 1rem;         /* 16px */
  --sw-space-5: 1.25rem;      /* 20px */
  --sw-space-6: 1.5rem;       /* 24px */
  --sw-space-7: 1.75rem;      /* 28px */
  --sw-space-8: 2rem;         /* 32px */
  --sw-space-10: 2.5rem;      /* 40px */
  --sw-space-12: 3rem;        /* 48px */
  --sw-space-16: 4rem;        /* 64px */
  --sw-space-20: 5rem;        /* 80px */
  --sw-space-24: 6rem;        /* 96px */

  /* ===== BORDER RADIUS ===== */
  --sw-radius-none: 0;
  --sw-radius-sm: 0.125rem;    /* 2px */
  --sw-radius-base: 0.25rem;   /* 4px */
  --sw-radius-md: 0.375rem;    /* 6px */
  --sw-radius-lg: 0.5rem;      /* 8px */
  --sw-radius-xl: 0.75rem;     /* 12px */
  --sw-radius-2xl: 1rem;       /* 16px */
  --sw-radius-3xl: 1.5rem;     /* 24px */
  --sw-radius-full: 9999px;

  /* ===== SHADOWS ===== */
  --sw-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --sw-shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --sw-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --sw-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --sw-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --sw-shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --sw-shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

  /* Game-specific Glows */
  --sw-glow-primary: 0 0 20px rgba(255, 107, 53, 0.5);
  --sw-glow-accent: 0 0 20px rgba(79, 172, 254, 0.5);
  --sw-glow-success: 0 0 20px rgba(34, 197, 94, 0.5);
  --sw-glow-danger: 0 0 20px rgba(239, 68, 68, 0.5);

  /* ===== Z-INDEX SCALE ===== */
  --sw-z-hide: -1;
  --sw-z-base: 0;
  --sw-z-docked: 10;
  --sw-z-dropdown: 1000;
  --sw-z-sticky: 1020;
  --sw-z-banner: 1030;
  --sw-z-overlay: 1040;
  --sw-z-modal: 1050;
  --sw-z-popover: 1060;
  --sw-z-tooltip: 1070;
  --sw-z-toast: 1080;

  /* ===== BREAKPOINTS ===== */
  --sw-breakpoint-sm: 640px;    /* Small devices */
  --sw-breakpoint-md: 768px;    /* Medium devices */
  --sw-breakpoint-lg: 1024px;   /* Large devices */
  --sw-breakpoint-xl: 1280px;   /* Extra large devices */
  --sw-breakpoint-2xl: 1536px;  /* 2X large devices */

  /* ===== TRANSITIONS ===== */
  --sw-transition-fast: 150ms ease-in-out;
  --sw-transition-base: 250ms ease-in-out;
  --sw-transition-slow: 350ms ease-in-out;

  /* ===== COMPONENT SPECIFIC ===== */
  /* Buttons */
  --sw-btn-padding-y: var(--sw-space-2);
  --sw-btn-padding-x: var(--sw-space-4);
  --sw-btn-border-radius: var(--sw-radius-md);
  --sw-btn-font-weight: var(--sw-font-medium);

  /* Cards */
  --sw-card-padding: var(--sw-space-6);
  --sw-card-border-radius: var(--sw-radius-xl);
  --sw-card-background: var(--sw-dark-bg-secondary);
  --sw-card-border: 1px solid var(--sw-dark-border);

  /* Modals */
  --sw-modal-backdrop: rgba(0, 0, 0, 0.75);
  --sw-modal-width-sm: 28rem;
  --sw-modal-width-md: 32rem;
  --sw-modal-width-lg: 48rem;
  --sw-modal-width-xl: 56rem;

  /* HUD Elements */
  --sw-hud-background: rgba(26, 26, 46, 0.95);
  --sw-hud-border: rgba(58, 58, 92, 0.8);
  --sw-hud-backdrop-blur: 10px;

  /* Glass Effect */
  --sw-glass-background: rgba(255, 255, 255, 0.1);
  --sw-glass-border: rgba(255, 255, 255, 0.2);
  --sw-glass-backdrop-blur: 20px;

  /* ===== ANIMATION EASING ===== */
  --sw-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --sw-ease-out: cubic-bezier(0, 0, 0.2, 1);
  --sw-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --sw-ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ===== FORM COMPONENTS ===== */
  --sw-input-padding-y: var(--sw-space-3);
  --sw-input-padding-x: var(--sw-space-4);
  --sw-input-border-radius: var(--sw-radius-md);
  --sw-input-border-width: 1px;
  --sw-input-border-color: var(--sw-dark-border);
  --sw-input-border-color-focus: var(--sw-brand-primary);
  --sw-input-background: var(--sw-dark-bg-tertiary);
  --sw-input-background-focus: var(--sw-dark-bg-secondary);
  --sw-input-text-color: var(--sw-white);
  --sw-input-placeholder-color: var(--sw-gray-400);

  /* ===== TOOLTIP COMPONENTS ===== */
  --sw-tooltip-background: rgba(0, 0, 0, 0.9);
  --sw-tooltip-padding: var(--sw-space-2) var(--sw-space-3);
  --sw-tooltip-border-radius: var(--sw-radius-md);
  --sw-tooltip-font-size: var(--sw-text-sm);
  --sw-tooltip-max-width: 250px;

  /* ===== NOTIFICATION COMPONENTS ===== */
  --sw-notification-padding: var(--sw-space-4) var(--sw-space-6);
  --sw-notification-border-radius: var(--sw-radius-lg);
  --sw-notification-border-width: 1px;
  --sw-notification-slide-distance: 100%;

  /* ===== DROPDOWN COMPONENTS ===== */
  --sw-dropdown-background: var(--sw-dark-bg-secondary);
  --sw-dropdown-border: 1px solid var(--sw-dark-border);
  --sw-dropdown-border-radius: var(--sw-radius-lg);
  --sw-dropdown-shadow: var(--sw-shadow-xl);
  --sw-dropdown-item-padding: var(--sw-space-3) var(--sw-space-4);
  --sw-dropdown-item-hover-background: var(--sw-dark-surface);

  /* ===== PROGRESS COMPONENTS ===== */
  --sw-progress-height: 8px;
  --sw-progress-border-radius: var(--sw-radius-full);
  --sw-progress-background: rgba(255, 255, 255, 0.1);
  --sw-progress-fill-background: linear-gradient(90deg, var(--sw-brand-primary), var(--sw-brand-secondary));

  /* ===== TAB COMPONENTS ===== */
  --sw-tab-padding: var(--sw-space-3) var(--sw-space-6);
  --sw-tab-border-radius: var(--sw-radius-md) var(--sw-radius-md) 0 0;
  --sw-tab-background: transparent;
  --sw-tab-background-active: var(--sw-brand-primary);
  --sw-tab-background-hover: rgba(255, 255, 255, 0.1);
  --sw-tab-border-width: 2px;
  --sw-tab-border-color: transparent;
  --sw-tab-border-color-active: var(--sw-brand-primary);

  /* ===== MOBILE OPTIMIZATIONS ===== */
  --sw-mobile-tap-highlight: transparent;
  --sw-mobile-touch-target: 44px;
  --sw-mobile-safe-area-top: env(safe-area-inset-top);
  --sw-mobile-safe-area-bottom: env(safe-area-inset-bottom);
  --sw-mobile-safe-area-left: env(safe-area-inset-left);
  --sw-mobile-safe-area-right: env(safe-area-inset-right);

  /* ===== GAME-SPECIFIC ANIMATIONS ===== */
  --sw-animation-bounce: bounce 1s ease-in-out;
  --sw-animation-pulse: pulse 2s infinite;
  --sw-animation-shake: shake 0.5s ease-in-out;
  --sw-animation-glow: glow 2s ease-in-out infinite alternate;
  --sw-animation-slide-up: slideUp 0.3s ease-out;
  --sw-animation-slide-down: slideDown 0.3s ease-out;
  --sw-animation-fade-in: fadeIn 0.3s ease-out;
  --sw-animation-fade-out: fadeOut 0.3s ease-out;

  /* ===== ADVANCED LAYOUT ===== */
  --sw-container-max-width: 1440px;
  --sw-container-padding: var(--sw-space-6);
  --sw-section-spacing: var(--sw-space-12);
  --sw-component-spacing: var(--sw-space-6);
  --sw-content-max-width: 65ch;

  /* ===== FOCUS MANAGEMENT ===== */
  --sw-focus-ring-width: 2px;
  --sw-focus-ring-color: var(--sw-brand-primary);
  --sw-focus-ring-offset: 2px;
  --sw-focus-ring-style: solid;

  /* ===== HIGH CONTRAST OVERRIDES ===== */
  --sw-hc-border-width: 2px;
  --sw-hc-border-color: currentColor;
  --sw-hc-background: Canvas;
  --sw-hc-text: CanvasText;
}

/* ===== REDUCED MOTION PREFERENCES ===== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --sw-transition-fast: 0ms;
    --sw-transition-base: 0ms;
    --sw-transition-slow: 0ms;
  }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
  :root {
    --sw-dark-border: var(--sw-hc-border-color);
    --sw-glass-border: var(--sw-hc-border-color);
    --sw-dark-bg-primary: var(--sw-hc-background);
    --sw-dark-bg-secondary: var(--sw-hc-background);
    --sw-dark-bg-tertiary: var(--sw-hc-background);
    --sw-white: var(--sw-hc-text);
    --sw-gray-300: var(--sw-hc-text);
    --sw-gray-400: var(--sw-hc-text);
  }

  /* Enhanced borders for high contrast */
  .sw-btn,
  .sw-card,
  .sw-input,
  .sw-modal {
    border-width: var(--sw-hc-border-width) !important;
    border-color: var(--sw-hc-border-color) !important;
  }

  /* Remove complex backgrounds */
  .sw-glass,
  .sw-hud {
    background: var(--sw-hc-background) !important;
    backdrop-filter: none !important;
  }

  /* Ensure text contrast */
  .sw-text-gray-300,
  .sw-text-gray-400,
  .sw-text-gray-500 {
    color: var(--sw-hc-text) !important;
  }
}

/* ===== DARK MODE ENFORCEMENT ===== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* ===== ANIMATION KEYFRAMES ===== */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -8px, 0);
  }
  70% {
    transform: translate3d(0, -4px, 0);
  }
  90% {
    transform: translate3d(0, -2px, 0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

@keyframes glow {
  0% {
    box-shadow: 0 0 5px var(--sw-brand-primary);
  }
  100% {
    box-shadow: 0 0 20px var(--sw-brand-primary), 0 0 30px var(--sw-brand-primary);
  }
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes fadeOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== FOCUS VISIBLE MANAGEMENT ===== */
:focus {
  outline: none;
}

:focus-visible {
  outline: var(--sw-focus-ring-width) var(--sw-focus-ring-style) var(--sw-focus-ring-color);
  outline-offset: var(--sw-focus-ring-offset);
}

/* ===== PRINT STYLES ===== */
@media print {
  :root {
    --sw-brand-primary: #000000;
    --sw-brand-secondary: #333333;
    --sw-dark-bg-primary: #ffffff;
    --sw-dark-bg-secondary: #f8f9fa;
    --sw-white: #000000;
    --sw-gray-900: #000000;
  }

  .sw-shadow-sm,
  .sw-shadow,
  .sw-shadow-md,
  .sw-shadow-lg,
  .sw-shadow-xl,
  .sw-shadow-2xl {
    box-shadow: none !important;
  }

  .sw-glass,
  .sw-hud {
    background: white !important;
    border: 1px solid #cccccc !important;
    backdrop-filter: none !important;
  }
}