/* ============================================================
   SINOX API — AUTH.CSS
   استایل صفحه‌ی ورود/ثبت‌نام. وابسته به tokens.css، base.css و
   components.css (همیشه بعد از آن‌ها لود شود). فقط شامل چیدمان و
   جزئیات مخصوص همین دو صفحه — کامپوننت‌های عمومی (فیلد، دکمه، مودال،
   کپچا، چک‌باکس، سنجه‌ی قدرت رمز) از components.css می‌آیند.
   ============================================================ */

/* ---------- ۱. اسکلت صفحه (چیدمان چسبان: هدر / محتوا / فوتر) ----------
   هدر و فوتر توسط chrome.js پر می‌شوند؛ اینجا فقط چیدمانِ بیرونی تعریف
   می‌شود تا محتوا صرف‌نظر از ارتفاع واقعی هدر/فوتر کل صفحه را پر کند. */
body[data-page="auth"] {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body[data-page="auth"] > header,
body[data-page="auth"] > footer {
  flex-shrink: 0;
}

/* ---------- ۲. اسکلت دو‌ستونه ---------- */
.auth-shell {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

/* ستون فرم — راست در RTL (فرزند اول) */
.auth-formside {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
}

.auth-card { width: 100%; max-width: 400px; }

.auth-logo-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xl);
  background: var(--grad-logo);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  box-shadow: var(--glow-primary-sm);
}

.auth-title {
  margin-top: var(--space-5);
  text-align: center;
  font-size: clamp(22px, 2.4vw + 14px, 28px);
  font-weight: var(--fw-black);
  line-height: var(--lh-heading);
}
.auth-subtitle {
  margin-top: 10px;
  text-align: center;
  font-size: var(--fs-md);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-top: var(--space-8);
}

.auth-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.auth-switch {
  margin-top: var(--space-5);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.auth-switch a { font-weight: var(--fw-bold); color: var(--primary-light); }

/* دکمه‌ی ارسال — عرض/ارتفاع ثابت، حالت بارگذاری با btn-loading (اسپینر
   روی‌هم، متن بدون جابه‌جایی چیدمان محو می‌شود) */
.auth-submit { margin-top: 4px; }
.auth-submit .btn-label { display: inline-flex; align-items: center; }

/* دکمه‌ی چشم نمایش/مخفی رمز — داخل input-wrap */
.pw-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
}
.pw-toggle:hover { color: var(--text-1); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* لینک «فراموشی رمز عبور؟» به‌صورت دکمه‌ی بدون‌قاب */
.auth-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--primary-light);
  cursor: pointer;
}
.auth-link-btn:hover { color: var(--primary-lighter); }
.auth-link-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-xs); }

/* components.css به‌طور پیش‌فرض روی .field-error/.field-success/.pw-strength
   یک display غیر از none می‌گذارد — این یعنی وقتی این عنصرها ویژگی HTML
   «hidden» می‌گیرند، باید صراحتاً پنهان شوند (استایل نویسنده روی استایل
   پیش‌فرض مرورگر برای [hidden] اولویت دارد). */
.field-error[hidden],
.field-success[hidden],
.pw-strength[hidden] { display: none; }

/* حالت خطا روی ردیف کپچا (خودِ components.css فقط input-wrap را می‌شناسد) */
.captcha-row.is-error .captcha-question,
.captcha-row.is-error .input-wrap { border-color: var(--red); }

/* چرخش آیکون تازه‌سازی کپچا هنگام کلیک */
.captcha-refresh.is-spinning svg { animation: sx-spin 0.6s linear; }

/* ---------- ۳. پنل برند (فقط دسکتاپ) ---------- */
.auth-brandside {
  position: relative;
  overflow: hidden;
  border-inline-start: 1px solid var(--border-1);
  padding: var(--space-16) var(--space-10);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(99, 102, 241, 0.18), transparent 62%),
    radial-gradient(520px 380px at 90% 85%, rgba(6, 182, 212, 0.13), transparent 62%),
    #0a0a18;
}
.auth-brandside::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(232, 232, 245, 0.13) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(circle at 40% 40%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 40% 40%, #000 0%, transparent 72%);
  opacity: 0.55;
  pointer-events: none;
}

.auth-brand-inner { position: relative; max-width: 460px; }

.auth-brand-headline {
  font-size: clamp(26px, 2.2vw + 16px, 38px);
  font-weight: var(--fw-black);
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.auth-brand-headline .mono-accent {
  direction: ltr;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--cyan);
}

.auth-brand-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: var(--space-8);
  list-style: none;
  padding: 0;
}
.auth-brand-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15.5px;
  color: var(--text-2);
}
.auth-brand-list .ic { color: var(--green); flex-shrink: 0; }

/* قطعه‌کد کوچک (بدون titlebar — نسخه‌ی فشرده‌ی code-window) */
.auth-code-mini {
  margin-top: var(--space-10);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-xl);
  background: var(--bg2);
  padding: 18px 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 2.1;
  direction: ltr;
  text-align: left;
  display: grid;
  grid-template-columns: 40px 1fr;
}
.auth-code-mini .ln {
  color: var(--text-faint);
  text-align: right;
  padding-inline-end: 12px;
  user-select: none;
}
.auth-code-mini .code { padding-inline-start: 16px; white-space: pre; color: var(--text-2); }

/* ---------- ۴. مودال بازیابی رمز ---------- */
.auth-forgot-step p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  margin-bottom: var(--space-4);
}
.auth-forgot-step .field + .field { margin-top: var(--space-4); }
.auth-forgot-step .btn { margin-top: var(--space-5); }

#forgotMsg {
  margin-top: var(--space-4);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
#forgotMsg.field-success,
#forgotMsg.field-error { font-size: var(--fs-sm); }

/* ---------- ۵. توست ساده (app.js #toast — سازگار با ظاهر سیستم طراحی) ---------- */
#toast {
  position: fixed;
  bottom: var(--space-6);
  inset-inline: 0;
  z-index: var(--z-toast);
  margin-inline: auto;
  width: fit-content;
  max-width: min(380px, calc(100vw - var(--space-8)));
  padding: 14px 22px;
  border-radius: var(--radius-xl);
  background: var(--elev-3);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-pop);
  color: var(--text-1);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  text-align: center;
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
#toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#toast.error { border-color: var(--red-border-tint); color: var(--red-light); }
#toast.success { border-color: var(--green-border-tint); }

/* ---------- ۶. واکنش‌گرا ---------- */
@media (max-width: 959px) {
  .auth-brandside { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-formside { padding: var(--space-10) var(--space-4); }
}
@media (max-width: 420px) {
  .auth-formside { padding-inline: var(--space-3); }
}
