/* ============================================================================
   av-auth.css — /login/ and /register/ on the living layer.
   Shared auth shell: .av-auth__wrap (full-page centering) + .av-auth__card
   (the surface card). Both pages use the same shell; register adds its own
   field rules below the shared block when it arrives.
   Built on av-tokens + av-components. Orange is the only accent.
   ========================================================================== */

/* ── Auth page centering wrap ───────────────────────────────────────────── */

.av-auth__wrap {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(64px + var(--av-space-7)) var(--av-space-5) var(--av-space-7);
  /* Subtle radial glow from the top to echo the page-hero atmosphere. */
  background:
    radial-gradient(ellipse at 50% 0%, rgba(252, 114, 19, 0.08) 0%, transparent 60%),
    var(--av-bg);
}

/* ── Auth card (shared shell — login + register both extend this) ─────── */

.av-auth__card {
  width: 100%;
  max-width: 440px;
  background: var(--av-surface);
  border: 1px solid var(--av-border);
  border-top: 2px solid var(--av-orange);
  border-radius: var(--av-radius-lg);
  padding: var(--av-space-7) var(--av-space-6);
  box-shadow: 0 24px 56px -32px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.25s var(--av-ease-out);
}

[data-theme="light"] .av-auth__card {
  box-shadow: 0 8px 32px -12px rgba(0, 0, 0, 0.10);
}

/* ── Card header ─────────────────────────────────────────────────────────── */

.av-auth__header {
  text-align: center;
  margin-bottom: var(--av-space-6);
}

.av-auth__eyebrow {
  display: block;
  font-family: var(--av-font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--av-orange);
  margin-bottom: var(--av-space-2);
}

.av-auth__title {
  font-family: var(--av-font-display);
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--av-text);
  margin: 0;
}

/* ── Alert area (server flash / error injection) ─────────────────────────── */

.av-auth__alerts {
  margin-bottom: var(--av-space-4);
}

/* Legacy alert classes from the alerts mixin — styled on the living palette. */
.av-auth__alerts .alerts { width: 100%; }

.av-auth__alerts .alert {
  padding: var(--av-space-3) var(--av-space-4);
  border-radius: var(--av-radius);
  font-size: 0.9rem;
  margin-bottom: var(--av-space-2);
  border: 1px solid var(--av-border);
  background: var(--av-surface-raise);
  color: var(--av-text);
}

.av-auth__alerts .alert.d-none { display: none; }

.av-auth__alerts .alert-success { border-color: var(--av-live-green); color: var(--av-live-green); }
.av-auth__alerts .alert-warning { border-color: #e6a817; color: #e6a817; }
.av-auth__alerts .alert-danger  { border-color: #e05252; color: #e05252; }

/* ── Form ────────────────────────────────────────────────────────────────── */

.av-auth__form {
  display: flex;
  flex-direction: column;
  gap: var(--av-space-4);
}

/* ── Field (label + input pair — general enough for register's many fields) ── */

.av-auth__field {
  display: flex;
  flex-direction: column;
  gap: var(--av-space-1);
}

.av-auth__label {
  font-family: var(--av-font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--av-text);
}

.av-auth__input {
  appearance: none;
  width: 100%;
  padding: 12px var(--av-space-4);
  background: var(--av-bg);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  font-family: var(--av-font-body);
  font-size: 1rem;
  color: var(--av-text);
  transition: border-color 0.18s var(--av-ease-out), box-shadow 0.18s var(--av-ease-out);
  min-height: 44px;
}

.av-auth__input::placeholder { color: var(--av-text-muted); opacity: 0.7; }

.av-auth__input:focus {
  outline: none;
  border-color: var(--av-orange);
  box-shadow: 0 0 0 3px rgba(252, 114, 19, 0.18);
}

/* ── Form footer row (forgot link + submit) ──────────────────────────────── */

.av-auth__form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--av-space-2);
  gap: var(--av-space-3);
  flex-wrap: wrap;
}

/* ── Secondary links (below card + helper text in register) ──────────────── */

.av-auth__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--av-space-2);
  margin-top: var(--av-space-5);
  padding-top: var(--av-space-5);
  border-top: 1px solid var(--av-border);
}

.av-auth__link-secondary {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--av-text-muted);
  text-decoration: none;
  transition: color 0.15s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.av-auth__link-secondary:hover { color: var(--av-orange); }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .av-auth__card {
    padding: var(--av-space-6) var(--av-space-5);
    border-radius: var(--av-radius);
  }
  .av-auth__form-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .av-auth__form-footer .av-btn { width: 100%; justify-content: center; }
}

/* ── Accessibility: reduced motion ───────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .av-auth__input { transition: none; }
  .av-auth__card  { transition: none; }
}

/* ── Risk disclosure (shared: login + register; parity with prod) ─────────── */

.av-auth__disclosure {
  padding: var(--av-space-7) var(--av-space-5);
  border-top: 1px solid var(--av-border);
}

.av-auth__disclosure-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.av-auth__disclosure-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--av-text-muted);
  margin: 0 0 var(--av-space-3);
}

.av-auth__disclosure-inner p {
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--av-text-muted);
  margin: 0;
}

/*
   REGISTER NOTE: rules below are register-specific additions only.
   Shared shell (.av-auth__wrap / .av-auth__card) is untouched.
*/

/* ── Select (country + region dropdowns) ─────────────────────────────────── */

.av-auth__select,
.av-auth__field select {
  appearance: none;
  width: 100%;
  padding: 12px var(--av-space-4);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23fc7213' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right var(--av-space-4) center,
    var(--av-bg);
  background-size: 12px 8px;
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  font-family: var(--av-font-body);
  font-size: 1rem;
  color: var(--av-text);
  cursor: pointer;
  transition: border-color 0.18s var(--av-ease-out), box-shadow 0.18s var(--av-ease-out);
  min-height: 44px;
}

.av-auth__field select:focus {
  outline: none;
  border-color: var(--av-orange);
  box-shadow: 0 0 0 3px rgba(252, 114, 19, 0.18);
}

/* Region panels: default text input is shown; CAN/USA panels toggled by JS. */
.av-auth__field .region { width: 100%; }
.av-auth__field .region.d-none { display: none; }

/* The region mixin emits Bootstrap .form-floating (label after control) and a
   plain .form-control text input. We don't load Bootstrap, so: (1) lay the panel
   out as a normal label-above-control field, and (2) style the text input to
   match .av-auth__input. The CAN/USA selects are already covered by
   `.av-auth__field select` above. */
.av-auth__field .form-floating {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--av-space-1);
}

.av-auth__field .form-floating > label {
  font-family: var(--av-font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--av-text);
}

.av-auth__field .region input.form-control {
  appearance: none;
  width: 100%;
  padding: 12px var(--av-space-4);
  background: var(--av-bg);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  font-family: var(--av-font-body);
  font-size: 1rem;
  color: var(--av-text);
  min-height: 44px;
  transition: border-color 0.18s var(--av-ease-out), box-shadow 0.18s var(--av-ease-out);
}

.av-auth__field .region input.form-control::placeholder {
  color: var(--av-text-muted);
  opacity: 0.7;
}

.av-auth__field .region input.form-control:focus {
  outline: none;
  border-color: var(--av-orange);
  box-shadow: 0 0 0 3px rgba(252, 114, 19, 0.18);
}

/* ── Checkbox row (.av-auth__check) ─────────────────────────────────────── */

.av-auth__check {
  display: flex;
  align-items: center;
  gap: var(--av-space-3);
}

.av-auth__check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--av-orange);
  cursor: pointer;
}

.av-auth__check label {
  font-size: 0.875rem;
  color: var(--av-text-muted);
  cursor: pointer;
  line-height: 1.4;
}

/* ── Helper text (.av-auth__help) ────────────────────────────────────────── */

.av-auth__help {
  display: block;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--av-text-muted);
  margin-top: var(--av-space-1);
}

/* ── Terms / privacy small print ─────────────────────────────────────────── */

.av-auth__terms {
  font-size: 0.78rem;
  color: var(--av-text-muted);
  text-align: center;
  margin-top: var(--av-space-4);
  line-height: 1.5;
}

.av-auth__terms a {
  color: var(--av-text-muted);
  text-decoration: underline;
}

.av-auth__terms a:hover { color: var(--av-orange); }

/* ── Restriction alert (#disabled) — living palette overrides ─────────────── */

/* The .av-auth__alerts .alert-danger rule above covers flash alerts.
   The #disabled alert sits inside .av-auth__card but outside .av-auth__alerts,
   so it needs its own treatment. Reuse the same danger colour. */

#disabled.alert-danger {
  padding: var(--av-space-3) var(--av-space-4);
  border-radius: var(--av-radius);
  font-size: 0.9rem;
  border: 1px solid #e05252;
  background: var(--av-surface-raise);
  color: #e05252;
}

#disabled.d-none { display: none; }

/* ── Reduced motion: selects ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .av-auth__field select { transition: none; }
}
