/* ============================================
   account/auth.css: the shared frame of the Account and Manage pages
   (sign in, register, password reset, verification, settings, lockout).

   <main class="auth-page" aria-labelledby="auth-title">
     <section class="auth-card [auth-card--wide]">
       <header class="auth-head">
         <h1 class="auth-title" id="auth-title">Welcome back</h1>
         <p class="auth-lead">One friendly line.</p>
       </header>
       <form class="auth-form"> .bl-field rows, .auth-actions </form>
     </section>
     <p class="auth-alt">Don't have an account? <a href="…">Create one</a></p>
   </main>

   Fields use the shared primitives (.bl-field, .bl-input, .bl-checkbox, .bl-btn); this file
   only lays them out. Phone first: a full-width card; from 576px a centred ~440px card.
   ============================================ */

.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-6) var(--gutter) var(--space-12);
  background-color: var(--color-surface-muted);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: var(--space-6) var(--space-5);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-1);
}

.auth-card--wide {
  max-width: 560px;
}

/* --- Heading --- */
.auth-head {
  margin-bottom: var(--space-6);
}

.auth-head--center {
  text-align: center;
}

.auth-title {
  margin: 0;
  color: var(--color-ink);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-lead {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1.5;
}

/* A round icon above the heading (verification, lockout, confirmations). */
.auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background-color: var(--green-50);
  color: var(--green-700);
  font-size: 22px;
}

.auth-icon--danger {
  background-color: var(--color-surface-muted);
  color: var(--color-danger);
}

/* --- Form stack --- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
}

.auth-section + .auth-section {
  margin-top: var(--space-2);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border-light);
}

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

.auth-section__title {
  margin: 0;
  color: var(--color-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

/* Two fields side by side (first + last name) from 576px. */
.auth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.auth-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.auth-text {
  margin: 0;
  color: var(--color-text-body);
  font-size: 16px;
  line-height: 1.55;
}

.auth-text--small {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Links inside the page (not the .bl-btn ones): the green that clears 4.5:1 on white. */
.auth-page a:not(.bl-btn):not(.settings-item) {
  color: var(--green-700);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .auth-page a:not(.bl-btn):not(.settings-item):hover {
    color: var(--green-800);
  }
}

.auth-page a:not(.bl-btn):not(.settings-item):focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* "Don't have an account? Create one" under the card. */
.auth-alt {
  margin: 0;
  color: var(--color-text-body);
  font-size: 15px;
  text-align: center;
}

/* --- Alerts: the validation summary and status lines --- */
.auth-alert {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  color: var(--color-danger);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
  .auth-alert {
    border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-surface));
    background-color: color-mix(in srgb, var(--color-danger) 6%, var(--color-surface));
  }
}

.auth-alert ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-alert li + li {
  margin-top: var(--space-1);
}

/* asp-validation-summary renders an empty list with this class until there are errors. */
.auth-alert.validation-summary-valid,
.auth-alert:empty {
  display: none;
}

.auth-alert--info {
  border-color: var(--green-200);
  background-color: var(--green-50);
  color: var(--green-800);
}

/* --- "or" divider between Google and the email form --- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--color-border-light);
}

.auth-external {
  margin: 0;
}

/* Google's own four-colour "G" (img/brand/google-g.svg, from its sign-in branding), never recoloured. */
.auth-google__logo {
  flex: none;
  width: 18px;
  height: 18px;
}

.auth-alert .auth-google__logo {
  vertical-align: -3px;
  margin-right: var(--space-1);
}

/* A read-only field (the Google email) reads as settled, not editable. */
.auth-page .bl-input[readonly]:not(.role-dob) {
  background-color: var(--color-surface-muted);
  color: var(--color-text-body);
}

/* --- Password with a show / hide button inside the field --- */
.auth-password {
  position: relative;
}

.auth-password .bl-input {
  padding-right: 52px;
}

.auth-password__toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .auth-password__toggle:hover {
    color: var(--color-ink);
  }
}

.auth-password__toggle:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

/* --- One-time code --- */
.auth-code {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
  text-align: center;
}

.auth-code::placeholder {
  font-weight: 400;
  letter-spacing: 0.1em;
  opacity: 0.6;
}

.auth-code:focus::placeholder {
  opacity: 0;
}

/* --- intl-tel-input (Register, Complete registration) --- */
.auth-page .iti {
  display: block;
  width: 100%;
}

.auth-page .iti__selected-flag {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.auth-page .iti__country-list {
  z-index: var(--z-popover);
  max-width: calc(100vw - 2 * var(--gutter));
  white-space: normal;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}

/* --- Settings list (Account/Settings) --- */
.settings-group + .settings-group {
  margin-top: var(--space-6);
}

.settings-group__title {
  margin: 0 0 var(--space-2);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.settings-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-list > li + li {
  border-top: 1px solid var(--color-border-light);
}

.settings-list form {
  margin: 0;
}

.auth-page .settings-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 0;
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .auth-page .settings-item:hover {
    background-color: var(--color-surface-muted);
    color: var(--color-ink);
  }
}

.auth-page .settings-item:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}

.settings-item__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--green-50);
  color: var(--green-700);
  font-size: 15px;
}

.settings-item__label {
  flex: 1;
  min-width: 0;
}

.settings-item__chevron {
  flex: none;
  color: var(--color-text-light);
  font-size: 13px;
}

.auth-page .settings-item--static {
  cursor: default;
}

.auth-page .settings-item--danger {
  color: var(--color-danger);
}

.settings-item--danger .settings-item__icon {
  background-color: var(--color-surface-muted);
  color: var(--color-danger);
}

/* --- Contact details on Settings: a detail over its value, then Verified or Verify --- */
.settings-contact .settings-item__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-contact__name {
  color: var(--color-ink);
  font-weight: 600;
}

.settings-contact__value {
  overflow-wrap: anywhere;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 400;
}

.settings-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background-color: var(--green-50);
  color: var(--green-800);
  font-size: 13px;
  font-weight: 600;
}

.settings-contact .bl-btn {
  flex: none;
}

.auth-destination {
  overflow-wrap: anywhere;
  color: var(--color-ink);
}

.settings-note {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.45;
}

/* --- Code pages: Resend (and, at sign-up, Skip for now) once the wait is over ---
   The Resend button sits right under the green one and counts the wait down in its own label
   (js/account/code-timer.js: disabled, "Resend code in 0:17"); "Skip for now" is a quiet link
   with its note, hidden as a whole until then. Without script both are on and the server says
   when it's too early. */
.auth-resend {
  margin: var(--space-3) 0 0;
}

.auth-resend .bl-btn {
  font-variant-numeric: tabular-nums;
}

[data-code-timer][hidden] {
  display: none;
}

.auth-link-btn {
  min-height: 44px;
  padding: var(--space-2) var(--space-1);
  border: 0;
  background: none;
  color: var(--green-700);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-link-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.auth-skip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-5);
}

.auth-skip form {
  margin: 0;
}

.auth-skip p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

/* --- Larger screens --- */
@media (min-width: 576px) {
  .auth-page {
    padding-top: var(--space-12);
    padding-bottom: var(--space-16);
  }

  .auth-card {
    padding: var(--space-8);
  }

  .auth-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-password__toggle,
  .auth-page .settings-item {
    transition: none;
  }
}
