@import 'tailwindcss';

@theme {
  --color-brand: #1d4ed8;
  --color-brand-dark: #1e3a8a;

  --color-ok: #15803d;
  --color-warn: #b45309;
  --color-danger: #b91c1c;
}

/*
  The default border color has changed to `currentcolor` in Tailwind CSS v4,
  so we've added these compatibility styles to make sure everything still
  looks the same as it did with Tailwind CSS v3.

  If we ever want to remove these styles, we need to add an explicit border
  color utility to any element that depends on these defaults.
*/
@layer base {
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-gray-200, currentcolor);
  }
}

@utility btn {
  @apply inline-flex items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium
           focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50;
}

@utility btn-primary {
  @apply btn bg-brand text-white hover:bg-brand-dark;
}

@utility btn-secondary {
  @apply btn border border-slate-300 bg-white text-slate-800 hover:bg-slate-100;
}

@utility btn-danger {
  @apply btn border border-red-300 bg-white text-danger hover:bg-red-50;
}

@utility card {
  @apply rounded-lg border border-slate-200 bg-white p-5 shadow-xs;
}

@utility label {
  @apply block text-sm font-medium text-slate-700;
}

@utility input {
  @apply mt-1 block w-full rounded-md border border-slate-300 px-3 py-2 text-sm
           focus:border-brand focus:ring-brand;
}

@utility field-error {
  @apply mt-1 text-sm text-danger;
}

@utility badge {
  @apply inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium;
}

@layer utilities {
  :root {
    color-scheme: light;
  }

  body {
    @apply bg-slate-50 text-slate-900 antialiased;
  }

  /* Visible focus ring for keyboard users (WCAG 2.2 AA — focus visible). */
  :focus-visible {
    outline: 3px solid #1d4ed8;
    outline-offset: 2px;
  }
}

/* Screen-reader-only utility */
.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;
}
