/**
 * Shared Theme System
 * CSS custom properties for light and dark modes across all apps.
 * Import this file in each app and include theme.js for toggle functionality.
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color scheme indicator */
  color-scheme: light;

  /* Typography */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Traffic Engineering palette */
  --te-primary: #1a5276;
  --te-primary-light: #2471a3;
  --te-accent: #ff6d00;
  --te-accent-soft: rgba(255, 109, 0, 0.1);

  /* MUTCD Colors */
  --mutcd-yellow: #ffcc00;
  --mutcd-yellow-soft: rgba(255, 204, 0, 0.15);
  --mutcd-white: #ffffff;
  --mutcd-orange: #ff6d00;

  /* FHWA Highway Sign Colors */
  --sign-green: #006b54;
  --sign-green-light: #008566;
  --sign-green-dark: #004d3d;
  --sign-text: #ffffff;
  --sign-border: rgba(255, 255, 255, 0.9);

  /* Lane marking pattern: 10ft stripe, 30ft gap scaled to ~3:9 ratio */
  --lane-dash: 12px;
  --lane-gap: 36px;

  /* Background colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(255, 255, 255, 0.98);
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);

  /* Text colors */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Border colors */
  --border-primary: #e5e7eb;
  --border-secondary: #f3f4f6;
  --border-subtle: rgba(0, 0, 0, 0.06);

  /* Accent colors (consistent across themes) */
  --accent-blue: #2563eb;
  --accent-blue-light: #60a5fa;
  --accent-blue-bg: #dbeafe;
  --accent-blue-bg-end: #bfdbfe;

  --accent-amber: #d97706;
  --accent-amber-light: #fbbf24;
  --accent-amber-bg: #fef3c7;
  --accent-amber-bg-end: #fde68a;

  --accent-green: #059669;
  --accent-green-light: #34d399;
  --accent-green-bg: #d1fae5;
  --accent-green-bg-end: #a7f3d0;

  --accent-purple: #7c3aed;
  --accent-purple-light: #a78bfa;
  --accent-purple-bg: #ede9fe;
  --accent-purple-bg-end: #ddd6fe;

  --accent-red: #dc2626;
  --accent-red-light: #f87171;

  /* Shadow colors */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.06), 0 12px 28px rgba(0, 0, 0, 0.08);
  --shadow-button: 0 4px 14px rgba(37, 99, 235, 0.3);
  --shadow-button-hover: 0 6px 20px rgba(37, 99, 235, 0.4);

  /* Interactive states */
  --hover-bg: #f3f4f6;
  --active-bg: #e5e7eb;

  /* Transition */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode */
:root.dark {
  color-scheme: dark;

  /* Background colors */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-elevated: #1e293b;
  --bg-overlay: rgba(15, 23, 42, 0.98);
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

  /* Text colors */
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Border colors */
  --border-primary: #334155;
  --border-secondary: #1e293b;
  --border-subtle: rgba(255, 255, 255, 0.08);

  /* Accent backgrounds (darker versions) */
  --accent-blue-bg: #1e3a5f;
  --accent-blue-bg-end: #1e40af;

  --accent-amber-bg: #451a03;
  --accent-amber-bg-end: #78350f;

  --accent-green-bg: #064e3b;
  --accent-green-bg-end: #065f46;

  --accent-purple-bg: #2e1065;
  --accent-purple-bg-end: #4c1d95;

  /* Shadow colors (darker, more subtle) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.25);
  --shadow-button: 0 4px 14px rgba(37, 99, 235, 0.4);
  --shadow-button-hover: 0 6px 20px rgba(37, 99, 235, 0.5);

  /* Interactive states */
  --hover-bg: #334155;
  --active-bg: #475569;
}

/* Smooth theme transitions */
:root,
:root.dark {
  transition:
    background-color var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base);
}

/* PWA: Disable pull-to-refresh on mobile */
html, body {
  overscroll-behavior: none;
}
