/**
 * TIC Design System - Variables
 * CSS Custom Properties (Design Tokens)
 * Shared with Ormeo.Web for consistency
 */

:root {
    /* ----------------------------------------
       Typography
       ---------------------------------------- */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-sans: var(--font-family);
    --font-family-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', 'Monaco', monospace;

    /* Short aliases */
    --font-sans: var(--font-family-sans);
    --font-mono: var(--font-family-mono);

    /* Font sizes */
    --text-xs: 0.6875rem;    /* 11px */
    --text-sm: 0.8125rem;    /* 13px */
    --text-base: 0.875rem;   /* 14px */
    --text-lg: 1rem;         /* 16px */
    --text-xl: 1.125rem;     /* 18px */
    --text-2xl: 1.25rem;     /* 20px */
    --text-3xl: 1.5rem;      /* 24px */
    --text-4xl: 1.875rem;    /* 30px */
    --text-5xl: 2.25rem;     /* 36px */
    --text-6xl: 3rem;        /* 48px */

    /* Font weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Line heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Letter spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;

    /* ----------------------------------------
       Spacing Scale
       ---------------------------------------- */
    --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 */

    /* ----------------------------------------
       Border Radius
       ---------------------------------------- */
    --radius-none: 0;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* ----------------------------------------
       Container
       ---------------------------------------- */
    --container-max: 1200px;
    --container-padding: var(--space-4);
    --text-max-width: 800px;

    /* ----------------------------------------
       Transitions
       ---------------------------------------- */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-colors: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);

    /* ----------------------------------------
       Z-Index Scale
       ---------------------------------------- */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;

    /* ----------------------------------------
       Colors - Light Theme (Default)
       ---------------------------------------- */

    /* Backgrounds */
    --bg-primary: #f9f8f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f4f2;
    --bg-hover: #f0efed;
    --bg-active: #e8e7e5;
    --bg-elevated: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);

    /* Text - WCAG AA compliant contrast ratios */
    --text-primary: #1f1f1f;
    --text-secondary: #525252;
    --text-tertiary: #5c5c5c;
    --text-quaternary: #737373;
    --text-inverse: #ffffff;

    /* Borders */
    --border-primary: #e5e5e5;
    --border-secondary: #d4d4d4;
    --border-focus: #357a6b;

    /* Brand / Accent Colors - WCAG AA compliant */
    --accent-primary: #357a6b;
    --accent-primary-hover: #2d6a5c;
    --accent-primary-active: #255a4d;
    --accent-green: #4a9d7c;
    --accent-orange: #c9a857;
    --accent-red: #c75555;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #f59e0b;

    /* Semantic Colors */
    --color-success: #4a9d7c;
    --color-success-bg: #ecfdf5;
    --color-success-border: #a7f3d0;

    --color-warning: #c9a857;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;

    --color-error: #c75555;
    --color-error-bg: #fef2f2;
    --color-error-border: #fecaca;

    --color-info: #3b82f6;
    --color-info-bg: #eff6ff;
    --color-info-border: #bfdbfe;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03);

    /* Focus ring */
    --ring-color: rgba(53, 122, 107, 0.5);
    --ring-offset: 2px;
    --ring-width: 2px;
}

/* ==========================================================================
   Dark Theme
   ========================================================================== */

[data-theme="dark"] {
    /* Backgrounds */
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --bg-tertiary: #2a2a2a;
    --bg-hover: #333333;
    --bg-active: #404040;
    --bg-elevated: #2a2a2a;
    --bg-overlay: rgba(0, 0, 0, 0.75);

    /* Text - WCAG AA compliant on dark backgrounds */
    --text-primary: #fafafa;
    --text-secondary: #d4d4d8;
    --text-tertiary: #b4b4bb;
    --text-quaternary: #8a8a92;
    --text-inverse: #ffffff;

    /* Borders */
    --border-primary: #3f3f3f;
    --border-secondary: #525252;
    --border-focus: #4a9c88;

    /* Brand / Accent - adjusted for dark backgrounds */
    --accent-primary: #357a6b;
    --accent-primary-hover: #3d8b78;
    --accent-primary-active: #4a9c88;
    --accent-green: #5bae8d;
    --accent-orange: #d9b967;
    --accent-red: #d76565;
    --accent-secondary: #a78bfa;
    --accent-tertiary: #fbbf24;

    /* Semantic Colors */
    --color-success: #5bae8d;
    --color-success-bg: rgba(91, 174, 141, 0.1);
    --color-success-border: rgba(91, 174, 141, 0.3);

    --color-warning: #d9b967;
    --color-warning-bg: rgba(217, 185, 103, 0.1);
    --color-warning-border: rgba(217, 185, 103, 0.3);

    --color-error: #d76565;
    --color-error-bg: rgba(215, 101, 101, 0.1);
    --color-error-border: rgba(215, 101, 101, 0.3);

    --color-info: #60a5fa;
    --color-info-bg: rgba(96, 165, 250, 0.1);
    --color-info-border: rgba(96, 165, 250, 0.3);

    /* Shadows - darker for dark mode */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.2);

    /* Focus ring */
    --ring-color: rgba(53, 122, 107, 0.5);
}

/* OS Preference Detection */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: #1a1a1a;
        --bg-secondary: #242424;
        --bg-tertiary: #2a2a2a;
        --bg-hover: #333333;
        --bg-active: #404040;
        --bg-elevated: #2a2a2a;
        --bg-overlay: rgba(0, 0, 0, 0.75);
        --text-primary: #fafafa;
        --text-secondary: #d4d4d8;
        --text-tertiary: #b4b4bb;
        --text-quaternary: #8a8a92;
        --text-inverse: #ffffff;
        --border-primary: #3f3f3f;
        --border-secondary: #525252;
        --border-focus: #4a9c88;
        --accent-primary-hover: #3d8b78;
        --accent-primary-active: #4a9c88;
        --accent-green: #5bae8d;
        --accent-orange: #d9b967;
        --accent-red: #d76565;
        --color-success: #5bae8d;
        --color-success-bg: rgba(91, 174, 141, 0.1);
        --color-success-border: rgba(91, 174, 141, 0.3);
        --color-warning: #d9b967;
        --color-warning-bg: rgba(217, 185, 103, 0.1);
        --color-warning-border: rgba(217, 185, 103, 0.3);
        --color-error: #d76565;
        --color-error-bg: rgba(215, 101, 101, 0.1);
        --color-error-border: rgba(215, 101, 101, 0.3);
        --color-info: #60a5fa;
        --color-info-bg: rgba(96, 165, 250, 0.1);
        --color-info-border: rgba(96, 165, 250, 0.3);
        --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
        --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
        --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
        --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
        --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.2);
        --ring-color: rgba(53, 122, 107, 0.5);
    }
}
