/* Jouly-owned IAP auth UI — a standalone bundle that CANNOT import the Next.js
   frontend's globals.css or components/ui. Token VALUES are copied here as
   literals; keep each in sync with the matching token in
   frontend/app/globals.css. The frontend token-lint does not run on infra/, so
   raw hex is acceptable here as long as these sync comments stay accurate. */

:root {
  --background: #f8fafc; /* keep in sync with globals.css --background */
  --foreground: #0f172a; /* keep in sync with globals.css --foreground */
  --card: #ffffff; /* keep in sync with globals.css --card */
  --card-foreground: #0f172a; /* keep in sync with globals.css --card-foreground */
  --primary: #0ca32e; /* keep in sync with globals.css --primary */
  --primary-foreground: #ffffff; /* keep in sync with globals.css --primary-foreground */
  --primary-hover: #097623; /* keep in sync with globals.css --primary-hover */
  --muted-foreground: #64748b; /* keep in sync with globals.css --muted-foreground */
  --border: #e2e8f0; /* keep in sync with globals.css --border */
  --input: #e2e8f0; /* keep in sync with globals.css --input */
  --ring: #0ca32e; /* keep in sync with globals.css --ring */
  --destructive: #dc2626; /* keep in sync with globals.css --destructive */
  --radius: 0.5rem; /* keep in sync with globals.css --radius */
  --font-heading: "Plus Jakarta Sans", system-ui, sans-serif; /* keep in sync with globals.css --font-heading */
  --font-body: "IBM Plex Sans", system-ui, sans-serif; /* keep in sync with globals.css --font-body */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

.page {
  display: flex;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.card {
  display: flex;
  width: 100%;
  max-width: 24rem;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  /* Cool slate-tinted elevation (globals.css --foreground #0f172a at low alpha). */
  box-shadow:
    0 1px 3px 0 rgb(15 23 42 / 0.08),
    0 1px 2px -1px rgb(15 23 42 / 0.08);
}

.brand {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--primary);
}

.heading {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
}

.description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.label {
  font-size: 0.875rem;
  font-weight: 500;
}

.input {
  height: 2.25rem;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--foreground);
  background-color: var(--card);
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  outline: none;
}

.input:focus-visible {
  border-color: var(--ring);
  /* --ring (#0ca32e = rgb(12 163 46)) at 35% — keep hue in sync with globals.css --ring. */
  box-shadow: 0 0 0 3px rgb(12 163 46 / 0.35);
}

.button {
  height: 2.25rem;
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary-foreground);
  background-color: var(--primary);
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.2, 0, 0, 1);
}

.button:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.button:focus-visible {
  outline: none;
  /* --ring at 35% — keep hue in sync with globals.css --ring. */
  box-shadow: 0 0 0 3px rgb(12 163 46 / 0.35);
}

.button:disabled {
  opacity: 0.7;
  cursor: default;
}

/* Secondary action (switch between password and email-link, go back): outline
   button matching the app's ghost/secondary variant. Full-width for an
   adequate touch target on narrow screens. */
.button-secondary {
  height: 2.25rem;
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.2, 0, 0, 1);
}

.button-secondary:hover {
  background-color: var(--background);
}

.button-secondary:focus-visible {
  outline: none;
  /* --ring at 35% — keep hue in sync with globals.css --ring. */
  box-shadow: 0 0 0 3px rgb(12 163 46 / 0.35);
}

.error {
  margin: 0;
  font-size: 0.875rem;
  color: var(--destructive);
}

.fallback-link {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  color: var(--primary);
}

.progress-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* --background (#f8fafc = rgb(248 250 252)) at 70% — keep hue in sync. */
  background-color: rgb(248 250 252 / 0.7);
}

/* `display: flex` above beats the UA `[hidden] { display: none }` rule, so
   without this hideProgress() (which sets the hidden attribute) could never hide
   the overlay and the spinner stayed layered over the form. Higher specificity
   restores the hide. */
.progress-overlay[hidden] {
  display: none;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.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;
}
