/*
 * Galatea Auth Surfaces — login.html, register.html
 *
 * Must be imported AFTER tokens.css.
 * Scoped to .auth-page and its descendants — safe to co-exist with other
 * dashboards if the page body inherits global base styles from tokens.css.
 *
 * See docs/superpowers/specs/2026-04-16-auth-pages-redesign-design.md §3.4
 * for the class contract. Do not add utility classes outside that set.
 */

/* ═════════════════════ Page layout ═════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.auth-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  position: relative;
  z-index: 10;
}

.auth-nav-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-nav-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  transition: color var(--transition);
}
.auth-nav-link:hover { color: var(--text); }

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 28px 60px;
}

.auth-container {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  max-width: 960px;
  width: 100%;
  align-items: center;
}

/* ═════════════════════ Background orbs ═════════════════════ */

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.orb-1 {
  width: 520px; height: 520px;
  background: var(--violet-soft);
  top: -180px; left: -100px;
}
.orb-2 {
  width: 440px; height: 440px;
  background: var(--secondary-soft);
  bottom: -140px; right: -100px;
}

/* ═════════════════════ Left column: value ═════════════════════ */

.auth-value {
  animation: authFadeUp 0.6s ease forwards;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brand-violet-100);
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.auth-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.auth-value h1 {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: var(--ls-tight);
  line-height: 1.1;
  margin-bottom: 14px;
}
.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-value p {
  font-size: 0.92rem;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 24px;
  max-width: 420px;
}

/* Perks list */
.auth-perks {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}
.auth-perk {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.auth-perk-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--brand-violet-100);
  font-size: 0.95rem;
  flex-shrink: 0;
}
.auth-perk strong { color: var(--text); font-weight: 600; }

@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═════════════════════ Right column: form ═════════════════════ */

.auth-form-wrap {
  animation: authFadeUp 0.6s ease 0.15s both;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 30px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-md);
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-gradient);
}

.auth-card-title {
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.auth-card-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 16px;
}
.auth-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider-text {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: var(--font-mono);
}

/* Input primitives */
.auth-input-group {
  margin-bottom: 14px;
  position: relative;
}
.auth-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.auth-label-hint {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.68rem;
  color: var(--text-subtle);
}
.auth-input-wrap {
  position: relative;
}
.auth-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 44px 12px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.auth-input.valid { border-color: var(--success); }
.auth-input.invalid { border-color: var(--danger); }

.auth-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Submit button */
.auth-submit {
  width: 100%;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 14px;
  margin-top: 8px;
  background: var(--brand-gradient);
  color: white;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 24px var(--accent-glow);
}
.auth-submit:hover:not(:disabled) {
  box-shadow: 0 8px 32px var(--accent-glow);
  transform: translateY(-1px);
}
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Footer link row */
.auth-footer-link {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 18px;
}
.auth-footer-link a {
  color: var(--brand-violet-100);
  font-weight: 500;
}
.auth-footer-link a:hover { text-decoration: underline; }

/* Forgot password (login only) */
.auth-forgot {
  text-align: right;
  margin-top: 10px;
}
.auth-forgot a {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.auth-forgot a:hover { color: var(--text); }

/* ═════════════════════ Form UX affordances ═════════════════════ */

/* Right-side icon inside input (eye toggle, validation check/x) */
.input-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
  background: none;
  border: none;
  padding: 0;
}
.input-icon:hover { color: var(--text); }
.input-icon.valid { color: var(--success); }
.input-icon.invalid { color: var(--danger); }
.input-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Password strength meter */
.strength-bar {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.strength-seg {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background var(--transition);
}
.strength-seg.active-weak { background: var(--danger); }
.strength-seg.active-ok { background: var(--warning); }
.strength-seg.active-strong { background: var(--success); }

.strength-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 6px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}
.strength-label .grade-weak { color: var(--danger-text); }
.strength-label .grade-ok { color: var(--warning-text); }
.strength-label .grade-strong { color: var(--success-text); }

/* Caps Lock warning */
.caps-warn {
  display: none;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--warning-text);
  align-items: center;
  gap: 6px;
}
.caps-warn.visible { display: flex; }
.caps-warn::before {
  content: '⇪';
  font-size: 0.95rem;
}

/* Field-level error slot */
.field-error {
  font-size: 0.72rem;
  color: var(--danger-text);
  margin-top: 6px;
  display: none;
}
.field-error.visible { display: block; }

/* Confirm-password match line */
.match-line {
  margin-top: 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  display: none;
  align-items: center;
  gap: 6px;
}
.match-line.visible { display: flex; }
.match-line.ok { color: var(--success-text); }
.match-line.no { color: var(--danger-text); }
.match-line svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Trust row under CTA */
.auth-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.auth-trust-item { display: flex; align-items: center; gap: 4px; }
.auth-trust-item::before {
  content: '•';
  color: var(--success);
}
.auth-trust-item:first-child::before { content: none; }

/* Top-level error chip */
.auth-error {
  font-size: 0.8rem;
  color: var(--danger-text);
  margin-top: 12px;
  text-align: center;
  padding: 10px 14px;
  background: var(--danger-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--r-sm);
  display: none;
}
.auth-error.visible { display: block; }

/* Success chip (e.g. email verified) */
.auth-success {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--success-dim);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--r-sm);
  color: var(--success-text);
  font-size: 0.82rem;
  margin-bottom: 16px;
}
.auth-success::before {
  content: '✓';
  font-weight: 700;
}

/* Telegram widget loading card — spinner while async widget script loads.
   On iframe appearance: element removed. On 5s timeout / config fail: `.failed` class. */
.auth-tg-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(100, 150, 220, 0.12);
  color: var(--text-dim, #8892a6);
  min-height: 42px;
  font-size: 0.9rem;
}
.auth-tg-placeholder:not(.failed)::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tg-spin 0.8s linear infinite;
  margin-right: 8px;
}
@keyframes tg-spin {
  to { transform: rotate(360deg); }
}
.auth-tg-placeholder.failed {
  background: rgba(220, 100, 100, 0.1);
  color: var(--text-dim, #8892a6);
}
.auth-tg-placeholder.failed::before {
  display: none;
}

/* Spinner (scoped to auth, no dep on dash.css) */
.auth-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
  display: inline-block;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* ═════════════════════ Responsive ═════════════════════ */

@media (max-width: 860px) {
  .auth-container {
    grid-template-columns: 1fr;
    gap: 36px;
    max-width: 440px;
  }
  .auth-value { text-align: left; }
  .auth-value h1 { font-size: 1.75rem; }
}

@media (max-width: 480px) {
  .auth-nav { padding: 14px 18px; }
  .auth-main { padding: 16px 18px 40px; }
  .auth-card { padding: 26px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-value,
  .auth-form-wrap,
  .strength-seg,
  .auth-input,
  .auth-submit,
  .auth-nav-link,
  .auth-perk-icon,
  .input-icon,
  .auth-tg-placeholder,
  .auth-spinner {
    animation: none !important;
    transition: none !important;
  }
}
