/* ═══════════════════════════════════════════════════════════════
   HRIS SaaS Enterprise — Design System
   Modern SaaS dashboard inspired by Linear, Stripe, Notion
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── CSS Custom Properties (Light Theme) ─────────────────── */
:root {
  /* Primary */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  --primary: var(--primary-600);
  --primary-hover: var(--primary-700);
  --primary-light: var(--primary-50);

  /* Neutral / Slate */
  --slate-25: #fcfcfd;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Semantic */
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;
  --success: var(--success-500);

  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;
  --danger: var(--danger-500);

  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning: var(--warning-500);

  --info-50: #eff6ff;
  --info-500: #3b82f6;
  --info: var(--info-500);

  /* Purple accent */
  --purple-50: #faf5ff;
  --purple-500: #a855f7;
  --purple-600: #9333ea;

  /* Surfaces */
  --bg-body: var(--slate-50);
  --bg-surface: #ffffff;
  --bg-surface-hover: var(--slate-50);
  --bg-surface-secondary: var(--slate-100);
  --bg-sidebar: #ffffff;
  --bg-topbar: #ffffff;
  --bg-modal-overlay: rgba(15, 23, 42, 0.6);
  --bg-input: #ffffff;
  --bg-input-hover: var(--slate-50);

  /* Text */
  --text-primary: var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-tertiary: var(--slate-400);
  --text-inverse: #ffffff;
  --text-link: var(--primary-600);

  /* Borders */
  --border-primary: var(--slate-200);
  --border-secondary: var(--slate-100);
  --border-focus: var(--primary-500);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.15);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

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

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

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

  /* Spacing (8px 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 */
  --space-16: 4rem;     /* 64px */

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 56px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-sidebar: 40;
  --z-topbar: 50;
  --z-dropdown: 60;
  --z-modal-backdrop: 70;
  --z-modal: 80;
  --z-toast: 90;
}

/* ── Dark Theme ──────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-body: #0c0f17;
  --bg-surface: #151926;
  --bg-surface-hover: #1a1f30;
  --bg-surface-secondary: #1e2435;
  --bg-sidebar: #111420;
  --bg-topbar: #111420;
  --bg-modal-overlay: rgba(0, 0, 0, 0.7);
  --bg-input: #1a1f30;
  --bg-input-hover: #1e2435;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-inverse: #0f172a;

  --border-primary: #2a3042;
  --border-secondary: #1e2435;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.5);
  --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.3);

  --primary-light: rgba(37, 99, 235, 0.15);

  /* ── Semantic palettes in dark mode ──────────────────────── */
  /* Warning — amber tones adjusted for dark backgrounds */
  --warning-50:  rgba(245, 158, 11, 0.12);
  --warning-100: rgba(245, 158, 11, 0.22);
  --warning-600: #fbbf24;
  --warning-700: #fcd34d;
  --warning-800: #fde68a;

  /* Success — green tones adjusted for dark backgrounds */
  --success-50:  rgba(34, 197, 94, 0.10);
  --success-100: rgba(34, 197, 94, 0.20);
  --success-600: #4ade80;
  --success-700: #86efac;
  --success-800: #bbf7d0;

  /* Danger — red tones adjusted for dark backgrounds */
  --danger-50:  rgba(239, 68, 68, 0.10);
  --danger-100: rgba(239, 68, 68, 0.20);
  --danger-600: #f87171;
  --danger-700: #fca5a5;
  --danger-800: #fecaca;

  /* Primary — blue tones adjusted for dark backgrounds */
  --primary-50:  rgba(59, 130, 246, 0.10);
  --primary-100: rgba(59, 130, 246, 0.20);
  --primary-600: #60a5fa;
  --primary-700: #93c5fd;
  --primary-800: #bfdbfe;
}

/* ── Base Styles ─────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-body);
  overflow: hidden;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

::selection {
  background: var(--primary-200);
  color: var(--primary-900);
}

[data-theme="dark"] ::selection {
  background: rgba(59, 130, 246, 0.4);
  color: #fff;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--slate-700);
}

/* ── Typography Utility ──────────────────────────────────── */
.h1 { font-size: var(--text-4xl); font-weight: var(--font-bold); line-height: var(--leading-tight); letter-spacing: -0.025em; }
.h2 { font-size: var(--text-3xl); font-weight: var(--font-bold); line-height: var(--leading-tight); letter-spacing: -0.02em; }
.h3 { font-size: var(--text-2xl); font-weight: var(--font-semibold); line-height: var(--leading-tight); }
.h4 { font-size: var(--text-xl); font-weight: var(--font-semibold); }
.h5 { font-size: var(--text-lg); font-weight: var(--font-semibold); }
.h6 { font-size: var(--text-base); font-weight: var(--font-semibold); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-mono { font-family: var(--font-mono); }
