/* ═══════════════════════════════════════════════════════════
   ISAAC Recovery CRM — GLOBAL RESET & BASE STYLES
   Modern CSS Reset + Base Typography
   ═══════════════════════════════════════════════════════════ */

/* ─── Modern CSS Reset ──────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background: var(--bg-secondary);
  min-height: 100vh;
}

/* ─── Typography Reset ──────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  margin-bottom: var(--space-4);
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-brand-dark);
}

a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Form Elements Reset ───────────────────────────────── */

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

button:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

/* ─── List Reset ────────────────────────────────────────── */

ul, ol {
  list-style: none;
}

/* ─── Image Reset ───────────────────────────────────────── */

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ─── Table Reset ───────────────────────────────────────── */

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ─── Accessibility ─────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-brand);
  color: var(--color-black);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: var(--z-tooltip);
}

.skip-to-content:focus {
  top: var(--space-2);
  left: var(--space-2);
}

/* ─── Focus Visible Polyfill ────────────────────────────── */

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ─── Selection ─────────────────────────────────────────── */

::selection {
  background: var(--color-brand-light);
  color: var(--color-brand-darker);
}

/* ─── Scrollbar Styling ─────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

/* ─── Print Styles ──────────────────────────────────────── */

@media print {
  body {
    background: white;
    color: black;
  }
  
  a {
    text-decoration: underline;
  }
  
  button, .irc-btn {
    display: none;
  }
  
  .no-print {
    display: none !important;
  }
}

/* ─── 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;
  }
}

/* ─── High Contrast Mode ────────────────────────────────── */

@media (prefers-contrast: high) {
  :root {
    --border-primary: var(--color-gray-900);
    --text-secondary: var(--color-gray-900);
  }
}

/* ─── Mobile Safe Areas ─────────────────────────────────── */

@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}
