/**
 * FDM Web Design Token System
 * Version: 1.0.0
 *
 * This file contains all design tokens (CSS custom properties) used throughout
 * the FDM Web application. These tokens ensure consistency across all apps.
 *
 * Usage:
 *   color: var(--color-primary);
 *   padding: var(--spacing-md);
 *   border-radius: var(--radius-lg);
 */

/* ============================================
   FONT FACE DECLARATIONS
   ============================================ */

/* Note: SF UI Display font files are not included due to licensing restrictions.
   The application uses a high-quality system font stack instead. */

:root {
  /* ============================================
     COLOR PALETTE
     ============================================ */

  /* Primary Colors - Brand Identity */
  --color-primary: #FF7734;
  --color-primary-light: #FF9661;
  --color-primary-lighter: #FFB894;
  --color-primary-dark: #FF5F12;
  --color-primary-darker: #E54D00;

  /* Secondary Colors */
  --color-secondary: #6b7280;
  --color-secondary-light: #9ca3af;
  --color-secondary-dark: #4b5563;

  /* Accent Colors */
  --color-accent-red: #FF4162;
  --color-accent-red-light: #FF6B85;
  --color-accent-red-dark: #E6294D;

  --color-accent-green: #32CC95;
  --color-accent-green-light: #5FDDB0;
  --color-accent-green-dark: #28A569;

  --color-accent-blue: #05B0F1;
  --color-accent-blue-light: #38C4F5;
  --color-accent-blue-dark: #0494C7;

  --color-accent-yellow: #F59E0B;
  --color-accent-yellow-light: #FBBF24;
  --color-accent-yellow-dark: #D97706;

  --color-accent-purple: #8B5CF6;
  --color-accent-purple-light: #A78BFA;
  --color-accent-purple-dark: #7C3AED;

  /* Client Tools (special use) */
  --color-client-tools: #FE893B;

  /* Neutral Colors - Grayscale */
  --color-white: #ffffff;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  --color-black: #000000;

  /* Semantic Colors - Text */
  --color-text-primary: #1f2937;
  --color-text-secondary: #6b7280;
  --color-text-tertiary: #9ca3af;
  --color-text-disabled: #d1d5db;
  --color-text-inverse: #ffffff;

  /* Semantic Colors - Background */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f9fafb;
  --color-bg-tertiary: #f3f4f6;
  --color-bg-body: #f8fafc;
  --color-bg-overlay: rgba(0, 0, 0, 0.5);

  /* Semantic Colors - Border */
  --color-border-light: rgba(0, 0, 0, 0.08);
  --color-border-medium: rgba(0, 0, 0, 0.12);
  --color-border-dark: rgba(0, 0, 0, 0.18);
  --color-border-focus: var(--color-primary);

  /* Semantic Colors - Status */
  --color-success: #10b981;
  --color-success-light: #34d399;
  --color-success-dark: #059669;
  --color-success-bg: rgba(16, 185, 129, 0.05);
  --color-success-border: #10b981;

  --color-error: #ef4444;
  --color-error-light: #f87171;
  --color-error-dark: #dc2626;
  --color-error-bg: rgba(239, 68, 68, 0.05);
  --color-error-border: #ef4444;

  --color-warning: #f59e0b;
  --color-warning-light: #fbbf24;
  --color-warning-dark: #d97706;
  --color-warning-bg: rgba(245, 158, 11, 0.05);
  --color-warning-border: #f59e0b;

  --color-info: #3b82f6;
  --color-info-light: #60a5fa;
  --color-info-dark: #2563eb;
  --color-info-bg: rgba(59, 130, 246, 0.05);
  --color-info-border: #3b82f6;

  /* ============================================
     GRADIENTS
     ============================================ */

  /* Primary gradients */
  --gradient-primary: linear-gradient(135deg, #ff6b35 0%, #f72585 100%);
  --gradient-primary-reverse: linear-gradient(135deg, #f72585 0%, #ff6b35 100%);

  /* Status gradients */
  --gradient-success: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-dark) 100%);
  --gradient-danger: linear-gradient(135deg, var(--color-error) 0%, var(--color-error-dark) 100%);
  --gradient-warning: linear-gradient(135deg, var(--color-warning) 0%, var(--color-warning-dark) 100%);
  --gradient-info: linear-gradient(135deg, var(--color-info) 0%, var(--color-info-dark) 100%);

  /* Utility gradients */
  --gradient-slate: linear-gradient(135deg, #44536A 0%, #3a4555 100%);
  --gradient-overlay: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.5) 100%);

  /* ============================================
     SPACING SCALE
     ============================================ */

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --spacing-3xl: 64px;
  --spacing-4xl: 96px;

  /* Common spacing combinations */
  --spacing-section: var(--spacing-2xl);
  --spacing-card-padding: var(--spacing-lg);
  --spacing-input-padding: 12px 16px;
  --spacing-button-padding: 12px 24px;

  /* ============================================
     TYPOGRAPHY
     ============================================ */

  /* Font Families */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Menlo', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

  /* Font Sizes */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-md: 1.125rem;     /* 18px */
  --font-size-lg: 1.25rem;      /* 20px */
  --font-size-xl: 1.5rem;       /* 24px */
  --font-size-2xl: 1.875rem;    /* 30px */
  --font-size-3xl: 2.25rem;     /* 36px */
  --font-size-4xl: 3rem;        /* 48px */

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;

  /* Letter Spacing */
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  --letter-spacing-wider: 0.05em;
  --letter-spacing-widest: 0.1em;

  /* ============================================
     BORDER RADIUS
     ============================================ */

  --radius-none: 0;
  --radius-sm: 4px;
  --radius-base: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 24px;
  --radius-full: 9999px;

  /* Common component radii */
  --radius-button: var(--radius-lg);
  --radius-card: var(--radius-xl);
  --radius-input: var(--radius-md);
  --radius-modal: var(--radius-2xl);
  --radius-badge: var(--radius-full);

  /* ============================================
     SHADOWS
     ============================================ */

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-base: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.10), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.10);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

  /* Interactive shadows */
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-focus: 0 0 0 3px rgba(255, 119, 52, 0.2);
  --shadow-focus-error: 0 0 0 3px rgba(239, 68, 68, 0.2);
  --shadow-focus-success: 0 0 0 3px rgba(16, 185, 129, 0.2);

  /* ============================================
     TRANSITIONS & ANIMATIONS
     ============================================ */

  /* Duration */
  --duration-instant: 0ms;
  --duration-fast: 100ms;
  --duration-base: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 500ms;

  /* Easing */
  --ease-linear: linear;
  --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-smooth: cubic-bezier(0.45, 0, 0.55, 1);

  /* Common transitions */
  --transition-base: all var(--duration-base) var(--ease-out);
  --transition-fast: all var(--duration-fast) var(--ease-out);
  --transition-slow: all var(--duration-slow) var(--ease-out);
  --transition-colors: color var(--duration-base) var(--ease-out),
                       background-color var(--duration-base) var(--ease-out),
                       border-color var(--duration-base) var(--ease-out);
  --transition-transform: transform var(--duration-base) var(--ease-out);
  --transition-opacity: opacity var(--duration-base) var(--ease-out);

  /* ============================================
     Z-INDEX SCALE
     ============================================ */

  --z-index-dropdown: 1000;
  --z-index-sticky: 1020;
  --z-index-fixed: 1030;
  --z-index-modal-backdrop: 1040;
  --z-index-modal: 1050;
  --z-index-popover: 1060;
  --z-index-tooltip: 1070;
  --z-index-notification: 1080;

  /* ============================================
     LAYOUT
     ============================================ */

  --container-max-width: 1200px;
  --container-wide: 1400px;
  --container-narrow: 800px;
  --container-padding: var(--spacing-lg);

  --header-height: 64px;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 64px;

  /* ============================================
     COMPONENT-SPECIFIC TOKENS
     ============================================ */

  /* Buttons */
  --button-height-sm: 32px;
  --button-height-base: 40px;
  --button-height-lg: 48px;
  --button-padding-x: var(--spacing-lg);
  --button-padding-y: 12px;
  --button-font-weight: var(--font-weight-semibold);

  /* Inputs */
  --input-height-sm: 32px;
  --input-height-base: 40px;
  --input-height-lg: 48px;
  --input-padding-x: var(--spacing-md);
  --input-padding-y: 10px;
  --input-border-width: 1px;
  --input-border-color: var(--color-border-medium);
  --input-focus-border-color: var(--color-primary);

  /* Cards */
  --card-padding: var(--spacing-lg);
  --card-bg: var(--color-bg-primary);
  --card-border-color: var(--color-border-light);
  --card-shadow: var(--shadow-md);
  --card-hover-shadow: var(--shadow-lg);

  /* Modal */
  --modal-max-width-sm: 400px;
  --modal-max-width-base: 600px;
  --modal-max-width-lg: 800px;
  --modal-max-width-xl: 1000px;
  --modal-padding: var(--spacing-xl);
  --modal-header-height: 60px;
  --modal-footer-height: 72px;

  /* Badge */
  --badge-height: 24px;
  --badge-padding-x: 10px;
  --badge-font-size: var(--font-size-xs);
  --badge-font-weight: var(--font-weight-semibold);

  /* Tile/Feature Card */
  --tile-padding: var(--spacing-lg);
  --tile-min-height: 200px;
  --tile-gap: var(--spacing-lg);

  /* ============================================
     BREAKPOINTS (for JavaScript)
     ============================================ */

  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/**
 * Dark Mode Support (Optional - for future implementation)
 */
@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode color overrides would go here */
    /* Uncomment and customize when implementing dark mode:

    --color-bg-primary: #1f2937;
    --color-bg-secondary: #111827;
    --color-text-primary: #f9fafb;
    --color-text-secondary: #d1d5db;
    */
  }
}

/**
 * Reduced Motion Support
 * Respects user's preference for reduced motion
 */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
    --duration-slower: 0ms;

    --transition-base: none;
    --transition-fast: none;
    --transition-slow: none;
    --transition-colors: none;
    --transition-transform: none;
    --transition-opacity: none;
  }
}

/**
 * Print Styles
 * Optimize design tokens for print media
 */
@media print {
  :root {
    --shadow-xs: none;
    --shadow-sm: none;
    --shadow-base: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: none;
    --shadow-2xl: none;
  }
}
