/* ==============================================
   INSPACE DESIGN TOKENS v2.0
   
   SINGLE SOURCE OF TRUTH for all design variables
   Import this file in ALL pages before other CSS
   
   Created: Based on catalogue analysis
   Last Updated: 2025
   ============================================== */

:root {
  /* ─────────────────────────────────────────────
     BRAND COLORS
     Primary: Indigo (#6366f1)
     ───────────────────────────────────────────── */
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-dark: #4338ca;
  --color-primary-light: #e0e7ff;
  --color-primary-lighter: #eef2ff;
  --color-primary-rgb: 99, 102, 241;
  
  /* Secondary: Purple */
  --color-secondary: #8b5cf6;
  --color-secondary-hover: #7c3aed;
  --color-secondary-light: #ede9fe;
  --color-secondary-rgb: 139, 92, 246;
  
  /* Accent: Amber (for highlights, CTAs) */
  --color-accent: #f59e0b;
  --color-accent-hover: #d97706;
  --color-accent-light: #fef3c7;
  --color-accent-rgb: 245, 158, 11;
  
  /* Premium: Gold (for premium indicators) */
  --color-premium: #c9a962;
  --color-premium-light: #fef9e7;
  
  /* ─────────────────────────────────────────────
     SEMANTIC COLORS
     ───────────────────────────────────────────── */
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-success-light: #d1fae5;
  --color-success-rgb: 16, 185, 129;
  
  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  --color-warning-light: #fef3c7;
  --color-warning-rgb: 245, 158, 11;
  
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-light: #fee2e2;
  --color-danger-rgb: 239, 68, 68;
  
  --color-info: #3b82f6;
  --color-info-hover: #2563eb;
  --color-info-light: #dbeafe;
  --color-info-rgb: 59, 130, 246;
  
  /* ─────────────────────────────────────────────
     NEUTRAL SCALE (Gray)
     ───────────────────────────────────────────── */
  --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-gray-950: #030712;
  
  /* Named neutrals */
  --color-white: #ffffff;
  --color-black: #000000;
  --color-dark: var(--color-gray-800);
  --color-light: var(--color-gray-50);
  --color-muted: var(--color-gray-500);
  
  /* ─────────────────────────────────────────────
     BACKGROUNDS
     ───────────────────────────────────────────── */
  --bg-page: var(--color-gray-50);
  --bg-card: var(--color-white);
  --bg-card-hover: var(--color-white);
  --bg-section: var(--color-white);
  --bg-section-alt: #f8fafc;
  --bg-input: var(--color-white);
  --bg-input-disabled: var(--color-gray-100);
  
  /* Gradient backgrounds */
  --bg-hero: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  --bg-header: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  --bg-cta: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --bg-overlay-light: rgba(255, 255, 255, 0.9);
  
  /* ─────────────────────────────────────────────
     TEXT COLORS
     ───────────────────────────────────────────── */
  --text-primary: var(--color-gray-900);
  --text-secondary: var(--color-gray-600);
  --text-muted: var(--color-gray-500);
  --text-light: var(--color-gray-400);
  --text-inverse: var(--color-white);
  --text-link: var(--color-primary);
  --text-link-hover: var(--color-primary-hover);
  
  /* ─────────────────────────────────────────────
     SHADOWS
     ───────────────────────────────────────────── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 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.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-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  --shadow-none: 0 0 #0000;
  
  /* Colored shadows */
  --shadow-primary: 0 4px 14px rgba(var(--color-primary-rgb), 0.25);
  --shadow-success: 0 4px 14px rgba(var(--color-success-rgb), 0.25);
  --shadow-danger: 0 4px 14px rgba(var(--color-danger-rgb), 0.25);
  
  /* Component shadows */
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 12px 24px rgba(0, 0, 0, 0.12);
  --shadow-dropdown: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-button: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-button-hover: 0 4px 6px rgba(0, 0, 0, 0.1);
  
  /* ─────────────────────────────────────────────
     TYPOGRAPHY
     ───────────────────────────────────────────── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Inter', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, 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 */
  --text-6xl: 3.75rem;    /* 60px */
  
  /* Font weights */
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  
  /* Line heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Letter spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
  
  /* ─────────────────────────────────────────────
     SPACING SCALE
     Based on 4px grid (0.25rem)
     ───────────────────────────────────────────── */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;  /* 2px */
  --space-1: 0.25rem;     /* 4px */
  --space-1-5: 0.375rem;  /* 6px */
  --space-2: 0.5rem;      /* 8px */
  --space-2-5: 0.625rem;  /* 10px */
  --space-3: 0.75rem;     /* 12px */
  --space-3-5: 0.875rem;  /* 14px */
  --space-4: 1rem;        /* 16px */
  --space-5: 1.25rem;     /* 20px */
  --space-6: 1.5rem;      /* 24px */
  --space-7: 1.75rem;     /* 28px */
  --space-8: 2rem;        /* 32px */
  --space-9: 2.25rem;     /* 36px */
  --space-10: 2.5rem;     /* 40px */
  --space-11: 2.75rem;    /* 44px */
  --space-12: 3rem;       /* 48px */
  --space-14: 3.5rem;     /* 56px */
  --space-16: 4rem;       /* 64px */
  --space-20: 5rem;       /* 80px */
  --space-24: 6rem;       /* 96px */
  --space-28: 7rem;       /* 112px */
  --space-32: 8rem;       /* 128px */
  --space-36: 9rem;       /* 144px */
  --space-40: 10rem;      /* 160px */
  --space-44: 11rem;      /* 176px */
  --space-48: 12rem;      /* 192px */
  --space-52: 13rem;      /* 208px */
  --space-56: 14rem;      /* 224px */
  --space-60: 15rem;      /* 240px */
  --space-64: 16rem;      /* 256px */
  --space-72: 18rem;      /* 288px */
  --space-80: 20rem;      /* 320px */
  --space-96: 24rem;      /* 384px */
  
  /* Section spacing */
  --section-padding: var(--space-20);
  --section-padding-sm: var(--space-12);
  --section-padding-lg: var(--space-24);
  
  /* Container */
  --container-max: 1400px;
  --container-padding: var(--space-6);
  --container-padding-sm: var(--space-4);
  
  /* ─────────────────────────────────────────────
     BORDERS
     ───────────────────────────────────────────── */
  /* Border radius */
  --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-3xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;
  
  /* Common component radii */
  --radius-button: var(--radius-lg);
  --radius-card: var(--radius-xl);
  --radius-input: var(--radius-lg);
  --radius-badge: var(--radius-full);
  --radius-modal: var(--radius-2xl);
  
  /* Border colors */
  --border-color: var(--color-gray-200);
  --border-color-light: var(--color-gray-100);
  --border-color-dark: var(--color-gray-300);
  --border-color-focus: var(--color-primary);
  
  /* Border widths */
  --border-width: 1px;
  --border-width-2: 2px;
  --border-width-4: 4px;
  
  /* ─────────────────────────────────────────────
     TRANSITIONS & ANIMATIONS
     ───────────────────────────────────────────── */
  /* Durations */
  --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 functions */
  --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-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  
  /* Common transitions */
  --transition-fast: var(--duration-150) var(--ease-out);
  --transition-normal: var(--duration-200) var(--ease-out);
  --transition-slow: var(--duration-300) var(--ease-out);
  --transition-slower: var(--duration-500) var(--ease-out);
  
  /* Specific transitions */
  --transition-colors: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
  --transition-opacity: opacity var(--transition-fast);
  --transition-shadow: box-shadow var(--transition-normal);
  --transition-transform: transform var(--transition-normal);
  --transition-all: all var(--transition-normal);
  
  /* ─────────────────────────────────────────────
     Z-INDEX SCALE
     ───────────────────────────────────────────── */
  --z-behind: -1;
  --z-base: 0;
  --z-docked: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-banner: 250;
  --z-overlay: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
  --z-toast: 700;
  --z-max: 9999;
  
  /* ─────────────────────────────────────────────
     BREAKPOINTS (for reference in JS)
     Use @media queries in CSS
     ───────────────────────────────────────────── */
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
  --breakpoint-2xl: 1400px;
  
  /* ─────────────────────────────────────────────
     COMPONENT-SPECIFIC TOKENS
     ───────────────────────────────────────────── */
  
  /* Cards */
  --card-padding: var(--space-6);
  --card-padding-sm: var(--space-4);
  --card-gap: var(--space-4);
  --card-border-radius: var(--radius-card);
  --card-shadow: var(--shadow-card);
  --card-shadow-hover: var(--shadow-card-hover);
  
  /* Buttons */
  --button-height-sm: 2rem;       /* 32px */
  --button-height-md: 2.5rem;     /* 40px */
  --button-height-lg: 3rem;       /* 48px */
  --button-padding-x: var(--space-4);
  --button-padding-x-sm: var(--space-3);
  --button-padding-x-lg: var(--space-6);
  --button-font-weight: var(--font-medium);
  --button-border-radius: var(--radius-button);
  
  /* Inputs */
  --input-height: 2.5rem;         /* 40px */
  --input-height-sm: 2rem;        /* 32px */
  --input-height-lg: 3rem;        /* 48px */
  --input-padding-x: var(--space-3);
  --input-border-radius: var(--radius-input);
  --input-border-color: var(--border-color);
  --input-focus-ring: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
  
  /* Badges */
  --badge-padding-x: var(--space-2);
  --badge-padding-y: var(--space-1);
  --badge-font-size: var(--text-xs);
  --badge-font-weight: var(--font-medium);
  --badge-border-radius: var(--radius-badge);
  
  /* Navbar */
  --navbar-height: 4rem;          /* 64px */
  --navbar-height-mobile: 3.5rem; /* 56px */
  
  /* Sidebar */
  --sidebar-width: 280px;
  --sidebar-width-collapsed: 64px;
  
  /* Toast */
  --toast-width: 360px;
  --toast-padding: var(--space-4);
  
  /* Modal */
  --modal-width-sm: 400px;
  --modal-width-md: 560px;
  --modal-width-lg: 800px;
  --modal-width-xl: 1140px;
}

/* ─────────────────────────────────────────────
   KEYFRAME ANIMATIONS
   ───────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes fadeInUp {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes fadeInDown {
  from { 
    opacity: 0; 
    transform: translateY(-20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes fadeInLeft {
  from { 
    opacity: 0; 
    transform: translateX(-20px); 
  }
  to { 
    opacity: 1; 
    transform: translateX(0); 
  }
}

@keyframes fadeInRight {
  from { 
    opacity: 0; 
    transform: translateX(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateX(0); 
  }
}

@keyframes fadeInScale {
  from { 
    opacity: 0; 
    transform: scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: scale(1); 
  }
}

@keyframes slideDown {
  from { 
    transform: translateY(-100%); 
    opacity: 0; 
  }
  to { 
    transform: translateY(0); 
    opacity: 1; 
  }
}

@keyframes slideUp {
  from { 
    transform: translateY(100%); 
    opacity: 0; 
  }
  to { 
    transform: translateY(0); 
    opacity: 1; 
  }
}

@keyframes scaleIn {
  from { 
    transform: scale(0.9); 
    opacity: 0; 
  }
  to { 
    transform: scale(1); 
    opacity: 1; 
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes pulse {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1); 
  }
  50% { 
    opacity: 0.7; 
    transform: scale(1.02); 
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

@keyframes countUp {
  from { 
    opacity: 0; 
    transform: translateY(10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* ─────────────────────────────────────────────
   UTILITY ANIMATION CLASSES
   ───────────────────────────────────────────── */

.animate-fadeIn { animation: fadeIn var(--duration-300) var(--ease-out); }
.animate-fadeInUp { animation: fadeInUp var(--duration-300) var(--ease-out); }
.animate-fadeInDown { animation: fadeInDown var(--duration-300) var(--ease-out); }
.animate-fadeInLeft { animation: fadeInLeft var(--duration-300) var(--ease-out); }
.animate-fadeInRight { animation: fadeInRight var(--duration-300) var(--ease-out); }
.animate-fadeInScale { animation: fadeInScale var(--duration-300) var(--ease-out); }
.animate-slideDown { animation: slideDown var(--duration-300) var(--ease-out); }
.animate-slideUp { animation: slideUp var(--duration-300) var(--ease-out); }
.animate-scaleIn { animation: scaleIn var(--duration-200) var(--ease-spring); }
.animate-spin { animation: spin 1s linear infinite; }
.animate-ping { animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-bounce { animation: bounce 1s infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* Animation with staggered delay support */
.animate-in {
  animation: fadeInUp var(--duration-300) var(--ease-out) both;
  animation-delay: var(--animation-delay, 0ms);
}

/* ─────────────────────────────────────────────
   REDUCED MOTION SUPPORT
   ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─────────────────────────────────────────────
   DARK MODE (Future implementation)
   ───────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root.dark-mode {
    /* Background overrides */
    --bg-page: var(--color-gray-900);
    --bg-card: var(--color-gray-800);
    --bg-section: var(--color-gray-800);
    --bg-section-alt: var(--color-gray-850);
    
    /* Text overrides */
    --text-primary: var(--color-gray-100);
    --text-secondary: var(--color-gray-300);
    --text-muted: var(--color-gray-400);
    
    /* Border overrides */
    --border-color: var(--color-gray-700);
    --border-color-light: var(--color-gray-800);
    
    /* Shadow overrides */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 12px 24px rgba(0, 0, 0, 0.4);
  }
}

/* ─────────────────────────────────────────────
   PRINT STYLES
   ───────────────────────────────────────────── */

@media print {
  :root {
    --bg-page: white;
    --bg-card: white;
    --text-primary: black;
    --text-secondary: #333;
    --shadow-card: none;
    --shadow-card-hover: none;
  }
}
