/* ===========================================================================
   app/core/auth/auth.css
   Public auth pages: signup (card), reset and verify (split).

   Served at its real path (/app/core/auth/auth.css) through the narrow
   .htaccess exception, so it must stay two segments deep and end in .css.
   =========================================================================== */

:root {
  --zx-ink:      #0f1b34;
  --zx-muted:    #64748b;
  --zx-line:     #e6eaf2;
  --zx-blue:     #1d63e6;
  --zx-blue-sky: #eaf1ff;
  --zx-bad:      #ef4444;
  --zx-good:     #16a34a;
}

/* ===========================================================================
   CARD LAYOUT — signup
   =========================================================================== */

.zx-card-page {
  min-height: 100dvh;          /* not vh: mobile browser chrome makes vh taller
                                  than the visible area and pushes the submit
                                  button below the fold on first paint */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(180deg, #f2f7ff 0%, #f8fbff 55%, #ffffff 100%);
}

.zx-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border: 1px solid rgba(29, 99, 230, .06);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(15, 40, 100, .07);
  padding: 32px;
}

.zx-card-logo {
  display: block;
  text-align: center;
  margin-bottom: 14px;
}

.zx-card-logo img {
  width: 190px;
  height: auto;
}

.zx-badge {
  display: block;
  width: fit-content;
  margin: 0 auto 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--zx-blue-sky);
  color: var(--zx-blue);
  font-size: 12.5px;
  font-weight: 600;
}

.zx-card-title {
  margin: 0 0 4px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--zx-ink);
}

.zx-card-sub {
  margin: 0 0 20px;
  text-align: center;
  font-size: 14px;
  color: var(--zx-muted);
}

@media (max-width: 480px) {
  .zx-card { padding: 24px 20px; border-radius: 16px; }
  .zx-card-title { font-size: 23px; }
  .zx-card-logo img { width: 158px; }
}

/* ===========================================================================
   SPLIT LAYOUT — reset, verify
   =========================================================================== */

.zx-auth--split .auth,
.zx-auth--split .auth-right {
  min-height: 100dvh;
}

.zx-auth--split .auth-right {
  width: 100%;
  padding: 32px 20px !important;
}

@media (min-width: 992px) {
  .zx-auth--split .auth-right { width: 50%; padding: 48px 40px !important; }
}

/* Phones: smaller logo, tighter padding, and the OTP boxes shrink so six of
   them still fit across a 360px screen without the row wrapping. */
@media (max-width: 575.98px) {
  .zx-auth--split .auth-right { padding: 28px 18px !important; }
  .zx-auth--split .zx-auth-logo { max-width: 240px; margin-bottom: 20px; }
  .zx-auth--split .zx-field .form-control,
  .zx-auth--split .zx-submit { height: 52px; }
  .zx-otp { gap: 6px; }
  .zx-otp-box { height: 48px; font-size: 19px; border-radius: 9px; }
}

/* Very narrow (older/smaller Androids at 320px): the OTP row is the tightest
   thing on the page, so it gets one more step down rather than overflowing. */
@media (max-width: 359.98px) {
  .zx-otp { gap: 4px; }
  .zx-otp-box { height: 44px; font-size: 17px; }
}

.zx-auth-col { max-width: 464px; }

/*
 * Matches the login page. Width is a percentage with a max, not a fixed pixel
 * value: the column is 464px on desktop but full-width minus padding on a
 * phone, and a fixed 350px would overflow a 360px screen.
 */
.zx-auth--split .zx-auth-logo {
  display: block;
  width: 100%;
  max-width: 350px;
  margin-bottom: 28px;
}

.zx-auth--split .zx-auth-logo img {
  display: block;
  width: 100%;
  height: auto;
}

/* ===========================================================================
   SHARED
   =========================================================================== */

/* ── Step dots ─────────────────────────────────────────────────────────── */

.zx-steps {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-bottom: 14px;
}

.zx-step {
  width: 8px;
  height: 5px;
  border-radius: 999px;
  background: #cfd9e8;
  transition: width .25s ease, background-color .25s ease;
}

.zx-step.is-on { width: 22px; background: var(--zx-blue); }
.zx-step.is-done { background: var(--zx-blue); }

/* Left-aligned in the split column — the card centres, this does not. */
.zx-auth--split .zx-steps {
  justify-content: flex-start;
  margin: 0 0 20px;
}

/* Login's field metrics: 56px tall, 12px radius. */
.zx-auth--split .zx-field .form-control {
  height: 56px;
  border-radius: 12px;
}

.zx-auth--split .zx-submit {
  height: 56px;
  border-radius: 12px;
}

/* ── Panels ────────────────────────────────────────────────────────────── */

.zx-panel { display: none; }

.zx-panel.is-on {
  display: block;
  animation: zx-panel-in .22s ease both;
}

@keyframes zx-panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Fields ────────────────────────────────────────────────────────────── */

.zx-group { margin-bottom: 14px; }

.zx-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--zx-ink);
}

.zx-field { position: relative; }

.zx-field .form-control {
  height: 48px;
  padding-left: 42px;
  padding-right: 42px;
  border: 1px solid var(--zx-line);
  border-radius: 10px;
  background: #fbfcfe;
  font-size: 14px;
}

.zx-field .form-control:focus {
  background: #fff;
  border-color: var(--zx-blue);
  box-shadow: 0 0 0 3px rgba(29, 99, 230, .12);
}

.zx-field-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  font-size: 17px;
  line-height: 1;
  color: #9aa7bd;
  pointer-events: none;
}

.zx-eye {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: 0;
  background: none;
  padding: 4px;
  font-size: 17px;
  line-height: 1;
  color: #9aa7bd;
  cursor: pointer;
}

.form-control.is-bad { border-color: var(--zx-bad); }

/* ── Alerts and field errors ───────────────────────────────────────────── */

/* Hidden until JS fills them, so an empty alert is never a bare box. */
.zx-alert {
  display: none;
  font-size: 13.5px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  word-break: break-word;
}

.brand-link {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 12px;
}

.zx-alert.is-on { display: block; }

.zx-field-error {
  display: none;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--zx-bad);
}

.zx-field-error.is-on { display: block; }

/* ── Password rules ────────────────────────────────────────────────────── */

.zx-rules {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 10px;
}

.zx-rules li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--zx-muted);
  transition: color .18s ease;
}

.zx-rules li i { font-size: 13px; line-height: 1; }
.zx-rules li.is-met { color: var(--zx-good); }

/* ── Consent ───────────────────────────────────────────────────────────── */

.zx-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 16px;
  font-size: 12.5px;
  color: var(--zx-muted);
  cursor: pointer;
}

/*
 * Drawn from scratch, not native.
 *
 * style.css hides bare checkboxes (position:absolute; opacity:0) so it can
 * render its own via .form-check-input. That is why this box was invisible AND
 * why the label text wrapped to the card edge — an absolutely positioned input
 * leaves the flex row, so the text span became the only item in it.
 *
 * position and opacity carry !important because the rule being overridden may
 * carry it too; the rest wins on specificity alone.
 */
.zx-consent input[type="checkbox"] {
  position: static !important;
  opacity: 1 !important;
  flex: 0 0 auto;
  display: inline-block;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  border: 1.5px solid #c3cddd;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.zx-consent input[type="checkbox"]:hover {
  border-color: var(--zx-blue);
}

/* Tick as a background image: no extra element, so the markup stays a plain
   label + input and nothing depends on sibling selectors. */
.zx-consent input[type="checkbox"]:checked {
  background-color: var(--zx-blue);
  border-color: var(--zx-blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.4l3 3 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.zx-consent input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--zx-blue);
  outline-offset: 2px;
}

/* Keeps wrapped lines aligned under the first line rather than under the box. */
.zx-consent span {
  flex: 1 1 auto;
}

.zx-consent a { color: var(--zx-blue); font-weight: 600; text-decoration: none; }

/* ── Submit ────────────────────────────────────────────────────────────── */

.zx-submit {
  width: 100%;
  height: 50px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
}

.btn[disabled] { opacity: .55; cursor: not-allowed; }

.zx-spin {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: zx-rotate .6s linear infinite;
}

@keyframes zx-rotate { to { transform: rotate(360deg); } }

/* ── Footer links ──────────────────────────────────────────────────────── */

.zx-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--zx-muted);
}

.zx-foot a { color: var(--zx-blue); font-weight: 600; text-decoration: none; }
.zx-foot--muted { margin-top: 8px; }
.zx-foot--muted a { color: var(--zx-muted); font-weight: 400; }

/* ── OTP boxes ─────────────────────────────────────────────────────────── */

.zx-otp {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.zx-otp-box {
  width: 100%;
  height: 54px;
  padding: 0;
  text-align: center;
  font-size: 21px;
  font-weight: 600;
  color: var(--zx-ink);
  background: #fbfcfe;
  border: 1.5px solid var(--zx-line);
  border-radius: 11px;
  caret-color: transparent;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.zx-otp-box:focus {
  outline: none;
  background: #fff;
  border-color: var(--zx-blue);
  box-shadow: 0 0 0 3px rgba(29, 99, 230, .13);
}

.zx-otp-box.is-filled { border-color: var(--zx-blue); color: var(--zx-blue); }

.zx-otp.is-bad .zx-otp-box {
  border-color: var(--zx-bad);
  animation: zx-shake .3s ease;
}

@keyframes zx-shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ── Done ──────────────────────────────────────────────────────────────── */

.zx-done { text-align: center; padding: 20px 0 8px; }
.zx-done-mark { font-size: 58px; line-height: 1; color: var(--zx-good); }
.zx-done h2 { margin: 14px 0 6px; font-size: 22px; font-weight: 700; color: var(--zx-ink); }
.zx-done p { margin: 0; font-size: 14px; color: var(--zx-muted); }

/* ── Quality floor ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .zx-panel.is-on,
  .zx-otp.is-bad .zx-otp-box,
  .zx-spin,
  .zx-step { animation: none; transition: none; }
}

.form-control:focus-visible,
.btn:focus-visible,
.zx-eye:focus-visible,
a:focus-visible {
  outline: 2px solid var(--zx-blue);
  outline-offset: 2px;
}