/*
 * Dialogr V3 Design Tokens
 *
 * Core design system variables. Import this first.
 * All components reference these tokens for consistency.
 */

:root {
  /* ========================================
     COLOR PALETTE - Dark Theme (default)
     ======================================== */

  /* Backgrounds - darkest to lightest */
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-tertiary: #18181b;
  --bg-elevated: #1f1f23;
  --bg-hover: #27272a;
  --bg-active: #303033;

  /* Borders - subtle to prominent */
  --border-subtle: #27272a;
  --border-default: #3f3f46;
  --border-accent: #52525b;
  --border-focus: var(--accent-primary);

  /* Text - brightest to dimmest */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  --text-muted: #52525b;
  --text-disabled: #3f3f46;

  /* ========================================
     BRAND COLORS - J&J Red
     ======================================== */

  --accent-primary: #D71500;
  --accent-secondary: #ef4444;
  --accent-muted: #7f1d1d;
  --accent-glow: rgba(215, 21, 0, 0.15);
  --accent-glow-strong: rgba(215, 21, 0, 0.25);

  /* ========================================
     SEMANTIC COLORS
     ======================================== */

  /* Success */
  --success: #22c55e;
  --success-muted: rgba(34, 197, 94, 0.15);
  --success-text: #4ade80;

  /* Warning */
  --warning: #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.15);
  --warning-text: #fbbf24;

  /* Error */
  --error: #ef4444;
  --error-muted: rgba(239, 68, 68, 0.15);
  --error-text: #f87171;

  /* Info */
  --info: #3b82f6;
  --info-muted: rgba(59, 130, 246, 0.15);
  --info-text: #60a5fa;

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

  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

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

  /* Font families */
  --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Font sizes */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 32px;

  /* Line heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* Font weights */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

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

  --sidebar-width: 380px;
  --sidebar-width-expanded: 480px;
  --sidebar-min: 280px;
  --main-min: 400px;

  /* Divider & resize */
  --divider-width: 6px;
  --divider-idle: var(--border-subtle);
  --divider-hover: var(--border-default);
  --divider-active: var(--accent-primary);
  --header-height: 56px;
  --input-height: 40px;
  --input-height-sm: 32px;
  --input-height-lg: 48px;

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

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

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

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --shadow-focus: 0 0 0 2px var(--accent-glow);

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

  --duration-fast: 100ms;
  --duration-normal: 150ms;
  --duration-slow: 250ms;
  --duration-slower: 350ms;

  --ease-default: ease;
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shorthand */
  --transition-fast: var(--duration-fast) var(--ease-default);
  --transition-normal: var(--duration-normal) var(--ease-default);
  --transition-slow: var(--duration-slow) var(--ease-default);

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

  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;
}

/* ==========================================
   LIGHT THEME
   ========================================== */

[data-theme="light"] {
  /* Backgrounds - lightest to darkest */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-elevated: #ffffff;
  --bg-hover: #e5e7eb;
  --bg-active: #d1d5db;

  /* Borders */
  --border-subtle: #e5e7eb;
  --border-default: #d1d5db;
  --border-accent: #9ca3af;

  /* Text - darkest to lightest */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;
  --text-disabled: #d1d5db;

  /* Brand - slightly darker for light bg contrast */
  --accent-primary: #c41200;
  --accent-secondary: #dc2626;
  --accent-muted: #fecaca;
  --accent-glow: rgba(196, 18, 0, 0.1);
  --accent-glow-strong: rgba(196, 18, 0, 0.15);

  /* Semantic - darker for light bg contrast */
  --success: #16a34a;
  --success-muted: rgba(22, 163, 74, 0.1);
  --success-text: #15803d;

  --warning: #d97706;
  --warning-muted: rgba(217, 119, 6, 0.1);
  --warning-text: #b45309;

  --error: #dc2626;
  --error-muted: rgba(220, 38, 38, 0.1);
  --error-text: #b91c1c;

  --info: #2563eb;
  --info-muted: rgba(37, 99, 235, 0.1);
  --info-text: #1d4ed8;

  /* Shadows - lighter for light theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --shadow-focus: 0 0 0 2px var(--accent-glow);
}

/* ==========================================
   SYSTEM PREFERENCE AUTO-SWITCH
   Respects user's OS preference when no data-theme is set
   ========================================== */

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-elevated: #ffffff;
    --bg-hover: #e5e7eb;
    --bg-active: #d1d5db;

    /* Borders */
    --border-subtle: #e5e7eb;
    --border-default: #d1d5db;
    --border-accent: #9ca3af;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    --text-muted: #9ca3af;
    --text-disabled: #d1d5db;

    /* Brand */
    --accent-primary: #c41200;
    --accent-secondary: #dc2626;
    --accent-muted: #fecaca;
    --accent-glow: rgba(196, 18, 0, 0.1);
    --accent-glow-strong: rgba(196, 18, 0, 0.15);

    /* Semantic */
    --success: #16a34a;
    --success-muted: rgba(22, 163, 74, 0.1);
    --success-text: #15803d;

    --warning: #d97706;
    --warning-muted: rgba(217, 119, 6, 0.1);
    --warning-text: #b45309;

    --error: #dc2626;
    --error-muted: rgba(220, 38, 38, 0.1);
    --error-text: #b91c1c;

    --info: #2563eb;
    --info-muted: rgba(37, 99, 235, 0.1);
    --info-text: #1d4ed8;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px var(--accent-glow);
    --shadow-focus: 0 0 0 2px var(--accent-glow);
  }
}
