/**
 * MiUtils Design System Tokens
 * Version: 1.0.0
 * Pure CSS Custom Properties for clean slate light theme default and optional dark theme
 */

:root {
  /* ==========================================================================
     1. Color Palette: Modern Slate Light Theme (Default)
     ========================================================================== */

  /* Surface & Background Hierarchy */
  --mu-bg-app: #f8fafc;                /* Slate 50: Crisp app background */
  --mu-bg-surface: #ffffff;            /* Pure White: Cards, panels & header */
  --mu-bg-surface-secondary: #f1f5f9;  /* Slate 100: Inputs, tags & sidebars */
  --mu-bg-surface-hover: #e2e8f0;      /* Slate 200: Subtle hover state */
  --mu-bg-surface-active: #cbd5e1;     /* Slate 300: Active pressed state */

  /* Text Hierarchy */
  --mu-text-primary: #0f172a;          /* Slate 900: High-contrast primary text */
  --mu-text-secondary: #475569;        /* Slate 600: Secondary labels & hints */
  --mu-text-muted: #94a3b8;            /* Slate 400: Placeholders & disabled text */
  --mu-text-on-primary: #ffffff;       /* Pure white text on primary buttons */

  /* Primary Action Colors (Royal Blue) */
  --mu-primary: #2563eb;               /* Blue 600: Primary action & focus */
  --mu-primary-hover: #1d4ed8;         /* Blue 700: Hover state */
  --mu-primary-active: #1e40af;        /* Blue 800: Active pressed state */
  --mu-primary-subtle: #eff6ff;        /* Blue 50: Badge & active pill background */
  --mu-primary-subtle-border: #bfdbfe; /* Blue 200: Active pill border */

  /* Status Colors */
  --mu-success: #10b981;               /* Emerald 500 */
  --mu-success-hover: #059669;
  --mu-success-subtle: #ecfdf5;        /* Emerald 50 */
  --mu-success-border: #a7f3d0;

  --mu-warning: #f59e0b;               /* Amber 500 */
  --mu-warning-hover: #d97706;
  --mu-warning-subtle: #fffbeb;        /* Amber 50 */
  --mu-warning-border: #fde68a;

  --mu-danger: #ef4444;                /* Red 500 */
  --mu-danger-hover: #dc2626;
  --mu-danger-subtle: #fef2f2;         /* Red 50 */
  --mu-danger-border: #fecaca;

  --mu-info: #0284c7;                  /* Sky 600 */
  --mu-info-subtle: #f0f9ff;
  --mu-info-border: #bae6fd;

  /* Borders & Dividers */
  --mu-border-subtle: #e2e8f0;         /* Slate 200: Dividers & subtle outlines */
  --mu-border-medium: #cbd5e1;         /* Slate 300: Form field borders */
  --mu-border-strong: #94a3b8;         /* Slate 400 */
  --mu-border-focus: #2563eb;          /* Focused input outline */

  /* ==========================================================================
     2. Restrained Border Radii (No exaggerated bubbles)
     ========================================================================== */
  --mu-radius-xs: 4px;                 /* Micro badges, keys */
  --mu-radius-sm: 6px;                 /* Buttons, inputs, small tags */
  --mu-radius-md: 8px;                 /* Standard cards, modals */
  --mu-radius-lg: 12px;                /* Large containers, workbench surfaces */
  --mu-radius-pill: 9999px;            /* Category pills & status chips */

  /* ==========================================================================
     3. Elevation & Subtle Shadows
     ========================================================================== */
  --mu-shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --mu-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --mu-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --mu-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);

  /* ==========================================================================
     4. Typography Scale & Stacks
     ========================================================================== */
  --mu-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mu-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --mu-text-xs: 0.75rem;    /* 12px */
  --mu-text-sm: 0.875rem;   /* 14px */
  --mu-text-base: 1rem;     /* 16px */
  --mu-text-lg: 1.125rem;   /* 18px */
  --mu-text-xl: 1.25rem;    /* 20px */
  --mu-text-2xl: 1.5rem;    /* 24px */
  --mu-text-3xl: 1.875rem;  /* 30px */

  --mu-font-normal: 400;
  --mu-font-medium: 500;
  --mu-font-semibold: 600;
  --mu-font-bold: 700;

  /* ==========================================================================
     5. Spacing Scale
     ========================================================================== */
  --mu-space-1: 4px;
  --mu-space-2: 8px;
  --mu-space-3: 12px;
  --mu-space-4: 16px;
  --mu-space-5: 20px;
  --mu-space-6: 24px;
  --mu-space-8: 32px;
  --mu-space-10: 40px;

  /* ==========================================================================
     6. Layout & Sizing
     ========================================================================== */
  --mu-header-height: 56px;

  /* ==========================================================================
     7. Z-Index Layers
     ========================================================================== */
  --mu-z-header: 100;
  --mu-z-dropdown: 200;
  --mu-z-modal: 300;
  --mu-z-toast: 400;

  /* ==========================================================================
     8. Motion & Transitions
     ========================================================================== */
  --mu-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --mu-transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ==========================================================================
     9. Scrollbars
     ========================================================================== */
  --mu-scrollbar-track: transparent;
  --mu-scrollbar-thumb: #cbd5e1;
  --mu-scrollbar-thumb-hover: #94a3b8;
}

/* ==========================================================================
   Optional Dark Theme Tokens
   (Strictly activated by user toggle via body.dark-theme or [data-theme="dark"])
   ========================================================================== */
body.dark-theme,
[data-theme="dark"],
[data-theme="dark"] body {
  /* Surfaces */
  --mu-bg-app: #090d16;                /* Deep Charcoal */
  --mu-bg-surface: #111827;            /* Gray 900 */
  --mu-bg-surface-secondary: #1f2937;  /* Gray 800 */
  --mu-bg-surface-hover: #374151;      /* Gray 700 */
  --mu-bg-surface-active: #4b5563;     /* Gray 600 */

  /* Text */
  --mu-text-primary: #f9fafb;          /* Gray 50 */
  --mu-text-secondary: #9ca3af;        /* Gray 400 */
  --mu-text-muted: #6b7280;            /* Gray 500 */
  --mu-text-on-primary: #ffffff;

  /* Primary Accent in Dark Mode */
  --mu-primary: #3b82f6;               /* Blue 500 */
  --mu-primary-hover: #60a5fa;         /* Blue 400 */
  --mu-primary-active: #2563eb;
  --mu-primary-subtle: rgba(59, 130, 246, 0.15);
  --mu-primary-subtle-border: rgba(59, 130, 246, 0.35);

  /* Status Colors Dark */
  --mu-success: #34d399;
  --mu-success-hover: #10b981;
  --mu-success-subtle: rgba(16, 185, 129, 0.15);
  --mu-success-border: rgba(16, 185, 129, 0.35);

  --mu-warning: #fbbf24;
  --mu-warning-hover: #f59e0b;
  --mu-warning-subtle: rgba(245, 158, 11, 0.15);
  --mu-warning-border: rgba(245, 158, 11, 0.35);

  --mu-danger: #f87171;
  --mu-danger-hover: #ef4444;
  --mu-danger-subtle: rgba(239, 68, 68, 0.15);
  --mu-danger-border: rgba(239, 68, 68, 0.35);

  --mu-info: #38bdf8;
  --mu-info-subtle: rgba(56, 189, 248, 0.15);
  --mu-info-border: rgba(56, 189, 248, 0.35);

  /* Borders Dark */
  --mu-border-subtle: #1f2937;         /* Gray 800 */
  --mu-border-medium: #374151;         /* Gray 700 */
  --mu-border-strong: #4b5563;         /* Gray 600 */
  --mu-border-focus: #3b82f6;

  /* Shadows Dark */
  --mu-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --mu-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --mu-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --mu-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.4);

  /* Scrollbars Dark */
  --mu-scrollbar-track: transparent;
  --mu-scrollbar-thumb: #374151;
  --mu-scrollbar-thumb-hover: #4b5563;
}
