/* =====================================================================
   auth.css — Login page (scope root: .login-page)
   ---------------------------------------------------------------------
   Single source of truth: --o-* tokens (base-tokens.css).
   NO Bootstrap classes, NO hardcoded brand colors.
   Desktop: centered white card.
   Mobile (<=991px): native-app full-bleed form, 44px touch targets.
   ===================================================================== */

.login-page {
  /* red line ②: page root owns its background */
  background: var(--o-bg);
  font-family: var(--o-font-body);
  color: var(--o-ink);
  /* container geometry (red line ③): content-box + standard padding */
  box-sizing: content-box;
  /* height fits content — no full-viewport stretch so no big bottom void */
  min-height: 0;
  display: flex;
  /* top-aligned: avoids the large empty gaps of full vertical centering */
  align-items: flex-start;
  justify-content: center;
  padding: 56px 10px 48px;
}

.login-page__wrap {
  width: 100%;
  max-width: 420px;
}

.login-page__card {
  background: var(--o-card);
  border-radius: var(--o-radius);
  box-shadow: var(--o-shadow);
  padding: 32px 28px 28px;
}

.login-page__title {
  font-family: var(--o-font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--o-ink);
  text-align: center;
  margin: 0 0 22px;
}

.login-page__field {
  margin-bottom: 16px;
}

.login-page__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--o-ink-2);
  margin-bottom: 6px;
}

.login-page__input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-family: var(--o-font-body);
  font-size: 15px;
  color: var(--o-ink);
  background: var(--o-card);
  border: 1px solid var(--o-line);
  border-radius: var(--o-radius-sm);
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-page__input::placeholder {
  color: var(--o-ink-3);
}
.login-page__input:focus {
  outline: none;
  border-color: var(--o-accent);
  box-shadow: 0 0 0 3px var(--o-accent-soft);
}

/* captcha: input + tappable image */
.login-page__captcha {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.login-page__captcha .login-page__input {
  flex: 1 1 auto;
  min-width: 0;
}
.login-page__captcha-img {
  /* restored to pre-refactor behavior: intrinsic width, full code visible */
  flex: 0 0 auto;
  height: 46px;
  width: auto;
  border-radius: var(--o-radius-sm);
  border: 1px solid var(--o-line);
  cursor: pointer;
}

.login-page__error {
  color: var(--o-danger);
  font-size: 13px;
  line-height: 1.4;
  margin: -4px 0 14px;
}

/* remember-me + forgot password */
.login-page__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 22px;
}
.login-page__check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--o-ink-2);
  cursor: pointer;
  user-select: none;
}
.login-page__check .x-check {
  margin: 0;            /* use unified circular .x-check (order-shared.css) */
}
.login-page__link {
  color: var(--o-accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.login-page__link:hover {
  opacity: .82;
}

/* "Forgot password?" is secondary — de-emphasize vs the primary action */
.login-page__row .login-page__link {
  color: var(--o-ink-3);
  font-size: 13px;
  font-weight: 400;
}
.login-page__row .login-page__link:hover {
  color: var(--o-ink-2);
  opacity: 1;
}

/* primary submit — spec §6.2.2 (blue filled, forced shadow, active scale) */
.login-page .x-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: var(--o-radius-sm);
  background: var(--o-accent);
  color: #fff;
  font-family: var(--o-font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(1, 103, 243, .22);
  transition: background-color .15s ease, transform .12s ease;
}
.login-page .x-btn:hover {
  background: #0a5ad6;          /* unified hover target */
}
.login-page .x-btn:active {
  transform: scale(.97);
}

.login-page__foot {
  text-align: center;
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--o-ink-2);
}
.login-page__foot a {
  margin-left: 4px;
}

/* ===================== SHARED AUTH HELPERS (register / forgot / reset) ===================== */
/* subtitle under the title (register intro copy) */
.login-page__subtitle {
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--o-ink-3);
  margin: -12px 0 22px;
}

/* 2-column field pair (e.g. password + confirm) on desktop, stacks on mobile */
.login-page__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 12px;
}
.login-page__grid > .login-page__field {
  margin-bottom: 16px;
}

/* muted helper / instruction block (forgot-password steps) */
.login-page__hint {
  color: var(--o-ink-2);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 20px;
}
.login-page__hint p {
  margin: 0 0 4px;
}

/* success alert (forgot-password session status) */
.login-page__alert {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--o-success);
  border-radius: var(--o-radius-sm);
  background: var(--o-card); /* fallback if color-mix unsupported */
  background: color-mix(in srgb, var(--o-success) 10%, var(--o-card));
  color: var(--o-success);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
}

/* client + server error surfaces (register/reset JS injects .error-info into .error-line) */
.login-page .error-line {
  margin: 0;
}
.login-page .error-info {
  color: var(--o-danger);
  font-size: 13px;
  line-height: 1.4;
  margin: -4px 0 14px;
}

/* terms row: long text, top-aligned, wraps */
.login-page__terms {
  align-items: flex-start;
  margin: 4px 0 22px;
}
.login-page__terms .login-page__check {
  align-items: flex-start;
}
.login-page__terms .login-page__check span {
  line-height: 1.45;
}

/* ===================== MOBILE (<=991px): card on page tint ===================== */
@media (max-width: 991px) {
  .login-page {
    /* height fits content — no full-screen stretch, avoids big bottom void */
    min-height: 0;
    /* safe-area aware, modest top spacing (no huge voids) */
    padding: 28px 14px 36px;
    padding-top: calc(28px + env(safe-area-inset-top));
    padding-bottom: calc(36px + env(safe-area-inset-bottom));
  }
  .login-page__wrap {
    max-width: 100%;
  }
  /* restore the card surface so it reads as a self-contained panel */
  .login-page__card {
    background: var(--o-card);
    box-shadow: var(--o-shadow);
    border-radius: var(--o-radius);
    padding: 24px 18px 22px;
  }
  .login-page__title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 22px;
  }
  .login-page__field {
    margin-bottom: 16px;
  }
  /* 44px touch + 16px font prevents iOS auto-zoom */
  .login-page__input {
    height: var(--o-touch);
    font-size: 16px;
  }
  .login-page__captcha-img {
    height: var(--o-touch);
  }
  .login-page .x-btn {
    height: 50px;
    font-size: 16px;
  }
  .login-page__grid {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
  .login-page__subtitle {
    font-size: 13px;
  }
  .login-page__hint {
    font-size: 13px;
  }
  .login-page__alert {
    padding: 11px 12px;
  }
}

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .login-page .x-btn {
    transition: none;
  }
  .login-page .x-btn:active {
    transform: none;
  }
}
