/* tokens.css v1.0.0 — Single source of truth for all design tokens */
/* This file must be loaded FIRST, before all other stylesheets */

:root {
  /* ===== Color Palette ===== */
  --color-primary: #004225;
  --color-primary-hover: #003118;
  --color-primary-light: #e6f4ed;
  --color-accent: #00b386;
  --color-accent-hover: #008060;

  /* Neutrals */
  --color-neutral-50: #f9fafb;
  --color-neutral-100: #f3f4f6;
  --color-neutral-200: #e5e7eb;
  --color-neutral-300: #d1d5db;
  --color-neutral-400: #9ca3af;
  --color-neutral-500: #6b7280;
  --color-neutral-600: #4b5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1f2937;
  --color-neutral-900: #111827;

  /* Semantic */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  /* ===== Typography ===== */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --text-xs: 0.6875rem;   /* 11px */
  --text-sm: 0.8125rem;   /* 13px */
  --text-base: 0.9375rem; /* 15px */
  --text-lg: 1.0625rem;   /* 17px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */

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

  --leading-tight: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* ===== Spacing (4px grid) ===== */
  --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.5rem;    /* 8px */
  --radius-md: 0.75rem;   /* 12px */
  --radius-lg: 1rem;      /* 16px */
  --radius-xl: 1.25rem;   /* 20px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* ===== Shadows ===== */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 60px rgba(0, 40, 20, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-focus: 0 0 0 3px rgba(0, 66, 37, 0.15);

  /* ===== Animation ===== */
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* ===== Chat-specific tokens ===== */
  --chat-bg: #f7f9f8;
  --chat-bubble-user-bg: #016630;
  --chat-bubble-user-text: #ffffff;
  --chat-bubble-bot-bg: #ffffff;
  --chat-bubble-bot-text: var(--color-neutral-800);
  --chat-bubble-bot-border: var(--color-neutral-200);
  --chat-bubble-admin-bg: #FDF2E9;
  --chat-bubble-admin-text: #7C2D12;
  --chat-input-bg: var(--color-neutral-50);
  --chat-input-border: var(--color-neutral-200);
}

/* ===== Dark Mode Tokens ===== */
:root[data-theme="dark"],
[data-theme="dark"] {
  --chat-bg: #121212;
  --chat-bubble-user-bg: #166534;
  --chat-bubble-user-text: #f0fdf4;
  --chat-bubble-bot-bg: #262626;
  --chat-bubble-bot-text: #e5e7eb;
  --chat-bubble-bot-border: #333333;
  --chat-bubble-admin-bg: #3d2c1a;
  --chat-bubble-admin-text: #fcd49e;
  --chat-input-bg: #262626;
  --chat-input-border: #3f3f3f;
  --color-neutral-50: #1a1a1a;
  --color-neutral-100: #262626;
  --color-neutral-200: #333333;
  --color-neutral-300: #444444;
  --color-neutral-400: #666666;
  --color-neutral-500: #888888;
  --color-neutral-700: #cccccc;
  --color-neutral-800: #e5e7eb;
  --color-neutral-900: #f3f3f3;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Global Focus Ring ===== */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: var(--shadow-focus);
}

/* Remove default outline only when focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}

/* ===== Screen Reader Only ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
