/* ===========================================================================
 * auth.css — login.php + register.php only (loaded via the page `css` opt).
 *
 * A calm, premium two-column authentication experience: the form on the left,
 * a quiet market panel on the right. Everything is token-driven; no gradients
 * louder than the rest of the product, no glow, no flashing. The market panel
 * is decorative + informational — it never blocks the form and collapses to a
 * contained, horizontally-scrolling strip on small screens.
 * ======================================================================== */

/* ---- shell -------------------------------------------------------------- */
.auth-shell.auth-shell--market {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;              /* mobile-first: single column */
  align-items: start;
}
.auth-shell--market .auth-main {
  min-height: auto;
  padding: clamp(20px, 6vw, 56px) clamp(16px, 5vw, 40px) clamp(24px, 5vw, 40px);
}
.auth-shell--market .auth-card { max-width: 400px; }
.auth-shell--market .auth-card h1 { font-size: clamp(20px, 5vw, 26px); }

/* brand row inside the card (mobile shows it here; desktop shows it in panel) */
.auth-brandline {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 28px; font-weight: 700; font-size: 18px; letter-spacing: .2px;
  color: var(--text-primary);
}
.auth-brandline .brand-mark { width: 26px; height: 26px; }

/* ---- market panel ---------------------------------------------------------
 * On mobile it renders as a bounded horizontal strip AFTER the form. */
.auth-market {
  position: relative;
  border-top: 1px solid var(--border-color);
  background:
    linear-gradient(var(--border-color) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, var(--border-color) 1px, transparent 1px) 0 0 / 44px 100%,
    radial-gradient(circle at 82% 12%, rgba(47,111,237,.10), transparent 42%),
    var(--bg-secondary);
  background-blend-mode: normal;
  padding: 18px clamp(16px, 5vw, 24px) 72px;   /* bottom clears the fixed .auth-lang bar */
  overflow: hidden;
}
.auth-market::before {                      /* fade the grid out — decorative only */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent, var(--bg-secondary) 78%);
  pointer-events: none;
}
.auth-market > * { position: relative; }

.auth-market-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.auth-market-head h2 {
  font-size: var(--fs-md); font-weight: 600; color: var(--text-primary); margin: 0;
}
.auth-market-note { font-size: var(--fs-xs); color: var(--text-muted); }
.auth-market-note.is-error { color: var(--warning); }

/* the ticker itself */
.auth-ticker {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.auth-ticker::-webkit-scrollbar { display: none; }

.auth-tik {
  scroll-snap-align: start;
  flex: 0 0 auto;
  min-width: 148px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 12px 13px;
  transition: transform .16s ease, border-color .16s ease, background-color .35s ease;
}
.auth-tik:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.auth-tik-sym { display: block; font-size: var(--fs-xs); color: var(--text-muted); letter-spacing: .04em; }
.auth-tik-px {
  display: block;
  font-family: var(--font-mono); font-size: var(--fs-md); font-weight: 600;
  color: var(--text-primary); margin: 3px 0 2px; font-variant-numeric: tabular-nums;
  transition: color .2s ease, transform .2s ease;
}
.auth-tik-ch { display: block; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.auth-tik.is-up   .auth-tik-ch { color: var(--success); }
.auth-tik.is-down .auth-tik-ch { color: var(--danger); }
.auth-tik.is-flat .auth-tik-ch { color: var(--text-muted); }
.auth-tik.flash-up   { background: var(--success-soft); }
.auth-tik.flash-down { background: var(--danger-soft); }
.auth-tik-spark { display: block; width: 100%; height: 22px; margin-top: 7px; overflow: visible; }
.auth-tik-spark path { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.auth-tik.is-up   .auth-tik-spark path { stroke: var(--success); }
.auth-tik.is-down .auth-tik-spark path { stroke: var(--danger); }
.auth-tik.is-flat .auth-tik-spark path { stroke: var(--text-muted); }

.auth-ticker-skeleton { display: flex; gap: 10px; }
.auth-ticker-skeleton i {
  flex: 0 0 auto; width: 148px; height: 92px; border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--bg-card), var(--bg-hover), var(--bg-card));
  background-size: 200% 100%; animation: authSk 1.3s ease infinite;
}
@keyframes authSk { to { background-position: -200% 0; } }

/* ---- password field + toggle ---------------------------------------------- */
.pw-field { position: relative; }
.pw-field .input { padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: none; border: 0; cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.pw-toggle:hover { color: var(--text-secondary); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- password strength + requirements ----------------------------------- */
.pw-strength { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.pw-strength .pw-strength-label { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.pw-strength .pw-strength-label[data-level="1"] { color: var(--danger); }
.pw-strength .pw-strength-label[data-level="2"] { color: var(--warning); }
.pw-strength .pw-strength-label[data-level="3"] { color: var(--accent); }
.pw-strength .pw-strength-label[data-level="4"] { color: var(--success); }

.pw-reqs { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.pw-reqs li {
  display: flex; align-items: center; gap: 7px;
  font-size: var(--fs-xs); color: var(--text-muted);
}
.pw-reqs li .pw-req-ico {
  width: 14px; height: 14px; flex: 0 0 14px; border-radius: 50%;
  border: 1px solid var(--border-strong); display: inline-grid; place-items: center;
  font-size: 8px; color: transparent; transition: all .18s ease;
}
.pw-reqs li.ok { color: var(--text-secondary); }
.pw-reqs li.ok .pw-req-ico { background: var(--success); border-color: var(--success); color: #06231a; }

/* ---- misc form polish ------------------------------------------------------ */
.auth-shell--market .field-label { font-weight: 600; }
.auth-shell--market .auth-alt { margin-top: 22px; }
.auth-shell--market .btn-primary[data-loading-text] .spinner { margin-right: 2px; }
.auth-legal { margin-top: 16px; font-size: var(--fs-xs); color: var(--text-faint); text-align: center; }
.auth-legal a { color: var(--text-muted); }
.auth-legal a:hover { color: var(--text-secondary); }

/* the "check your email" / success panel */
.auth-state {
  text-align: center; padding: 8px 0 4px;
}
.auth-state .auth-state-ico {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: var(--accent-soft); color: var(--accent);
}
.auth-state.is-success .auth-state-ico { background: var(--success-soft); color: var(--success); }
.auth-state h2 { font-size: var(--fs-xl); margin-bottom: 6px; }
.auth-state p { color: var(--text-muted); }
.auth-state .auth-state-addr { font-family: var(--font-mono); color: var(--text-secondary); }

/* ===========================================================================
 * Desktop / tablet — two columns from 1024px up.
 * ======================================================================== */
@media (min-width: 1024px) {
  .auth-shell.auth-shell--market {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
    min-height: 100vh;
  }
  .auth-shell--market .auth-main {
    min-height: 100vh; align-items: center;
    padding: 40px clamp(32px, 5vw, 72px) 64px;
  }
  .auth-brandline { display: none; }        /* brand lives in the panel on desktop */

  .auth-market {
    border-top: 0; border-left: 1px solid var(--border-color);
    min-height: 100vh;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: clamp(40px, 6vw, 80px);
    gap: 26px;
  }
  .auth-market > * { width: 100%; max-width: 460px; }   /* keep the panel column tidy on ultra-wide screens */
  .auth-market .auth-market-brand { align-self: flex-start; }
  .auth-market::before { background: linear-gradient(160deg, transparent 30%, var(--bg-secondary)); }

  .auth-market-brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 20px; color: var(--text-primary);
  }
  .auth-market-brand .brand-mark { width: 30px; height: 30px; }

  .auth-hero h2 {
    font-size: clamp(24px, 2.4vw, 32px); line-height: 1.2;
    max-width: 440px; color: var(--text-primary);
  }
  .auth-hero p {
    color: var(--text-secondary); margin-top: 12px; max-width: 420px;
    font-size: var(--fs-md); line-height: 1.6;
  }

  .auth-market-head { margin-bottom: 0; }
  /* vertical list of rows instead of a horizontal strip */
  .auth-ticker {
    flex-direction: column; overflow: visible; gap: 8px;
    max-width: 460px;
  }
  .auth-tik {
    min-width: 0; width: 100%;
    display: grid; grid-template-columns: 1fr auto auto; align-items: center;
    column-gap: 14px; padding: 13px 16px;
  }
  .auth-tik-sym { font-size: var(--fs-sm); color: var(--text-secondary); }
  .auth-tik-px { margin: 0; font-size: var(--fs-md); }
  .auth-tik-ch { text-align: right; min-width: 62px; }
  .auth-tik-spark { grid-column: 1 / -1; height: 24px; margin-top: 4px; }
  .auth-ticker-skeleton { flex-direction: column; }
  .auth-ticker-skeleton i { width: 100%; height: 50px; }
}

@media (min-width: 1440px) {
  .auth-shell--market .auth-main { padding-left: clamp(60px, 8vw, 140px); }
  .auth-shell--market .auth-card { max-width: 408px; }
}

/* ===========================================================================
 * Reduced motion — no transitions, no shimmer, no flash.
 * ======================================================================== */
@media (prefers-reduced-motion: reduce) {
  .auth-tik, .auth-tik-px, .auth-ticker-skeleton i { transition: none; animation: none; }
  .auth-tik.flash-up, .auth-tik.flash-down { background: var(--bg-card); }
}
