/* Shared login/register shell — landing identity, aurora, glass forms */

body {
  background: var(--fg-bg-deep);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Vazirmatn, system-ui, sans-serif;
  color: #fff;
  margin: 0;
}

.page-shell {
  position: relative;
  isolation: isolate;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: -1;
}
.orb-v {
  top: -100px;
  right: -120px;
  width: 420px;
  height: 420px;
  background: rgba(139, 92, 246, 0.3);
  animation: fg-float-y 10s ease-in-out infinite;
}
.orb-c {
  bottom: -100px;
  left: -160px;
  width: 460px;
  height: 460px;
  background: rgba(56, 189, 248, 0.25);
  animation: fg-float-y 8s ease-in-out infinite reverse;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 20px;
}

.nav {
  padding: 20px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(7, 6, 13, 0.6);
  backdrop-filter: blur(20px);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.nav-logo img {
  height: calc(52px * 1.414213562);
  width: auto;
  filter: drop-shadow(0 0 28px rgba(139, 92, 246, 0.45));
}
.nav-back {
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-back:hover {
  color: #fff;
}

.login-main {
  flex: 1;
  display: grid;
  place-items: start center;
  padding: 40px 20px 56px;
  width: 100%;
}
.login-wrap {
  width: 100%;
  max-width: 480px;
}

.stepper {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 0;
  max-width: 360px;
  margin-inline: auto;
  margin-bottom: 32px;
}
.step-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.step-dot {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.45);
  transition: all 0.3s;
}
.step-dot.active {
  background: linear-gradient(135deg, var(--fg-cyan), var(--fg-violet), var(--fg-magenta));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--fg-glow-brand);
}
.step-dot.done {
  background: rgba(16, 185, 129, 0.2);
  color: var(--fg-emerald);
  border-color: rgba(16, 185, 129, 0.4);
}
.step-line {
  width: 100%;
  height: 2px;
  min-width: 24px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.3s;
  align-self: start;
  margin-top: 18px;
}
.step-line.done {
  background: var(--fg-emerald);
}
.step-label {
  font-size: 12px;
  color: var(--fg-text-faint);
  text-align: center;
  white-space: nowrap;
}
.step-dot.active + .step-label,
.step-cell:has(.step-dot.active) .step-label {
  color: var(--fg-cyan);
  font-weight: 600;
}

.login-card-wrap {
  width: 100%;
  perspective: 1200px;
}
.login-card {
  padding: 36px 32px;
  border-radius: 24px;
  transform-style: preserve-3d;
  animation: fg-login-card-in 0.6s ease both;
}
@keyframes fg-login-card-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--fg-cyan), var(--fg-violet), var(--fg-magenta));
  border-radius: 18px;
  box-shadow: var(--fg-glow-brand);
  font-size: 28px;
}
.login-title {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin: 0;
  color: var(--fg-text);
}
.login-sub {
  font-size: 14px;
  line-height: 1.85;
  color: var(--fg-text-muted);
  text-align: center;
  margin: 12px 0 24px;
  padding: 14px 16px;
  border-radius: var(--fg-radius-md);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.28);
}
.login-sub strong {
  color: var(--fg-cyan);
  font-weight: 700;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
  text-align: right;
}
.field-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
  direction: ltr;
  text-align: center;
  letter-spacing: 0.05em;
}
.field-input:focus {
  border-color: var(--fg-violet);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.field-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}
.field-input:disabled {
  opacity: 0.45;
}
.field-help {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin: 6px 0 0;
  text-align: right;
  line-height: 1.7;
}
.field-help a {
  color: var(--fg-cyan);
  text-decoration: none;
}

.otp-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  direction: ltr;
}
.otp-box {
  width: 48px;
  height: 56px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: all 0.2s;
}
.otp-box:focus {
  border-color: var(--fg-violet);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
.otp-box.filled {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.4);
}
.otp-box.error {
  border-color: var(--fg-red);
  background: rgba(239, 68, 68, 0.1);
}

.resend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 4px;
}
.resend-timer {
  color: rgba(255, 255, 255, 0.55);
}
.resend-timer strong {
  color: #fff;
}
.resend-link {
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
  text-decoration: none;
}
.resend-link.enabled {
  color: var(--fg-cyan);
  cursor: pointer;
  text-decoration: underline;
}

.submit-btn {
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--fg-radius-md);
  background: var(--fg-grad-brand-h);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--fg-glow-brand);
}
.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: var(--fg-glow-brand), 0 12px 28px rgba(139, 92, 246, 0.35);
}
.submit-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.submit-btn .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fg-spin 0.6s linear infinite;
}
.submit-btn.loading .spinner {
  display: inline-block;
}
.submit-btn.loading .btn-text {
  opacity: 0.5;
}
@keyframes fg-spin {
  to {
    transform: rotate(360deg);
  }
}

.alert {
  display: none;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.7;
  text-align: right;
  margin-top: 4px;
}
.alert.error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ff8a8a;
}
.alert.success {
  display: block;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--fg-emerald);
}
.alert.info {
  display: block;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #7dd3fc;
}
/* An alert with no message must NEVER render. Without this, elements that carry
   both `alert` and `error`/`success` (e.g. register's `alert alert-panel error`)
   are forced visible by `.alert.error{display:block}` (specificity 0,2,0) even
   when empty, showing blank red/green boxes on load. The :empty state wins via
   !important regardless of class combination. (2026-05-31) */
.alert:empty,
.alert-panel:empty {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
}

.terms-note {
  font-size: 11px;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin-top: 16px;
}
.terms-note a {
  color: var(--fg-cyan);
  text-decoration: none;
}

.alt-link {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.8;
}
.alt-link a {
  color: var(--fg-cyan);
  font-weight: 600;
  text-decoration: none;
}
.alt-link a:hover {
  text-decoration: underline;
}

.site-footer-mini {
  padding: 24px 0;
  border-top: 1px solid var(--fg-border);
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}
.site-footer-mini a {
  color: var(--fg-cyan);
  text-decoration: none;
}

.method-switch {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--fg-border);
  max-width: 320px;
  margin-inline: auto;
}
.method-pill {
  flex: 1;
  min-width: 120px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  color: var(--fg-text-muted);
  background: transparent;
  transition: all 0.2s;
  text-align: center;
}
.method-pill:hover {
  color: var(--fg-text);
  background: rgba(255, 255, 255, 0.06);
}
.method-pill.active {
  color: #fff;
  border-color: rgba(139, 92, 246, 0.5);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.45), rgba(217, 70, 239, 0.35));
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

.login-step-otp.is-collapsed {
  opacity: 0;
  transform: translateY(-14px) scale(0.985);
  max-height: 0;
  margin-top: 0;
  pointer-events: none;
  overflow: hidden;
}

#step1.is-collapsed {
  opacity: 0.12;
  transform: translateY(-30px) scale(0.975);
  max-height: 0;
  margin-bottom: 18px;
  pointer-events: none;
  overflow: hidden;
}

.login-step-otp,
#step1 {
  transition:
    opacity 0.4s ease,
    transform 0.45s ease,
    max-height 0.45s ease,
    margin 0.35s ease;
  transform-origin: top center;
}

.login-step-otp {
  max-height: 900px;
  margin-top: 20px;
}

.login-step-otp.is-pending .otp-row {
  opacity: 0.45;
  pointer-events: none;
}

.login-step-otp.is-pending .otp-pending-note {
  display: block;
}

.otp-pending-note {
  display: none;
  font-size: 13px;
  text-align: center;
  color: var(--fg-cyan);
  margin: 0 0 12px;
}

/* ─── Register flow ─── */
.register-wrap {
  max-width: 560px;
}
.orb-m {
  top: 42%;
  left: 50%;
  width: 320px;
  height: 320px;
  transform: translate(-50%, -50%);
  background: rgba(217, 70, 239, 0.18);
  animation: fg-float-y 12s ease-in-out infinite;
  animation-delay: -3s;
}

.register-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.register-phase {
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  animation: fg-login-card-in 0.45s ease both;
}
.register-phase.hidden {
  display: none;
}
.phase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.phase-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
}
.phase-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.phase-badge.done {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}
.phase-badge.active {
  color: #fff;
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.45);
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.btn-secondary,
.btn-ghost {
  width: 100%;
  padding: 13px 18px;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  border: none;
}
.btn-secondary {
  background: rgba(14, 165, 233, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(14, 165, 233, 0.35);
}
.btn-secondary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px rgba(14, 165, 233, 0.45);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}
.btn-secondary:disabled,
.btn-ghost:disabled,
.submit-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}
.captcha-box {
  background: #fff;
  border-radius: 14px;
  padding: 4px;
  min-height: 72px;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.captcha-box svg {
  display: block;
  max-width: 100%;
  height: auto;
}
/* Wrapper so the refresh control can sit in the box's top-right without being
   wiped when the SVG is injected into #captcha-image via innerHTML. */
.captcha-visual {
  position: relative;
  display: flex;
}
.captcha-visual .captcha-box {
  flex: 1;
}
/* Small, semi-transparent reload icon in the top-right corner of the captcha. */
.captcha-refresh {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  opacity: 0.55;
  cursor: pointer;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.4s ease;
}
.captcha-refresh:hover,
.captcha-refresh:focus-visible {
  opacity: 1;
  background: rgba(15, 23, 42, 0.78);
  cursor: pointer;
  outline: none;
}
.captcha-refresh:active {
  transform: rotate(-180deg);
}
@media (prefers-reduced-motion: reduce) {
  .captcha-refresh {
    transition: none;
  }
}

.field-hint {
  font-size: 12px;
  margin-top: 4px;
  min-height: 18px;
  line-height: 1.6;
  text-align: right;
  direction: rtl;
}
.field-hint.ok {
  color: #34d399;
}
.field-hint.err {
  color: #ff8a8a;
}

.birth-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.birth-row .field-label {
  font-size: 11px;
  margin-bottom: 6px;
  text-align: center;
}
.birth-row .field-input {
  font-size: 16px;
  padding: 12px 10px;
}

.terms-block {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.terms-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.75);
}
.terms-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 4px;
  flex-shrink: 0;
  accent-color: var(--fg-violet);
}
.terms-row label {
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}
.terms-row a {
  color: var(--fg-cyan);
  text-decoration: underline;
}

.field-input.rtl-input {
  direction: rtl;
  text-align: right;
  letter-spacing: normal;
}

.register-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin: 6px 0 0;
  text-align: center;
  line-height: 1.7;
}

.alert-panel {
  display: none;
  margin-bottom: 4px;
}
.alert-panel.is-visible {
  display: block;
}
.alert-panel.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ff8a8a;
}
.alert-panel.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--fg-emerald);
}
.alert-panel.info {
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #7dd3fc;
}

@media (max-width: 640px) {
  .nav-logo img {
    height: calc(36px * 1.414213562);
  }
  .login-card {
    padding: 28px 20px;
  }
  .otp-box {
    width: 42px;
    height: 50px;
    font-size: 20px;
  }
}
