/**
 * auth.css — styles shared by login.html and register.html.
 *
 * Pages reuse the global Brandzyla design tokens (brand palette, Monainn
 * font, shadow-card / shadow-soft) via Tailwind classes. Only the few rules
 * that are awkward or verbose to express as utilities live here, so the
 * cards stay visually consistent with the rest of the site.
 */

/* ============================================================ */
/* Auth form container                                           */
/* ============================================================ */
.auth-card {
  width: 100%;
  max-width: 28rem; /* 448px — comfortable single-column form */
}

/* ============================================================ */
/* Form inputs                                                   */
/* ============================================================ */
.auth-input {
  width: 100%;
  border-radius: 0.75rem; /* matches rounded-xl used across the site */
  border: 1px solid #e5e7eb; /* gray-200 */
  background-color: #f9fafb; /* gray-50 */
  padding: 0.7rem 0.95rem;
  font-size: 0.95rem;
  color: #111827; /* gray-900 */
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.auth-input::placeholder {
  color: #9ca3af; /* gray-400 */
}

.auth-input:focus {
  outline: none;
  border-color: #ea4325; /* brand */
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(234, 67, 37, 0.15);
}

/* Invalid state — toggled from JS by adding .is-invalid */
.auth-input.is-invalid {
  border-color: #ef4444; /* red-500 */
  background-color: #fef2f2; /* red-50 */
}

.auth-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Dark mode overrides — keep parity with the global dark-mode rules in base.css */
html.dark .auth-input {
  background-color: #1e2637 !important;
  border-color: #242f41 !important;
  color: #ffffff !important;
}
html.dark .auth-input::placeholder {
  color: #6b7280 !important;
}
html.dark .auth-input:focus {
  background-color: #181d29 !important;
}
html.dark .auth-input.is-invalid {
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.1) !important;
}

/* ============================================================ */
/* Inline field error text                                       */
/* ============================================================ */
.field-error {
  display: none;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: #ef4444; /* red-500 */
}
.field-error.is-visible {
  display: block;
}

/* ============================================================ */
/* Alert banner (success / error summary)                        */
/* ============================================================ */
.auth-alert {
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}
.auth-alert.is-visible {
  display: flex;
}
.auth-alert--error {
  background-color: #fef2f2; /* red-50 */
  color: #b91c1c; /* red-700 */
  border: 1px solid #fecaca; /* red-200 */
}
.auth-alert--success {
  background-color: #f0fdf4; /* green-50 */
  color: #15803d; /* green-700 */
  border: 1px solid #bbf7d0; /* green-200 */
}
html.dark .auth-alert--error {
  background-color: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
html.dark .auth-alert--success {
  background-color: rgba(34, 197, 94, 0.12) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.35) !important;
}

/* ============================================================ */
/* Submit button loading state                                   */
/* ============================================================ */
.auth-submit {
  position: relative;
}
.auth-submit[disabled] {
  cursor: not-allowed;
  opacity: 0.75;
}
.auth-submit .spinner {
  display: none;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
}
.auth-submit.is-loading .spinner {
  display: inline-block;
}
.auth-submit.is-loading .label {
  opacity: 0.7;
}

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

/* Custom checkbox accent on brand colour */
.auth-checkbox {
  accent-color: #ea4325; /* brand */
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* Password visibility toggle button */
.auth-toggle {
  position: absolute;
  inset-block: 0;
  right: 0.6rem;
  display: flex;
  align-items: center;
  color: #9ca3af; /* gray-400 */
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: color 0.15s ease;
}
.auth-toggle:hover {
  color: #ea4325; /* brand */
}
.auth-toggle:focus-visible {
  outline: 2px solid #ea4325;
  outline-offset: 2px;
}
html.dark .auth-toggle {
  color: #9ca3af !important;
}
