/* Ward's World CRM - Design System
   Inspired by DataPulse SaaS Analytics Dashboard
   Primary: Dodger Blue | Accents: Green, Purple
   Fonts: DM Sans (body) + Space Grotesk (headings)
*/

:root {
  /* Colors - Light theme (default) */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8fafc;
  --color-bg-tertiary: #f1f5f9;
  --color-bg-hover: #f1f5f9;
  --color-bg-active: #e2e8f0;
  --color-bg-elevated: rgba(255, 255, 255, 0.8);
  --color-bg-surface: #ffffff;

  --color-border: rgba(30, 144, 255, 0.1);
  --color-border-light: rgba(30, 144, 255, 0.06);
  --color-border-subtle: #e2e8f0;
  --color-border-strong: #cbd5e1;

  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-text-dim: #cbd5e1;

  --color-accent: #1e90ff;
  --color-accent-hover: #1a7de6;
  --color-accent-light: rgba(30, 144, 255, 0.08);
  --color-accent-border: rgba(30, 144, 255, 0.15);

  /* Accent colors: green and purple */
  --color-accent-green: #22c55e;
  --color-accent-green-light: rgba(34, 197, 94, 0.08);
  --color-accent-purple: #8B00FF;
  --color-accent-purple-light: rgba(139, 0, 255, 0.08);

  --color-success: #22c55e;
  --color-success-bg: rgba(34, 197, 94, 0.08);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.08);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.08);
  --color-info: #1e90ff;
  --color-info-bg: rgba(30, 144, 255, 0.08);

  /* Badge / chip text colors */
  --color-accent-text: #1a7de6;
  --color-success-text: #16a34a;
  --color-warning-text: #b45309;
  --color-danger-text: #dc2626;
  --color-info-text: #1e90ff;
  --color-neutral-text: var(--color-text-muted);

  /* Aliases for backward compat (billing.css, matter-drawer.css, chat-drawer.css) */
  --color-primary: var(--color-accent);
  --color-primary-bg: var(--color-accent-light);

  /* Typography */
  --font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: var(--font-body);
  --font-mono: 'Fira Code', 'SF Mono', 'Fira Mono', 'Roboto Mono', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Radius - updated to match reference (rounder) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows - blue-tinted (from reference) */
  --shadow-sm: 0 1px 3px rgba(30, 144, 255, 0.06);
  --shadow-md: 0 4px 12px rgba(30, 144, 255, 0.08);
  --shadow-lg: 0 4px 24px rgba(30, 144, 255, 0.08);
  --shadow-xl: 0 12px 40px rgba(30, 144, 255, 0.12);

  /* Sidebar */
  --sidebar-width: 240px;
  --header-height: 56px;
}

/* ── Dark Theme ──────────────────────────── */
[data-theme="dark"] {
  --color-bg-primary: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-bg-tertiary: #334155;
  --color-bg-hover: #1e293b;
  --color-bg-active: #334155;
  --color-bg-elevated: rgba(30, 41, 59, 0.8);
  --color-bg-surface: #1e293b;

  --color-border: rgba(59, 160, 255, 0.15);
  --color-border-light: rgba(59, 160, 255, 0.08);
  --color-border-subtle: #334155;
  --color-border-strong: #475569;

  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-text-dim: #475569;

  --color-accent: #3BA0FF;
  --color-accent-hover: #1e90ff;
  --color-accent-light: rgba(59, 160, 255, 0.12);
  --color-accent-border: rgba(59, 160, 255, 0.2);

  --color-accent-green: #34d399;
  --color-accent-green-light: rgba(52, 211, 153, 0.12);
  --color-accent-purple: #A855F7;
  --color-accent-purple-light: rgba(168, 85, 247, 0.12);

  --color-success: #34d399;
  --color-success-bg: rgba(52, 211, 153, 0.1);
  --color-warning: #fbbf24;
  --color-warning-bg: rgba(251, 191, 36, 0.1);
  --color-danger: #f87171;
  --color-danger-bg: rgba(248, 113, 113, 0.1);
  --color-info: #3BA0FF;
  --color-info-bg: rgba(59, 160, 255, 0.1);

  --color-accent-text: #7cc4ff;
  --color-success-text: #86efac;
  --color-warning-text: #fde047;
  --color-danger-text: #fca5a5;
  --color-info-text: #93c5fd;
  --color-neutral-text: var(--color-text-muted);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Heading typography - use Space Grotesk */
h1, h2, h3, h4, h5, h6,
.heading {
  font-family: var(--font-heading);
}
h1 { font-size: var(--text-3xl); font-weight: 700; line-height: 1.2; }
h2 { font-size: var(--text-2xl); font-weight: 700; line-height: 1.3; }
h3 { font-size: var(--text-xl); font-weight: 600; line-height: 1.4; }
h4 { font-size: var(--text-base); font-weight: 600; line-height: 1.4; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* Dark theme scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--color-border); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--color-text-dim); }

/* Selection */
::selection { background: rgba(30, 144, 255, 0.2); color: #0f172a; }
[data-theme="dark"] ::selection { background: rgba(30, 144, 255, 0.3); color: white; }

/* Utility classes */
.font-mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; }

/* Form select dropdown arrow - light (default) */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
}
