/**
 * Design Tokens & CSS Custom Properties
 * Enterprise-grade design system for Contracting.App
 * Optimized for high-net-worth client presentations
 */

/* =============================================================================
   COLOR SYSTEM - Light Theme (Default)
   ============================================================================= */

:root {
    /* Primary Colors - Professional Blue Palette */
    --color-primary: #1e40af;
    --color-primary-hover: #1e3a8a;
    --color-primary-active: #1e293b;
    --color-primary-light: #3b82f6;
    --color-primary-lighter: #60a5fa;
    --color-primary-subtle: #dbeafe;
    
    /* Secondary Colors - Accent Red */
    --color-secondary: #dc2626;
    --color-secondary-hover: #b91c1c;
    --color-secondary-active: #991b1b;
    --color-secondary-light: #ef4444;
    --color-secondary-subtle: #fee2e2;
    
    /* Success Colors - Professional Green */
    --color-success: #059669;
    --color-success-hover: #047857;
    --color-success-active: #065f46;
    --color-success-light: #10b981;
    --color-success-subtle: #d1fae5;
    
    /* Warning Colors - Amber */
    --color-warning: #d97706;
    --color-warning-hover: #b45309;
    --color-warning-active: #92400e;
    --color-warning-light: #f59e0b;
    --color-warning-subtle: #fef3c7;
    
    /* Danger Colors - Red Alert */
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-danger-active: #991b1b;
    --color-danger-light: #ef4444;
    --color-danger-subtle: #fee2e2;
    
    /* Info Colors - Sky Blue */
    --color-info: #0369a1;
    --color-info-hover: #075985;
    --color-info-active: #0c4a6e;
    --color-info-light: #0284c7;
    --color-info-subtle: #e0f2fe;
    
    /* Neutral Gray Scale - Professional Foundation */
    --color-gray-50: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-400: #94a3b8;
    --color-gray-500: #64748b;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1e293b;
    --color-gray-900: #0f172a;
    
    /* Semantic Color Tokens */
    --color-background: #ffffff;
    --color-background-secondary: #f8fafc;
    --color-background-tertiary: #f1f5f9;
    --color-surface: #ffffff;
    --color-surface-raised: #ffffff;
    --color-surface-overlay: #ffffff;
    
    --color-text: #0f172a;
    --color-text-secondary: #334155;
    --color-text-tertiary: #64748b;
    --color-text-muted: #94a3b8;
    --color-text-inverse: #ffffff;
    
    --color-border: #e2e8f0;
    --color-border-secondary: #cbd5e1;
    --color-border-focus: #3b82f6;
    
    --color-link: #1e40af;
    --color-link-hover: #1e3a8a;
    --color-link-visited: #6b21a8;
    
    /* Overlay & Backdrop */
    --color-overlay: rgba(15, 23, 42, 0.75);
    --color-backdrop: rgba(15, 23, 42, 0.5);
}

/* =============================================================================
   COLOR SYSTEM - Dark Theme
   ============================================================================= */

[data-theme="dark"] {
    /* Primary Colors - Brightened for Dark Backgrounds */
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-primary-active: #93c5fd;
    --color-primary-light: #60a5fa;
    --color-primary-lighter: #93c5fd;
    --color-primary-subtle: #1e3a8a;
    
    /* Secondary Colors */
    --color-secondary: #ef4444;
    --color-secondary-hover: #f87171;
    --color-secondary-active: #fca5a5;
    --color-secondary-light: #f87171;
    --color-secondary-subtle: #991b1b;
    
    /* Success Colors */
    --color-success: #10b981;
    --color-success-hover: #34d399;
    --color-success-active: #6ee7b7;
    --color-success-light: #34d399;
    --color-success-subtle: #065f46;
    
    /* Warning Colors */
    --color-warning: #f59e0b;
    --color-warning-hover: #fbbf24;
    --color-warning-active: #fcd34d;
    --color-warning-light: #fbbf24;
    --color-warning-subtle: #92400e;
    
    /* Danger Colors */
    --color-danger: #ef4444;
    --color-danger-hover: #f87171;
    --color-danger-active: #fca5a5;
    --color-danger-light: #f87171;
    --color-danger-subtle: #991b1b;
    
    /* Info Colors */
    --color-info: #0ea5e9;
    --color-info-hover: #38bdf8;
    --color-info-active: #7dd3fc;
    --color-info-light: #38bdf8;
    --color-info-subtle: #0c4a6e;
    
    /* Neutral Gray Scale - Inverted for Dark Mode */
    --color-gray-50: #0f172a;
    --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;
    
    /* Semantic Color Tokens - Dark Theme */
    --color-background: #0f172a;
    --color-background-secondary: #1e293b;
    --color-background-tertiary: #334155;
    --color-surface: #1e293b;
    --color-surface-raised: #334155;
    --color-surface-overlay: #475569;
    
    --color-text: #f8fafc;
    --color-text-secondary: #e2e8f0;
    --color-text-tertiary: #cbd5e1;
    --color-text-muted: #94a3b8;
    --color-text-inverse: #0f172a;
    
    --color-border: #334155;
    --color-border-secondary: #475569;
    --color-border-focus: #60a5fa;
    
    --color-link: #60a5fa;
    --color-link-hover: #93c5fd;
    --color-link-visited: #c084fc;
    
    /* Overlay & Backdrop - Darker */
    --color-overlay: rgba(15, 23, 42, 0.90);
    --color-backdrop: rgba(15, 23, 42, 0.75);
}

/* =============================================================================
   TYPOGRAPHY SYSTEM
   ============================================================================= */

:root {
    /* Font Families */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation 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: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */
    --font-size-5xl: 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;
}

/* =============================================================================
   SPACING SYSTEM (4px Grid)
   ============================================================================= */

:root {
    --space-0: 0;
    --space-1: 0.25rem;    /* 4px */
    --space-2: 0.5rem;     /* 8px */
    --space-3: 0.75rem;    /* 12px */
    --space-4: 1rem;       /* 16px */
    --space-5: 1.25rem;    /* 20px */
    --space-6: 1.5rem;     /* 24px */
    --space-8: 2rem;       /* 32px */
    --space-10: 2.5rem;    /* 40px */
    --space-12: 3rem;      /* 48px */
    --space-16: 4rem;      /* 64px */
    --space-20: 5rem;      /* 80px */
    --space-24: 6rem;      /* 96px */
    --space-32: 8rem;      /* 128px */
}

/* =============================================================================
   BORDER SYSTEM
   ============================================================================= */

:root {
    /* Border Widths */
    --border-width-0: 0;
    --border-width-1: 1px;
    --border-width-2: 2px;
    --border-width-4: 4px;
    --border-width-8: 8px;
    
    /* Border Radius */
    --radius-none: 0;
    --radius-sm: 0.25rem;   /* 4px */
    --radius-md: 0.5rem;    /* 8px */
    --radius-lg: 0.75rem;   /* 12px */
    --radius-xl: 1rem;      /* 16px */
    --radius-2xl: 1.5rem;   /* 24px */
    --radius-full: 9999px;
}

/* =============================================================================
   SHADOW SYSTEM
   ============================================================================= */

:root {
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
    --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: none;
    
    /* Focus Shadows */
    --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.5);
    --shadow-focus-danger: 0 0 0 3px rgba(239, 68, 68, 0.5);
    --shadow-focus-success: 0 0 0 3px rgba(16, 185, 129, 0.5);
}

[data-theme="dark"] {
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.4);
    
    /* Focus Shadows - Brighter for Dark Theme */
    --shadow-focus: 0 0 0 3px rgba(96, 165, 250, 0.6);
    --shadow-focus-danger: 0 0 0 3px rgba(248, 113, 113, 0.6);
    --shadow-focus-success: 0 0 0 3px rgba(52, 211, 153, 0.6);
}

/* =============================================================================
   Z-INDEX SYSTEM
   ============================================================================= */

:root {
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-notification: 1080;
}

/* =============================================================================
   ANIMATION & TRANSITION SYSTEM
   ============================================================================= */

:root {
    /* Transition Durations */
    --duration-instant: 0ms;
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;
    --duration-slower: 600ms;
    
    /* 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);
    
    /* Common Transitions */
    --transition-all: all var(--duration-base) var(--ease-in-out);
    --transition-colors: color var(--duration-fast) var(--ease-in-out), 
                        background-color var(--duration-fast) var(--ease-in-out),
                        border-color var(--duration-fast) var(--ease-in-out);
    --transition-transform: transform var(--duration-base) var(--ease-in-out);
    --transition-opacity: opacity var(--duration-base) var(--ease-in-out);
    --transition-shadow: box-shadow var(--duration-base) var(--ease-in-out);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    :root {
        --duration-fast: 0ms;
        --duration-base: 0ms;
        --duration-slow: 0ms;
        --duration-slower: 0ms;
    }
}

/* =============================================================================
   LAYOUT CONSTRAINTS
   ============================================================================= */

:root {
    /* Container Max Widths */
    --container-xs: 32rem;    /* 512px */
    --container-sm: 40rem;    /* 640px */
    --container-md: 48rem;    /* 768px */
    --container-lg: 64rem;    /* 1024px */
    --container-xl: 80rem;    /* 1280px */
    --container-2xl: 96rem;   /* 1536px */
    
    /* Breakpoints (for reference, use media queries) */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

