/**
 * GroupChat Design Tokens
 * ========================
 *
 * This file is the canonical source of truth for all design tokens in the application.
 * All colors, typography, spacing, and other design values should be defined here.
 *
 * USAGE:
 * - Reference these CSS custom properties in component styles
 * - Tailwind config should reference these values where possible
 * - Do NOT duplicate these values elsewhere
 *
 * NAMING CONVENTION:
 * - Palette colors: --color-{name}-{shade} (e.g., --color-blue-500)
 * - Semantic colors: --{purpose} (e.g., --text-primary, --surface-primary)
 * - Component tokens: --{component}-{property} (e.g., --btn-radius)
 *
 * Based on Apple Human Interface Guidelines color palette.
 */

:root {
    /* =========================================
     * COLOR PALETTE
     * =========================================
     * Raw color values - use semantic tokens in components
     */

    /* Primary Brand Colors */
    --color-blue-500: #007AFF;
    --color-blue-600: #0051D5;

    /* Status Colors */
    --color-green-500: #34C759;
    --color-red-500: #FF3B30;
    --color-yellow-500: #FBBF24;
    --color-orange-500: #F59E0B;

    /* Neutral Grays */
    --color-gray-50: #F5F5F7;
    --color-gray-100: #E5E5EA;
    --color-gray-200: #D2D2D7;
    --color-gray-300: #C7C7CC;
    --color-gray-400: #AEAEB2;
    --color-gray-500: #86868B;
    --color-gray-600: #636366;
    --color-gray-700: #374151;
    --color-gray-800: #1F2937;
    --color-gray-900: #1D1D1F;

    /* Pure Colors */
    --color-white: #FFFFFF;
    --color-black: #000000;

    /* =========================================
     * SEMANTIC TOKENS
     * =========================================
     * Use these in components - they map to palette colors
     */

    /* Primary Accent (Apple Blue) */
    --color-primary: var(--color-blue-500);
    --color-primary-hover: var(--color-blue-600);

    /* Status Colors */
    --color-success: var(--color-green-500);
    --color-danger: var(--color-red-500);
    --color-warning: var(--color-orange-500);
    --color-info: var(--color-blue-500);

    /* Text Colors */
    --text-primary: var(--color-gray-900);
    --text-secondary: var(--color-gray-500);
    --text-tertiary: var(--color-gray-500);
    --text-inverse: var(--color-white);
    --text-link: var(--color-primary);

    /* Surface Colors (Backgrounds) */
    --surface-primary: var(--color-white);
    --surface-secondary: var(--color-gray-50);
    --surface-tertiary: var(--color-gray-100);

    /* Border Colors */
    --border-default: var(--color-gray-200);
    --border-subtle: var(--color-gray-100);
    --border-focus: var(--color-primary);

    /* =========================================
     * LEGACY ALIASES
     * =========================================
     * Backwards compatibility with existing code
     * TODO: Migrate components to semantic tokens and remove these
     */

    /* Apple naming convention (used in app.css and components) */
    --apple-blue: var(--color-blue-500);
    --apple-green: var(--color-green-500);
    --apple-red: var(--color-red-500);
    --apple-gray: var(--color-gray-500);
    --apple-gray-light: var(--color-gray-50);
    --apple-text-primary: var(--text-primary);
    --apple-text-secondary: var(--text-secondary);
    --apple-border: var(--border-default);

    /* iMessage component tokens */
    --imessage-blue: var(--color-blue-500);
    --imessage-gray: var(--color-gray-100);
    --imessage-highlight: #FEF08A;

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

    /* Font Families */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Courier New', 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 */

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

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

    /* =========================================
     * SPACING
     * =========================================
     */

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

    /* =========================================
     * BORDER RADIUS
     * =========================================
     */

    --radius-sm: 0.25rem;   /* 4px */
    --radius-md: 0.5rem;    /* 8px */
    --radius-lg: 0.75rem;   /* 12px */
    --radius-xl: 1rem;      /* 16px */
    --radius-full: 9999px;

    /* =========================================
     * SHADOWS
     * =========================================
     */

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* =========================================
     * TRANSITIONS
     * =========================================
     */

    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* =========================================
     * Z-INDEX SCALE
     * =========================================
     */

    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 1000;
    --z-toast: 9999;

    /* =========================================
     * COMPONENT TOKENS
     * =========================================
     * Specific component-level tokens for consistency
     */

    /* Buttons */
    --btn-radius: var(--radius-md);
    --btn-padding-x: var(--space-4);
    --btn-padding-y: var(--space-2);
    --btn-font-size: var(--text-sm);
    --btn-font-weight: var(--font-medium);

    /* Cards */
    --card-radius: var(--radius-lg);
    --card-padding: var(--space-6);
    --card-shadow: var(--shadow-md);

    /* Inputs */
    --input-radius: var(--radius-md);
    --input-border: var(--border-default);
    --input-focus-ring: var(--color-primary);

    /* Touch Targets (Accessibility) */
    --touch-target-min: 44px;
}
