/* ==========================================================================
   Udeyou OTP: auth pages
   login, login-verify (2FA), register, login-otp, forgot-password, reset-password.
   Split layout: form card + dark brand panel (views/partials/auth-aside.php).
   Builds on the tokens and form components in style.css; light and dark themes.
   Every rule is scoped under .auth-page so it wins over any older auth rules.
   ========================================================================== */

/* ---------- Page and shell ---------- */
.auth-page {
  position: relative; isolation: isolate;
  padding: 48px var(--gutter) 88px;
  background:
    radial-gradient(760px 420px at 88% -12%, rgba(51, 88, 255, .10), transparent 62%),
    radial-gradient(640px 380px at 4% 108%, rgba(34, 199, 232, .09), transparent 62%),
    var(--bg);
}
[data-theme="dark"] .auth-page {
  background:
    radial-gradient(760px 420px at 88% -12%, rgba(51, 88, 255, .16), transparent 62%),
    radial-gradient(640px 380px at 4% 108%, rgba(34, 199, 232, .08), transparent 62%),
    var(--bg);
}
.auth-page .auth-shell {
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
  max-width: 1120px; min-height: 680px; margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-xl);
  box-shadow: 0 1px 2px rgba(10, 16, 48, .04), 0 30px 70px -30px rgba(10, 16, 48, .28);
  overflow: hidden;
}
[data-theme="dark"] .auth-page .auth-shell {
  border-color: rgba(255, 255, 255, .09);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 40px 80px -30px rgba(0, 0, 0, .8);
}

/* ---------- Form side ---------- */
.auth-page .auth-main { order: 0; display: flex; align-items: center; justify-content: center; padding: 56px 56px 48px; }
.auth-page .auth-form { width: 100%; max-width: 408px; }
.auth-page .auth-head { margin-bottom: 26px; }
.auth-page .auth-head .icon-tile { margin-bottom: 20px; }
.auth-page .auth-head h1 { font-size: 30px; line-height: 1.3; letter-spacing: -.005em; }
.auth-page .auth-head p { margin-top: 8px; font-size: 15.5px; line-height: 1.85; color: var(--muted); }

.auth-page .alert { margin-bottom: 20px; }
.auth-page .auth-fields > label,
.auth-page .auth-fields .field { margin-bottom: 18px; }
.auth-page .field > label { margin-bottom: 0; }
.auth-page .field-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.auth-page .field-top label { margin: 0; }
.auth-page .field-top a { font-size: 13.5px; font-weight: 500; }
.auth-page .auth-fields .btn { margin-top: 6px; }
.auth-page .auth-fields .check-row { margin-bottom: 18px; }

/* Password inputs are dir="ltr": keep typed text clear of the eye button (left side in RTL) */
.auth-page .pw-wrap input[dir="ltr"] { padding-left: 50px; padding-right: 14px; }

/* Short explanatory line under a submit button */
.auth-page .auth-note {
  margin-top: 12px;
  font-size: 13px; line-height: 1.75; color: var(--muted);
}
.auth-page .auth-note .ic-inline { margin-inline-end: 6px; }
.auth-page .auth-note.center { text-align: center; }

/* Secondary action buttons (login with a code, resend) */
.auth-page .btn-alt { min-height: 48px; border-radius: 12px; }
.auth-page .btn-alt svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--brand); }
[data-theme="dark"] .auth-page .btn-alt svg { color: var(--brand-300); }
.auth-page button.btn-alt { width: 100%; cursor: pointer; font-family: var(--font-sans); }
.auth-page .auth-form form { margin: 0; }

.auth-page .auth-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0; font-size: 13px; font-weight: 500; color: var(--subtle);
}
.auth-page .auth-divider::before,
.auth-page .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-page .auth-foot {
  margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: 14.5px; color: var(--muted); text-align: center;
}
.auth-page .auth-foot a { font-weight: 600; }
.auth-page .auth-foot .sep { display: inline-block; width: 1px; height: 12px; margin-inline: 12px; vertical-align: middle; background: var(--line-strong); }

/* Large one-time code input (overrides the core size) */
.auth-page .code-input {
  height: auto; min-height: 66px; padding-block: 0; text-indent: 0;
  font-size: 30px !important; letter-spacing: .48em;
  padding-inline: calc(14px + .48em) 14px;
  font-variant-numeric: tabular-nums;
}
.auth-page .code-input::placeholder { color: #C5CCDD; letter-spacing: .48em; opacity: 1; }
.auth-page .code-input:focus { background: var(--surface); }
[data-theme="dark"] .auth-page .code-input { background: var(--input-bg); }
[data-theme="dark"] .auth-page .code-input::placeholder { color: rgba(201, 212, 245, .24); }

/* Account chip (the e-mail the code was sent to) */
.auth-page .auth-account {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.auth-page .auth-account .icon-tile { width: 36px; height: 36px; margin: 0; }
.auth-page .auth-account .icon-tile svg { width: 18px; height: 18px; }
.auth-page .auth-account > div { flex: 1; min-width: 0; line-height: 1.45; }
.auth-page .auth-account small { display: block; font-size: 12px; color: var(--muted); }
.auth-page .auth-account b {
  /* show the whole address (it is what the person checks); long ones wrap */
  display: block; overflow-wrap: anywhere; white-space: normal;
  font-size: 14.5px; font-weight: 600; text-align: right; color: var(--heading);
}
.auth-page .auth-account a { flex-shrink: 0; font-size: 13.5px; font-weight: 600; }
[data-theme="dark"] .auth-page .auth-account { background: var(--surface-3); }

/* "Got the code?" next step box (forgot-password) */
.auth-page .auth-next {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 18px; padding: 16px 18px;
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 14px;
}
.auth-page .auth-next b { display: block; font-size: 15px; color: var(--heading); }
.auth-page .auth-next span { display: block; font-size: 13.5px; color: var(--muted); }
.auth-page .auth-next .btn { flex-shrink: 0; margin: 0; }

/* ---------- Brand panel ---------- */
.auth-page .auth-aside {
  order: 0; position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column;
  padding: 44px 48px;
  color: var(--on-dark-muted);
  background:
    radial-gradient(520px 400px at 40% 52%, rgba(51, 88, 255, .30), transparent 66%),
    radial-gradient(420px 320px at 100% 100%, rgba(34, 199, 232, .14), transparent 66%),
    radial-gradient(360px 260px at 0% 0%, rgba(51, 88, 255, .16), transparent 70%),
    linear-gradient(180deg, var(--ink-900) 0%, var(--ink-950) 100%);
}
[data-theme="dark"] .auth-page .auth-aside {
  border-inline-start: 1px solid rgba(255, 255, 255, .07);
  background:
    radial-gradient(520px 400px at 40% 52%, rgba(51, 88, 255, .26), transparent 66%),
    radial-gradient(420px 320px at 100% 100%, rgba(34, 199, 232, .12), transparent 66%),
    radial-gradient(360px 260px at 0% 0%, rgba(51, 88, 255, .14), transparent 70%),
    linear-gradient(180deg, var(--ink-800) 0%, var(--ink-950) 100%);
}
.auth-page .auth-aside::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 45%, #000 20%, transparent 75%);
}
.auth-page .auth-aside::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 149, 255, .55), rgba(34, 199, 232, .4), transparent);
}
.auth-page .auth-aside-top { display: block; }
.auth-page .auth-brand { display: flex; align-items: center; gap: 10px; width: fit-content; color: #fff; font-weight: 700; }
.auth-page .auth-brand:hover { color: #fff; text-decoration: none; }
.auth-page .auth-brand img { display: block; width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 8px 22px -8px rgba(51, 88, 255, .95); }
.auth-page .auth-brand .brand-tag { color: #A9BBFF; background: rgba(51, 88, 255, .16); border-color: rgba(143, 168, 255, .22); }
.auth-page .auth-aside :focus-visible { outline-color: var(--cyan); }
.auth-page .auth-aside-kicker {
  display: flex; align-items: center; gap: 10px;
  margin-top: 40px; font-size: 14px; font-weight: 600; color: var(--brand-300);
}
.auth-page .auth-aside-kicker::before { content: ""; width: 20px; height: 2px; border-radius: 2px; background: var(--grad); }
.auth-page .auth-aside-title {
  margin-top: 10px; max-width: 420px;
  font-size: 26px; line-height: 1.5; font-weight: 700; color: #fff; text-wrap: balance;
}
.auth-page .auth-aside-title span {
  display: block;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.auth-page .auth-aside-art {
  flex: 1 0 auto; display: grid; place-items: center;
  margin: 4px -16px 8px;
}
.auth-page .auth-aside-art img {
  /* the art has empty glow margins top and bottom: overlap them instead of cropping */
  display: block; width: 320px; max-width: 100%; height: auto;
  margin: -34px 0 -44px;
}
.auth-page .auth-points {
  list-style: none; margin: 0; padding: 22px 0 0;
  display: grid; gap: 14px;
  border-top: 1px solid var(--on-dark-line);
}
.auth-page .auth-points li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; line-height: 1.7; color: rgba(222, 229, 255, .86); }
.auth-page .auth-points .icon-tile { width: 34px; height: 34px; border-radius: 9px; }
.auth-page .auth-points .icon-tile svg { width: 18px; height: 18px; }
.auth-page .auth-aside:not(.has-art) .auth-points { margin-top: auto; }
.auth-page .auth-aside:not(.has-art) .auth-aside-top { margin-bottom: 40px; }

@media (prefers-reduced-motion: no-preference) {
  .auth-page .auth-form { animation: udy-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .auth-page .auth-main { padding: 48px 40px 40px; }
  .auth-page .auth-aside { padding: 40px 36px; }
  .auth-page .auth-aside-title { font-size: 23px; }
}

/*
 * Narrow screens: one column. The brand panel is split with display: contents:
 * its top (logo + headline) becomes a compact dark strip above the form, and the
 * three facts move under the form as a light list, so nothing is lost on mobile.
 */
@media (max-width: 880px) {
  .auth-page { padding: 32px var(--gutter) 64px; }
  .auth-page .auth-shell { grid-template-columns: minmax(0, 1fr); max-width: 560px; min-height: 0; }
  .auth-page .auth-aside,
  [data-theme="dark"] .auth-page .auth-aside { display: contents; }
  .auth-page .auth-aside-kicker,
  .auth-page .auth-aside-art,
  .auth-page .auth-brand .brand-name,
  .auth-page .auth-brand .brand-tag { display: none; }

  .auth-page .auth-aside-top {
    order: -1; position: relative; isolation: isolate; overflow: hidden;
    display: flex; align-items: center; gap: 16px;
    margin: 0; padding: 20px 28px;
    background:
      radial-gradient(320px 180px at 15% 0%, rgba(51, 88, 255, .34), transparent 70%),
      radial-gradient(260px 160px at 100% 100%, rgba(34, 199, 232, .16), transparent 70%),
      linear-gradient(180deg, var(--ink-900) 0%, var(--ink-950) 100%);
  }
  .auth-page .auth-aside-top::after {
    content: ""; position: absolute; inset: auto 0 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124, 149, 255, .5), rgba(34, 199, 232, .35), transparent);
  }
  .auth-page .auth-aside:not(.has-art) .auth-aside-top { margin-bottom: 0; }
  .auth-page .auth-brand { flex-shrink: 0; }
  .auth-page .auth-brand img { width: 44px; height: 44px; border-radius: 12px; }
  .auth-page .auth-aside-title { margin-top: 0; font-size: 18px; line-height: 1.6; }
  .auth-page .auth-aside-title span { display: inline; }

  .auth-page .auth-main { order: 0; padding: 36px 32px 28px; }
  .auth-page .auth-form { max-width: none; }

  .auth-page .auth-points {
    order: 1; display: grid; margin: 0; padding: 22px 32px 28px;
    background: var(--surface-2); border-top: 1px solid var(--line);
  }
  .auth-page .auth-aside:not(.has-art) .auth-points { margin-top: 0; }
  .auth-page .auth-points li { font-size: 14px; color: var(--muted); }
  .auth-page .auth-points .icon-tile.on-dark {
    color: var(--brand);
    background: linear-gradient(135deg, rgba(51, 88, 255, .10), rgba(34, 199, 232, .12));
    box-shadow: inset 0 0 0 1px rgba(51, 88, 255, .14);
  }
  [data-theme="dark"] .auth-page .auth-points { background: rgba(255, 255, 255, .02); }
  [data-theme="dark"] .auth-page .auth-points .icon-tile.on-dark { color: var(--brand-300); background: rgba(51, 88, 255, .14); box-shadow: inset 0 0 0 1px rgba(143, 168, 255, .2); }
}

@media (max-width: 600px) {
  .auth-page { padding: 16px var(--gutter) 48px; }
  .auth-page .auth-shell { border-radius: var(--radius-lg); }
  .auth-page .auth-aside-top { gap: 14px; padding: 16px 20px; }
  .auth-page .auth-brand img { width: 40px; height: 40px; border-radius: 11px; }
  .auth-page .auth-aside-title { font-size: 16px; }
  .auth-page .auth-main { padding: 26px 20px 24px; }
  .auth-page .auth-points { padding: 18px 20px 22px; gap: 12px; }
  .auth-page .auth-points li { font-size: 13.5px; }
  .auth-page .auth-head { margin-bottom: 22px; }
  .auth-page .auth-head .icon-tile { margin-bottom: 14px; }
  .auth-page .auth-head h1 { font-size: 25px; }
  .auth-page .auth-head p { font-size: 15px; }
  .auth-page .code-input { min-height: 60px; font-size: 26px !important; letter-spacing: .4em; padding-inline: calc(12px + .4em) 12px; }
  .auth-page .code-input::placeholder { letter-spacing: .4em; }
  .auth-page .auth-next { flex-direction: column; align-items: stretch; }
  .auth-page .auth-foot { margin-top: 24px; padding-top: 18px; }
}

@media (max-width: 360px) {
  .auth-page .code-input { font-size: 22px !important; letter-spacing: .32em; padding-inline: calc(10px + .32em) 10px; }
  .auth-page .code-input::placeholder { letter-spacing: .32em; }
}
