/* ===============================================
   DESIGN TOKENS - Atomic Design Foundation
   ===============================================

   Atomic design system tokens for consistent UI across the platform.

   ORGANIZATION:
   1. COLOR TOKENS - Semantic color system
   2. TYPOGRAPHY TOKENS - Text scales and weights
   3. SPACING TOKENS - Spacing scale for consistent rhythm
   4. SHADOW TOKENS - Elevation system
   5. BORDER TOKENS - Border radius and styles
   6. ANIMATION TOKENS - Timing and easing functions
   7. LAYOUT TOKENS - Grid, breakpoints, containers
   8. SEMANTIC TOKENS - Component-specific tokens
*/

:root {
  /* ===============================================
     1. COLOR TOKENS - Simplified Practical System
     ===============================================
     
     Simplified from 10-shade system to practical 3-shade approach.
     Matches Wholesale Operator's efficient color strategy.
  */
  
  /* Primary Colors - Brand Green */
  --color-primary: #16a34a;              /* Main brand color */
  --color-primary-hover: #15803d;        /* Hover/active state */
  --color-primary-light: #dcfce7;        /* Backgrounds/subtle */

  /* Semantic Colors - Success (Green) */
  --color-success: #22c55e;              /* Main success */
  --color-success-hover: #16a34a;        /* Hover state */
  --color-success-light: #f0fdf4;        /* Backgrounds */
  
  /* Semantic Colors - Warning (Orange) */
  --color-warning: #f59e0b;              /* Main warning */
  --color-warning-hover: #d97706;        /* Hover state */
  --color-warning-light: #fffbeb;        /* Backgrounds */
  
  /* Semantic Colors - Error (Red) */
  --color-error: #dc2626;                /* Main error */
  --color-error-hover: #b91c1c;          /* Hover state */
  --color-error-light: #fef2f2;          /* Backgrounds */
  
  /* Semantic Colors - Info (Blue) */
  --color-info: #3b82f6;                 /* Main info */
  --color-info-hover: #2563eb;           /* Hover state */
  --color-info-light: #eff6ff;           /* Backgrounds */

  /* Allergy Guardian - Turquoise */
  --color-guardian: #0d9488;             /* Main teal-600 */
  --color-guardian-hover: #0f766e;       /* Hover teal-700 */
  --color-guardian-light: #f0fdfa;       /* Section background teal-50 */
  --color-guardian-border: #99f6e4;      /* Section border teal-200 */
  --color-guardian-text: #115e59;        /* Heading text teal-800 */
  
  /* Neutral Grays - Simplified */
  --color-neutral-100: #fafaf9;          /* Lightest - disabled backgrounds */
  --color-neutral-300: #d6d3d1;          /* Light - borders */
  --color-neutral-400: #a8a29e;          /* Mid-light - muted text */
  --color-neutral-500: #78716c;          /* Mid - secondary text */
  --color-neutral-700: #44403c;          /* Dark - emphasis */
  --color-neutral-800: #292524;          /* Darker - strong text */
  --color-neutral-900: #1c1917;          /* Darkest - primary text */

  /* Background Colors - 4-Layer Beige System (Matches Wholesale) */
  /* Creates visual depth through warm grey-beige tones */
  --bg-layer-1: #ebe9e6;                 /* Layer 1: App background (darkest beige) */
  --bg-layer-2: #f5f4f2;                 /* Layer 2: Workspace/main content (medium beige) */
  --bg-layer-3: #fafaf9;                 /* Layer 3: Panels/sections (light beige) */
  --bg-layer-4: #ffffff;                 /* Layer 4: Cards/inputs (pure white) */
  
  /* Semantic Aliases for Clear Intent */
  --bg-app: var(--bg-layer-1);           /* App shell background */
  --bg-workspace: var(--bg-layer-2);     /* Main content area */
  --bg-panel: var(--bg-layer-3);         /* Panel/section backgrounds */
  --bg-surface: var(--bg-layer-4);       /* Card/input backgrounds */
  
  /* Interaction States */
  --bg-surface-hover: #f5f5f4;           /* Hover on white */
  --bg-surface-active: #f0f0ef;          /* Active/pressed */
  --bg-muted: var(--bg-layer-3);         /* Disabled/subtle (use panel color) */
  --bg-accent: #dcfce7;                  /* Primary accent backgrounds */

  /* Border Colors - Warm Beige Tones (Matches Wholesale) */
  --border-subtle: #e8e7e5;              /* Subtle dividers (matches layer system) */
  --border-default: #d4d3d0;             /* Standard borders (matches layer system) */
  --border-strong: #c4c3c0;              /* Emphasized borders */
  --border-focus: #22c55e;               /* Focus rings (green) */

  /* Text Colors - 6-Shade Hierarchy (Matches Wholesale) */
  --text-primary: #1a1a1a;               /* Darkest - headings, emphasis */
  --text-secondary: #2d2d2d;             /* Subheadings, important text */
  --text-tertiary: #404040;              /* De-emphasized text */
  --text-body: #525252;                  /* Body text - most common */
  --text-muted: #737373;                 /* Hints, labels, captions */
  --text-light: #8a8a8a;                 /* Lightest - subtle info */
  --text-inverse: #ffffff;               /* On dark backgrounds */

  /* ===============================================
     2. TYPOGRAPHY TOKENS - Text Scales and Weights
     =============================================== */

  /* Font Families */
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'Courier New', monospace;

  /* Font Sizes */
  --text-2xs: 0.625rem;  /* 10px - Extra small (badges, labels) */
  --text-xs: 0.75rem;    /* 12px */
  --text-nav: 0.8125rem; /* 13px - Navigation items (between xs and sm) */
  --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 */

  /* Font Weights */
  --font-weight-thin: 100;
  --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-normal: 1.5;
  --line-height-relaxed: 1.625;

  /* Letter Spacing */
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;

  /* ===============================================
     3. SPACING TOKENS - Professional Tight Spacing
     ===============================================
     
     Optimized for professional density - not too airy, not cramped.
     Based on 4px grid system for pixel-perfect alignment.
  */

  --space-0: 0;
  --space-px: 1px;
  --space-0_5: 0.125rem;  /* 2px - Micro gaps */
  --space-1: 0.25rem;     /* 4px - Minimal spacing */
  --space-1_5: 0.375rem;  /* 6px - Tight spacing */
  --space-2: 0.5rem;      /* 8px - Compact spacing */
  --space-2_5: 0.625rem;  /* 10px - Small spacing */
  --space-3: 0.75rem;     /* 12px - Standard spacing */
  --space-3_5: 0.875rem;  /* 14px - Medium-small */
  --space-4: 1rem;        /* 16px - Medium spacing */
  --space-4_5: 1.125rem;  /* 18px - Medium-comfortable */
  --space-5: 1.25rem;     /* 20px - Comfortable spacing */
  --space-6: 1.5rem;      /* 24px - Large spacing */
  --space-7: 1.75rem;     /* 28px - Extra spacing */
  --space-8: 2rem;        /* 32px - Section spacing */
  --space-9: 2.25rem;     /* 36px - Large section */
  --space-10: 2.5rem;     /* 40px - Major spacing */
  --space-11: 2.75rem;    /* 44px - Extra large */
  --space-12: 3rem;       /* 48px - Maximum spacing */
  --space-13: 3.25rem;    /* 52px - Panel headers */
  --space-15: 3.75rem;    /* 60px - Medium-large */
  --space-16: 4rem;       /* 64px - Hero spacing */
  --space-18: 4.5rem;     /* 72px - Large spacing */
  --space-20: 5rem;       /* 80px - Page sections */
  --space-22: 5.5rem;     /* 88px - Extra sections */
  --space-24: 6rem;       /* 96px - Large sections */
  --space-30: 7.5rem;     /* 120px - Form labels */
  --space-32: 8rem;       /* 128px - Page breaks */
  --space-35: 8.75rem;    /* 140px - Medium-large */
  --space-37: 9.375rem;   /* 150px - Filter widths */
  --space-40: 10rem;      /* 160px - Card heights */
  --space-45: 11.25rem;   /* 180px - Large circles */
  --space-50: 12.5rem;    /* 200px - Medium container */
  --space-62: 15.5rem;    /* 248px - Extra wide */
  --space-75: 18.75rem;   /* 300px - Large container */
  --space-96: 24rem;      /* 384px - Maximum width */

  /* ===============================================
     4. SHADOW TOKENS - Elevation System
     =============================================== */

  --shadow-none: 0 0 #0000;
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --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);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-device: 0 8px 40px rgba(0, 0, 0, 0.3);   /* Phone-frame device shadow */

  /* Device-frame palette (used by iPhone preview frame in Templates tab).
     Pure-black bezel is intentional for device chrome. */
  --bg-device-frame:  #1a1a1a;
  --bg-device-bezel:  #333333;
  --bg-device-screen: var(--bg-layer-4);
  --bg-device-nav:    #555555;

  /* ===============================================
     5. BORDER TOKENS - Modern Professional Borders
     ===============================================
     
     Border radius optimized for 2024-2026 design standards.
     Balanced roundness - not too sharp, not overly rounded.
  */

  --border-radius-none: 0;
  --border-radius-sm: 0.25rem;    /* 4px - Small elements (badges, tags) */
  --border-radius-md: 0.375rem;   /* 6px - Standard (buttons, inputs) */
  --border-radius-lg: 0.5rem;     /* 8px - Cards, dropdowns, small containers */
  --border-radius-xl: 0.75rem;    /* 12px - Panels, Sidebar, major sections */
  --border-radius-2xl: 1rem;      /* 16px - Hero sections, special features */
  --border-radius-3xl: 1.5rem;    /* 24px - Extra large, marketing */
  --border-radius-full: 9999px;   /* Fully rounded (pills, avatars) */

  --border-width-0: 0;
  --border-width-1: 1px;
  --border-width-2: 2px;
  --border-width-4: 4px;
  --border-width-8: 8px;

  /* ===============================================
     6. ANIMATION TOKENS - Timing and Easing
     =============================================== */

  --duration-75: 75ms;
  --duration-100: 100ms;
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  --duration-500: 500ms;
  --duration-700: 700ms;
  --duration-1000: 1000ms;

  --easing-linear: linear;
  --easing-in: cubic-bezier(0.4, 0, 1, 1);
  --easing-out: cubic-bezier(0, 0, 0.2, 1);
  --easing-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ===============================================
     7. LAYOUT TOKENS - Grid, Breakpoints, Containers
     =============================================== */

  /* Breakpoints */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;

  /* Container max widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1536px;

  /* Grid columns */
  --grid-cols-1: repeat(1, minmax(0, 1fr));
  --grid-cols-2: repeat(2, minmax(0, 1fr));
  --grid-cols-3: repeat(3, minmax(0, 1fr));
  --grid-cols-4: repeat(4, minmax(0, 1fr));
  --grid-cols-5: repeat(5, minmax(0, 1fr));
  --grid-cols-6: repeat(6, minmax(0, 1fr));
  --grid-cols-12: repeat(12, minmax(0, 1fr));

  /* Flex utilities */
  --flex-1: 1 1 0%;
  --flex-auto: 1 1 auto;
  --flex-initial: 0 1 auto;
  --flex-none: none;

  /* ===============================================
     8. SEMANTIC TOKENS - Component-specific tokens
     =============================================== */

  /* Component-specific tokens - Professional heights */
  --button-height-sm: 2rem;    /* 32px - Compact */
  --button-height-md: 2.25rem; /* 36px - Standard (tighter than 40px) */
  --button-height-lg: 2.75rem; /* 44px - Large (tighter than 48px) */

  --input-height-sm: 2rem;     /* 32px - Compact */
  --input-height-md: 2.25rem;  /* 36px - Standard (tighter than 40px) */
  --input-height-lg: 2.75rem;  /* 44px - Large (tighter than 48px) */

  --icon-size-xs: 0.75rem;     /* 12px */
  --icon-size-sm: 1rem;        /* 16px */
  --icon-size-md: 1.25rem;     /* 20px */
  --icon-size-lg: 1.5rem;      /* 24px */
  --icon-size-xl: 2rem;        /* 32px */

  /* Layout tokens - Professional structure */
  --header-height: 3rem;        /* 48px */
  --sidebar-width-collapsed: 2.75rem;  /* 44px */
  --sidebar-width-expanded: 15rem;     /* 240px */
  --sidebar-transition: all 300ms cubic-bezier(0.25, 0.8, 0.25, 1);
  
  /* Form control sizes */
  --checkbox-size: 1.25rem;    /* 20px */
  --radio-size: 1.25rem;       /* 20px */
  --switch-width: 2.75rem;     /* 44px */
  --switch-height: 1.5rem;     /* 24px */
  --switch-thumb-size: 1rem;   /* 16px */
  
  /* Template layout widths */
  --card-min-width: 15.625rem;   /* 250px - Dashboard card minimum */
  --form-max-width: 37.5rem;     /* 600px - Form container */
  --panel-max-width: 62.5rem;    /* 1000px - Single panel */
  
  /* Focus shadow */
  --focus-ring-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}
