/* ============================================================
   DESIGN TOKENS
   Single source of truth for all design values

   Usage: var(--token-name)
   Docs: /docs/design-system.md
   ============================================================ */

:root {
    /* ========================================================
       PRIMITIVE TOKENS
       Raw values - don't use directly in components
       ======================================================== */

    /* Colors - Gray Scale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --black: #000000;

    /* Colors - Semantic Raw */
    --green-500: #10b981;
    --green-600: #059669;
    --green-700: #047857;
    --green-800: #065f46;
    --green-50: #ecfdf5;
    --green-100: #d1fae5;

    --yellow-400: #fbbf24;
    --yellow-500: #eab308;
    --yellow-100: #fef9c3;
    --yellow-800: #713f12;

    --red-400: #f87171;
    --red-500: #ef4444;
    --red-600: #dc2626;

    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;

    /* 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 */

    /* Typography - Font Families */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

    /* Typography - 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 */

    /* Typography - Font Weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Typography - Line Heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* 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.25rem;  /* 20px */
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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-panel: -4px 0 24px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 400ms;
    --ease-default: ease;
    --ease-in-out: ease-in-out;
    --ease-out: ease-out;
    --ease-snap: cubic-bezier(0.22, 1, 0.36, 1);

    /* Z-Index Scale */
    --z-base: 0;
    --z-above: 1;
    --z-dropdown: 10;
    --z-sticky: 100;
    --z-overlay: 9998;
    --z-modal: 9999;
    --z-top: 10000;


    /* ========================================================
       SEMANTIC TOKENS
       Use these in components
       ======================================================== */

    /* Text Colors */
    --color-text-primary: var(--gray-900);
    --color-text-secondary: var(--gray-600);
    --color-text-tertiary: var(--gray-500);
    --color-text-muted: var(--gray-400);
    --color-text-inverted: var(--white);
    --color-text-link: var(--blue-600);
    --color-text-link-hover: var(--blue-700);

    /* Background Colors */
    --color-bg-page: var(--white);
    --color-bg-surface: var(--gray-50);
    --color-bg-muted: var(--gray-100);
    --color-bg-inverted: var(--gray-900);
    --color-bg-hover: var(--gray-50);
    --color-bg-active: var(--gray-100);

    /* Border Colors */
    --color-border-default: var(--gray-200);
    --color-border-muted: var(--gray-100);
    --color-border-strong: var(--gray-300);
    --color-border-focus: var(--gray-900);

    /* Status Colors */
    --color-success: var(--green-500);
    --color-success-text: var(--green-800);
    --color-success-bg: var(--green-100);

    --color-warning: var(--yellow-500);
    --color-warning-text: var(--yellow-800);
    --color-warning-bg: var(--yellow-100);

    --color-error: var(--red-500);
    --color-error-text: var(--red-600);

    /* Interactive Colors */
    --color-primary: var(--gray-900);
    --color-primary-hover: var(--gray-800);
    --color-primary-text: var(--white);

    --color-secondary: var(--white);
    --color-secondary-hover: var(--gray-50);
    --color-secondary-text: var(--gray-900);
    --color-secondary-border: var(--gray-200);

    /* Component-Specific */
    --color-input-bg: var(--gray-50);
    --color-input-border: var(--gray-200);
    --color-input-border-focus: var(--gray-400);
    --color-input-placeholder: var(--gray-400);

    --color-card-bg: var(--white);
    --color-card-border: var(--gray-200);

    --color-overlay: rgba(0, 0, 0, 0.5);
    --color-overlay-heavy: rgba(0, 0, 0, 0.9);

    /* Message Bubbles (Chat) */
    --color-bubble-user: var(--gray-900);
    --color-bubble-user-text: var(--white);
    --color-bubble-bot: var(--gray-100);
    --color-bubble-bot-text: var(--gray-900);

    /* Status Indicators */
    --color-status-online: var(--green-500);
    --color-status-offline: var(--red-500);
    --color-status-busy: var(--yellow-500);
    --color-status-idle: var(--gray-500);

    /* Star Rating */
    --color-star-active: var(--yellow-400);
    --color-star-inactive: var(--gray-200);

    /* Interactive States */
    --color-hover-light: rgba(17, 24, 39, 0.08);
    --color-hover-inverted: rgba(255, 255, 255, 0.2);
    --color-focus-ring: rgba(107, 114, 128, 0.1);
}

/* ========================================================
   DARK MODE TOKENS
   ======================================================== */

:root.dark {
    /* Text Colors - Dark Mode */
    --color-text-primary: var(--gray-100);
    --color-text-secondary: var(--gray-300);
    --color-text-tertiary: var(--gray-400);
    --color-text-muted: var(--gray-500);
    --color-text-inverted: var(--gray-900);

    /* Background Colors - Dark Mode */
    --color-bg-page: var(--gray-900);
    --color-bg-surface: var(--gray-800);
    --color-bg-muted: var(--gray-700);
    --color-bg-inverted: var(--gray-100);
    --color-bg-hover: var(--gray-800);
    --color-bg-active: var(--gray-700);

    /* Border Colors - Dark Mode */
    --color-border-default: var(--gray-700);
    --color-border-muted: var(--gray-800);
    --color-border-strong: var(--gray-600);
    --color-border-focus: var(--gray-100);

    /* Card - Dark Mode */
    --color-card-bg: var(--gray-800);
    --color-card-border: var(--gray-700);

    /* Interactive Colors - Dark Mode */
    --color-primary: var(--gray-100);
    --color-primary-hover: var(--gray-200);
    --color-primary-text: var(--gray-900);

    --color-secondary: var(--gray-800);
    --color-secondary-hover: var(--gray-700);
    --color-secondary-text: var(--gray-100);
    --color-secondary-border: var(--gray-600);

    /* Input - Dark Mode */
    --color-input-bg: var(--gray-800);
    --color-input-border: var(--gray-600);
    --color-input-border-focus: var(--gray-500);
    --color-input-placeholder: var(--gray-500);

    /* Message Bubbles (Chat) - Dark Mode */
    --color-bubble-user: var(--gray-100);
    --color-bubble-user-text: var(--gray-900);
    --color-bubble-bot: var(--gray-800);
    --color-bubble-bot-text: var(--gray-100);
}
