/*
 * 👤 Advertiser account pages — shared styling for signin / register / verify / reset.
 *
 * One stylesheet rather than four inline <style> blocks: these pages are a set,
 * a visitor moves between them mid-task (register -> verify, signin -> reset),
 * and any drift between them reads as "which site am I on?". It also means the
 * cPanel sync ships one file when the look changes instead of four.
 *
 * The tokens are COPIED from the hub's page-level tokens rather than imported,
 * because the hub pages each define their own :root inline and there is no
 * shared token file to import yet. They are kept byte-identical to
 * affiliate.html so these pages sit inside the same visual system; if the hub
 * ever grows a real tokens.css, this block is what deletes.
 */

:root {
  --color-bg: #0a0b0d;
  --color-surface: #0f1115;
  --color-surface-2: #141720;
  --color-surface-3: #1a1e2a;
  --color-divider: #1e2233;
  --color-border: #252c42;

  --color-text: #e2e6f0;
  --color-text-muted: #8a93ab;
  --color-text-faint: #4a5068;

  --color-primary: #3da8ff;
  --color-primary-dark: #1578e8;
  --color-primary-glow: rgba(61, 168, 255, 0.28);
  --color-primary-hover: #66b8ff;
  --color-accent: #00ddff;

  --color-danger: #ff6b6b;
  --color-danger-bg: rgba(255, 107, 107, 0.1);
  --color-ok: #4ade80;
  --color-ok-bg: rgba(74, 222, 128, 0.1);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;

  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: "Orbitron", monospace;
  --font-body: "Space Grotesk", "Inter", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  /* Two soft lights rather than a flat fill, matching the hub's hero. */
  background-image:
    radial-gradient(
      ellipse 80% 60% at 50% -20%,
      rgba(61, 168, 255, 0.12),
      transparent
    ),
    radial-gradient(
      ellipse 60% 50% at 100% 100%,
      rgba(0, 221, 255, 0.06),
      transparent
    );
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--color-primary-hover);
}

/* ── Shell ───────────────────────────────────────────────────────────── */

.ha-wrap {
  flex: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-4) var(--space-8);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ha-brand {
  display: block;
  text-align: center;
  margin-bottom: var(--space-6);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff 20%, var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ha-card {
  background: linear-gradient(
    180deg,
    var(--color-surface-2) 0%,
    var(--color-surface) 100%
  );
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.ha-card h1 {
  margin: 0 0 var(--space-2);
  font-size: 1.4rem;
  font-family: var(--font-display);
  font-weight: 600;
}

.ha-sub {
  margin: 0 0 var(--space-6);
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* ── Fields ──────────────────────────────────────────────────────────── */

.ha-field {
  margin-bottom: var(--space-4);
}

.ha-field label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.ha-field .ha-optional {
  font-weight: 400;
  color: var(--color-text-faint);
}

.ha-field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.ha-field input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Browser autofill repaints the field white with black text, which is
   unreadable on this background. The huge inset shadow is the only reliable
   way to override it in Chromium — background-color is ignored. */
.ha-field input:-webkit-autofill,
.ha-field input:-webkit-autofill:hover,
.ha-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-text);
  -webkit-box-shadow: 0 0 0 1000px var(--color-surface-3) inset;
  caret-color: var(--color-text);
}

.ha-hint {
  margin: var(--space-2) 0 0;
  font-size: 0.78rem;
  color: var(--color-text-faint);
}

/* Password visibility toggle sits inside the field. */
.ha-pw {
  position: relative;
}
.ha-pw input {
  padding-right: 4rem;
}
.ha-pw button {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
}
.ha-pw button:hover {
  color: var(--color-primary);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

.ha-btn {
  width: 100%;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--color-primary-dark),
    var(--color-primary)
  );
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    filter var(--transition),
    transform var(--transition);
}

.ha-btn:hover:not(:disabled) {
  filter: brightness(1.12);
}
.ha-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.ha-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ha-btn-ghost {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.ha-btn-ghost:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ── Messages ────────────────────────────────────────────────────────── */

/* Hidden until it has something to say. `hidden` alone loses to display:block
   from the class, so it is asserted here. */
.ha-msg[hidden] {
  display: none;
}

.ha-msg {
  display: block;
  margin-bottom: var(--space-4);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

.ha-msg.err {
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border-color: rgba(255, 107, 107, 0.25);
}

.ha-msg.ok {
  color: var(--color-ok);
  background: var(--color-ok-bg);
  border-color: rgba(74, 222, 128, 0.25);
}

/* ── Dividers, alt actions, footer ───────────────────────────────────── */

.ha-or {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--color-text-faint);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.ha-or::before,
.ha-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-divider);
}

.ha-alt {
  margin: var(--space-6) 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.ha-links {
  margin-top: var(--space-4);
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.82rem;
}

.ha-foot {
  margin-top: var(--space-6);
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-faint);
  line-height: 1.6;
}

.ha-tg {
  display: flex;
  justify-content: center;
  min-height: 2.5rem;
}

/* Spinner state on a submitting button. */
.ha-btn.busy {
  position: relative;
  color: transparent;
}
.ha-btn.busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: var(--radius-full);
  animation: ha-spin 0.7s linear infinite;
}

@keyframes ha-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Respect a reduced-motion preference: the spinner is decorative, and the
   disabled+dimmed button already communicates "working". */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
  .ha-btn.busy::after {
    animation: none;
  }
}

@media (max-width: 480px) {
  .ha-wrap {
    padding: var(--space-6) var(--space-4);
  }
  .ha-card {
    padding: var(--space-6) var(--space-5);
  }
}
