/* ============================================================
   صفحات احراز هویت — ورود / ثبت‌نام / بازیابی رمز
   طرح: دوستونه (فرم + پنل برندینگ) با تم مشکی-طلایی سایت
   دو تم دارک (پیش‌فرض) و لایت — سوییچ با data-theme روی <html>
   ============================================================ */

/* ---------- توکن‌های تم احراز هویت ---------- */
:root[data-theme="dark"] {
  --au-bg: #0a0a0a;
  --au-bg-glow: rgba(212, 175, 55, 0.07);
  --au-card: #161511;
  --au-card-2: #1d1b15;
  --au-input: #1e1b14;
  --au-border: #2e2a20;
  --au-border-2: #3b3527;
  --au-text: #f2efe6;
  --au-text-2: #b7b1a1;
  --au-text-3: #8a8474;
  --au-btn-text: #241b00;
  --au-btn-grad: linear-gradient(135deg, #f6d878 0%, #f2c94c 38%, #d4af37 72%, #b8952f 100%);
  --au-btn-grad-hover: linear-gradient(135deg, #fbe49a 0%, #f7d766 38%, #e2bd45 72%, #c6a033 100%);
  --au-link: #e8b93e;
  --au-link-hover: #f2c94c;
  --au-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  --au-shadow-soft: 0 10px 34px rgba(0, 0, 0, 0.45);
  --au-error: #ff6b62;
  --au-error-bg: rgba(229, 83, 75, 0.12);
  --au-info: #5b9dd9;
  --au-info-bg: rgba(91, 157, 217, 0.12);
  --au-success: #34c77b;
  --au-tab-bg: rgba(255, 255, 255, 0.03);
  --au-pill-bg: #1d1b15;
  --au-brand-bg: #0d0b07;
  --au-step-line: #332c1f;
}

:root[data-theme="light"] {
  --au-bg: #f6f1e7;
  --au-bg-glow: rgba(217, 119, 6, 0.08);
  --au-card: #ffffff;
  --au-card-2: #faf7f0;
  --au-input: #f3f4f6;
  --au-border: #e5e1d6;
  --au-border-2: #d6d0c0;
  --au-text: #1f2937;
  --au-text-2: #57534e;
  --au-text-3: #8a8577;
  --au-btn-text: #231400;
  --au-btn-grad: linear-gradient(135deg, #fbbf24 0%, #f59e0b 45%, #d97706 100%);
  --au-btn-grad-hover: linear-gradient(135deg, #fcc63a 0%, #f7a91e 45%, #e08207 100%);
  --au-link: #c26a03;
  --au-link-hover: #d97706;
  --au-shadow: 0 24px 60px rgba(120, 100, 40, 0.18);
  --au-shadow-soft: 0 8px 26px rgba(120, 100, 40, 0.12);
  --au-error: #c0392b;
  --au-error-bg: rgba(192, 57, 43, 0.09);
  --au-info: #2563eb;
  --au-info-bg: rgba(37, 99, 235, 0.09);
  --au-success: #15803d;
  --au-tab-bg: rgba(31, 41, 55, 0.04);
  --au-pill-bg: #ffffff;
  --au-brand-bg: #14100a;
  --au-step-line: #e2dccd;
}

/* ---------- پوسته صفحه ---------- */
body.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 18% 8%, var(--au-bg-glow), transparent 60%),
    radial-gradient(700px 420px at 8% 92%, var(--au-bg-glow), transparent 55%),
    var(--au-bg);
  color: var(--au-text);
}

.auth-split {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* در RTL اولین ستون سمت راست است: پنل برندینگ راست، فرم چپ (مطابق طرح) */
.auth-form-side {
  order: 2;
  display: flex;
  flex-direction: column;
  padding: 26px clamp(20px, 4vw, 56px) 34px;
  position: relative;
}

.auth-brand-side {
  order: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px clamp(28px, 4vw, 64px);
  background:
    radial-gradient(720px 420px at 50% 18%, rgba(212, 175, 55, 0.16), transparent 62%),
    radial-gradient(560px 560px at 85% 90%, rgba(212, 175, 55, 0.08), transparent 60%),
    var(--au-brand-bg);
  border-inline-start: 1px solid rgba(212, 175, 55, 0.16);
}

/* موج‌های تزئینی کف پنل برندینگ */
.auth-brand-side::before,
.auth-brand-side::after {
  content: "";
  position: absolute;
  inset-inline-start: -30%;
  inset-inline-end: -30%;
  height: 210px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.1);
  pointer-events: none;
}
.auth-brand-side::before { bottom: -120px; }
.auth-brand-side::after { bottom: -170px; border-color: rgba(212, 175, 55, 0.06); }

.brand-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 26px;
}

/* دایره طلایی با آیکون سکه — مطابق طرح */
.brand-orb {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 32% 28%, #f6d878, #f2c94c 34%, #d4af37 62%, #9a7a24 100%);
  box-shadow:
    0 0 0 14px rgba(212, 175, 55, 0.08),
    0 0 0 28px rgba(212, 175, 55, 0.04),
    0 26px 60px rgba(212, 175, 55, 0.28);
  animation: orb-float 7s ease-in-out infinite;
}
.brand-orb svg { width: 84px; height: 84px; }
@keyframes orb-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.brand-title {
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 900;
  background: linear-gradient(120deg, #f6d878, #f2c94c 40%, #d4af37 75%, #a8842a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.6;
}

.brand-desc {
  color: #d9d2bd;
  font-size: 15px;
  line-height: 2.1;
  max-width: 420px;
}

.brand-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  margin-top: 8px;
}
.brand-stat {
  border: 1px solid rgba(212, 175, 55, 0.18);
  background: rgba(212, 175, 55, 0.05);
  border-radius: 16px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.brand-stat b {
  font-size: 21px;
  font-weight: 900;
  color: #f2c94c;
}
.brand-stat span { font-size: 12.5px; color: #b7b1a1; }

.brand-foot {
  margin-top: 10px;
  font-size: 12px;
  color: #8a8474;
  letter-spacing: 0.3px;
}

/* ---------- نوار بالای سمت فرم ---------- */
.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
}

.auth-brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: var(--au-text);
}
.auth-brand-mini .coin-dot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 32% 28%, #f6d878, #f2c94c 36%, #d4af37 68%, #9a7a24 100%);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.35);
}
.auth-brand-mini .coin-dot svg { width: 24px; height: 24px; }

.auth-topbar-actions { display: flex; align-items: center; gap: 10px; }

/* دکمه گرد سوییچ تم — ماه/خورشید */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--au-border);
  background: var(--au-card);
  color: var(--au-text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: var(--au-shadow-soft);
}
.theme-toggle:hover {
  color: var(--au-link);
  border-color: var(--au-link);
  transform: rotate(12deg);
}
.theme-toggle svg { width: 21px; height: 21px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* قرص پشتیبانی با دکمه بستن — مطابق طرح */
.support-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--au-pill-bg);
  border: 1px solid var(--au-border);
  border-radius: 999px;
  padding: 9px 12px 9px 9px;
  font-size: 13px;
  color: var(--au-text-2);
  box-shadow: var(--au-shadow-soft);
  transition: all 0.2s ease;
}
.support-pill:hover { color: var(--au-link); border-color: var(--au-link); }
.support-pill svg { width: 16px; height: 16px; }
.support-pill .pill-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--au-text-3);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.support-pill .pill-close:hover { background: var(--au-error-bg); color: var(--au-error); }
.support-pill .pill-close svg { width: 13px; height: 13px; }
.support-pill.dismissed { display: none; }

/* ---------- کارت فرم ---------- */
.auth-card-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 470px;
  background: var(--au-card);
  border: 1px solid var(--au-border);
  border-radius: 24px;
  padding: clamp(24px, 3vw, 38px);
  box-shadow: var(--au-shadow);
}

.auth-card-head { margin-bottom: 22px; }
.auth-card-head h1 {
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 800;
  color: var(--au-text);
}
.auth-card-head p {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--au-text-2);
  line-height: 2;
}

/* ---------- تب‌ها ---------- */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--au-tab-bg);
  border: 1px solid var(--au-border);
  border-radius: 16px;
  padding: 6px;
  margin-bottom: 24px;
}
.auth-tab {
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 11px 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--au-text-3);
  cursor: pointer;
  transition: all 0.22s ease;
  font-family: inherit;
}
.auth-tab:hover { color: var(--au-text-2); }
.auth-tab.active {
  background: var(--au-card);
  color: var(--au-link);
  box-shadow: var(--au-shadow-soft);
  border: 1px solid var(--au-border-2);
}
.auth-tab.active::after {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  margin: 7px auto 0;
  border-radius: 99px;
  background: var(--au-btn-grad);
}
.auth-tab:not(.active)::after {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  margin: 7px auto 0;
  border-radius: 99px;
  background: transparent;
}

/* ---------- فیلدها ---------- */
.auth-field { margin-bottom: 18px; }
.auth-field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--au-text-2);
  margin-bottom: 8px;
}
.auth-field label .req { color: var(--au-link); }

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-wrap input {
  width: 100%;
  background: var(--au-input);
  border: 1.5px solid var(--au-border);
  border-radius: 13px;
  padding: 13px 46px 13px 46px;
  font-size: 15px;
  color: var(--au-text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: inherit;
}
.auth-input-wrap input::placeholder { color: var(--au-text-3); }
.auth-input-wrap input:focus {
  border-color: var(--au-link);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.13);
}
.auth-input-wrap input.invalid {
  border-color: var(--au-error);
  box-shadow: 0 0 0 4px var(--au-error-bg);
}
.auth-input-wrap input.ltr { direction: ltr; text-align: left; letter-spacing: 0.4px; }

.field-icon {
  position: absolute;
  inset-inline-end: 15px;
  width: 19px;
  height: 19px;
  color: var(--au-text-3);
  pointer-events: none;
}
.auth-input-wrap input:focus ~ .field-icon { color: var(--au-link); }

/* دکمه چشم نمایش رمز */
.pw-toggle {
  position: absolute;
  inset-inline-start: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--au-text-3);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pw-toggle:hover { color: var(--au-link); background: var(--au-tab-bg); }
.pw-toggle svg { width: 18px; height: 18px; }

.field-error {
  display: none;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--au-error);
  line-height: 1.9;
}
.field-error.show { display: block; }

.field-hint {
  margin-top: 7px;
  font-size: 12px;
  color: var(--au-text-3);
  line-height: 1.9;
}

/* ---------- ردیف OTP: اینپوت + دکمه دریافت کد ---------- */
.otp-row { display: flex; gap: 10px; align-items: stretch; }
.otp-row .auth-input-wrap { flex: 1; }
.otp-row .auth-input-wrap input { padding-inline-start: 16px; padding-inline-end: 44px; }

.otp-send {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 13px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--au-btn-text);
  background: var(--au-btn-grad);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}
.otp-send:hover { filter: brightness(1.06); }
.otp-send:active { transform: scale(0.97); }
.otp-send:disabled { filter: grayscale(0.5) brightness(0.75); cursor: not-allowed; }
.otp-send svg { width: 15px; height: 15px; }

.otp-countdown {
  margin-top: 7px;
  font-size: 12px;
  color: var(--au-text-3);
  display: none;
}
.otp-countdown.show { display: block; }
.otp-countdown b { color: var(--au-link); font-weight: 700; }

/* ---------- کپچا ---------- */
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row .auth-input-wrap { flex: 1; }
.captcha-box {
  flex-shrink: 0;
  width: 190px;
  border-radius: 13px;
  overflow: hidden;
  border: 1.5px solid var(--au-border);
  background: #191510;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.captcha-box:hover { border-color: var(--au-link); }
.captcha-box svg { display: block; width: 100%; height: 100%; }
.captcha-box.loading { min-height: 64px; }
.captcha-box.loading::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(212, 175, 55, 0.25);
  border-top-color: #f2c94c;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- نشانگر قوت رمز ---------- */
.strength { margin-top: 10px; }
.strength-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.strength-bars i {
  height: 5px;
  border-radius: 99px;
  background: var(--au-border);
  transition: background 0.25s ease;
}
.strength-label {
  margin-top: 6px;
  font-size: 12px;
  color: var(--au-text-3);
}

/* ---------- پیام‌ها ---------- */
.form-alert {
  display: none;
  border-radius: 13px;
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.9;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.form-alert.show { display: block; }
.form-alert.error { background: var(--au-error-bg); color: var(--au-error); border-color: rgba(229, 83, 75, 0.3); }
.form-alert.info { background: var(--au-info-bg); color: var(--au-info); border-color: rgba(91, 157, 217, 0.3); }
.form-alert.success { background: rgba(52, 199, 123, 0.1); color: var(--au-success); border-color: rgba(52, 199, 123, 0.3); }

/* ---------- دکمه اصلی ---------- */
.btn-auth {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 15px 20px;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--au-btn-text);
  background: var(--au-btn-grad);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.22);
  font-family: inherit;
  margin-top: 4px;
}
.btn-auth svg { width: 19px; height: 19px; }
.btn-auth:hover { filter: brightness(1.07); box-shadow: 0 14px 38px rgba(212, 175, 55, 0.3); }
.btn-auth:active { transform: translateY(1px); }
.btn-auth:disabled { filter: grayscale(0.45) brightness(0.8); cursor: not-allowed; box-shadow: none; }

/* ---------- لینک‌های پایین کارت ---------- */
.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  font-size: 13.5px;
}
.auth-links a { color: var(--au-text-2); transition: color 0.2s ease; }
.auth-links a:hover { color: var(--au-text); }
.auth-links a.accent { color: var(--au-link); font-weight: 700; }
.auth-links a.accent:hover { color: var(--au-link-hover); }
.auth-links.center { justify-content: center; }

/* خط قوانین زیر کارت — مطابق طرح */
.auth-terms {
  text-align: center;
  font-size: 12px;
  color: var(--au-text-3);
  margin-top: 22px;
  line-height: 2;
}
.auth-terms a { color: var(--au-link); }

/* ---------- نشانگر مراحل (بازیابی رمز) ---------- */
.auth-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 30px;
  position: relative;
}
.auth-steps::before {
  content: "";
  position: absolute;
  top: 19px;
  inset-inline: 34px;
  height: 2px;
  background: var(--au-step-line, #332c1f);
  z-index: 0;
}
.auth-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 86px;
}
.auth-step .dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--au-card-2);
  border: 2px solid var(--au-border);
  color: var(--au-text-3);
  font-weight: 800;
  font-size: 14px;
  transition: all 0.3s ease;
}
.auth-step span { font-size: 12px; color: var(--au-text-3); font-weight: 600; }
.auth-step.active .dot {
  background: var(--au-btn-grad);
  border-color: transparent;
  color: var(--au-btn-text);
  box-shadow: 0 8px 22px rgba(212, 175, 55, 0.35);
}
.auth-step.active span { color: var(--au-link); }
.auth-step.done .dot {
  background: rgba(52, 199, 123, 0.14);
  border-color: var(--au-success);
  color: var(--au-success);
}
.auth-step.done span { color: var(--au-success); }

/* بخش‌های چندمرحله‌ای */
.step-section { display: none; }
.step-section.active { display: block; }

/* ---------- موبایل ---------- */
@media (max-width: 980px) {
  .auth-split { grid-template-columns: 1fr; min-height: auto; }
  .auth-brand-side { display: none; }

  /* هدر جمع‌وجور طلایی به‌جای پنل کامل */
  .auth-mobile-banner {
    display: flex !important;
    align-items: center;
    gap: 13px;
    padding: 16px 20px;
    background:
      radial-gradient(420px 160px at 20% 0%, rgba(212, 175, 55, 0.22), transparent 60%),
      var(--au-brand-bg);
    border-bottom: 1px solid rgba(212, 175, 55, 0.16);
  }
  .auth-mobile-banner .coin-dot {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  .auth-mobile-banner .coin-dot svg { width: 25px; height: 25px; }
  .auth-mobile-banner b {
    display: block;
    font-size: 15.5px;
    font-weight: 800;
    background: linear-gradient(120deg, #f6d878, #f2c94c 45%, #d4af37);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .auth-mobile-banner small { display: block; font-size: 11.5px; color: #b7b1a1; }
}
.auth-mobile-banner { display: none; }

@media (max-width: 560px) {
  .auth-form-side { padding: 18px 16px 26px; }
  .auth-card { border-radius: 20px; padding: 22px 18px; }
  .support-pill span.pill-text { display: none; }
  .support-pill { padding: 9px; }
  .otp-send { padding: 0 14px; font-size: 12.5px; }
  /* کپچا در موبایل هم افقی می‌ماند — جعبه جمع‌وجورتر */
  .captcha-row { gap: 8px; }
  .captcha-box { width: 132px; flex-shrink: 0; }
  .auth-links { flex-direction: column; gap: 10px; text-align: center; }
  .auth-steps::before { inset-inline: 42px; }
  .auth-step { width: 74px; }
}

/* ---------- کاهش حرکت برای کاربران حساس ---------- */
@media (prefers-reduced-motion: reduce) {
  .brand-orb { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
