/* =====================================================================================
 * auth.css: login / signup / confirm screens (cycle 62, design_spec sections 1..8).
 *
 * Consumes the SHARED chat.css design tokens via var(); it does NOT redeclare the token
 * block and introduces NO new token (AC-D1). Every color is var(--...) (zero hex), every
 * font-size is var(--text-*) (zero literal), spacing is var(--space-*) on the 4px grid (the
 * only literal lengths are 1px borders, 2px focus ring offset, and the 400px card width).
 * The global focus ring + reduced-motion block live in chat.css (also linked); auth.css adds
 * its own reduced-motion block (AC-D5) and keeps the focus ring visible (no bare outline reset).
 *
 * Single innerHTML-sink invariant (AC-S10): there is NO JS here. All dynamic text (error / note
 * banners, email prefill) is server-rendered through Jinja2 autoescape; auth.css only styles it.
 * ===================================================================================== */

/* Page shell: full-viewport warm background, card centered (mobile-first: top offset). */
.auth-main {
  box-sizing: border-box;
  min-height: 100vh;
  margin: 0;
  padding: var(--space-7) var(--space-4) var(--space-6);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

@media (min-width: 480px) {
  .auth-main {
    display: grid;
    place-items: center;
    padding: var(--space-6) var(--space-4);
  }
}

/* The single auth card. */
.auth-card {
  box-sizing: border-box;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  animation: auth-card-in var(--dur-base) var(--ease-out);
}

/* Brand mark + product name (visual brand, not a heading - avoids an h1 duplicate). */
.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.auth-brand-mark {
  width: var(--space-5);
  height: var(--space-5);
  background: var(--accent);
  border-radius: var(--radius-md);
}

.auth-brand-text {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Title + subtitle hierarchy (size / weight / color, not all-same-size). */
.auth-title {
  margin: 0;
  color: var(--text);
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  font-weight: 700;
}

.auth-subtitle {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Error banner - color + icon + text (never color alone), accent-soft surface. */
.auth-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-5) 0 0;
  padding: var(--space-3) var(--space-4);
  background: var(--accent-soft);
  color: var(--danger);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.auth-error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-5);
  height: var(--space-5);
  background: var(--danger);
  color: var(--accent-text);
  border-radius: var(--radius-full);
  font-weight: 700;
}

/* Info / success note (next-action guidance, not blame). */
.auth-note {
  margin: var(--space-5) 0 0;
  padding: var(--space-3) var(--space-4);
  color: var(--success);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

/* Form - single column, vertical rhythm via tokens. */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.auth-label {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Field hint - static help text under an input (muted, smaller than the label). */
.auth-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.auth-input {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--space-7);
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.auth-input:hover {
  border-color: var(--accent);
}

.auth-input:focus-visible {
  /* Inherit the global focus ring (chat.css); reinforce the field border. Ring stays visible. */
  border-color: var(--accent);
}

.auth-input[aria-invalid="true"] {
  border-color: var(--danger);
}

.auth-input:disabled {
  opacity: 0.55;
  background: var(--bg);
  cursor: not-allowed;
}

/* Primary button - exactly one per screen (.auth-submit). */
.auth-submit {
  width: 100%;
  min-height: var(--space-7);
  margin-top: var(--space-5);
  padding: var(--space-3) var(--space-5);
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.auth-submit:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.auth-submit:active {
  background: var(--accent-active);
  border-color: var(--accent-active);
}

.auth-submit:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  border-color: var(--disabled-bg);
  cursor: not-allowed;
}

/* Resend form (confirm) - secondary, neutral. */
.auth-resend-form {
  margin-top: var(--space-3);
}

.auth-secondary-btn {
  width: 100%;
  min-height: var(--space-7);
  padding: var(--space-3) var(--space-5);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.auth-secondary-btn:hover {
  border-color: var(--accent);
}

/* Alt-screen link (login <-> signup <-> confirm). */
.auth-alt {
  margin: var(--space-4) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: center;
}

.auth-alt-link {
  color: var(--accent-ink);
  text-decoration: underline;
}

.auth-alt-link:hover {
  color: var(--accent-active);
}

/* Card entrance - transform/opacity only (no layout shift). */
@keyframes auth-card-in {
  from {
    opacity: 0;
    transform: translateY(var(--space-2));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reduced-motion path (AC-D5) - mirrors the chat.css global block for this stylesheet. */
@media (prefers-reduced-motion: reduce) {
  .auth-card {
    animation: none;
  }

  .auth-input,
  .auth-submit,
  .auth-secondary-btn {
    transition-duration: 0.01ms;
  }
}
