/* ==========================================================================
   ورود و ثبت‌نام با شمارهٔ همراه
   ========================================================================== */

.auth-page {
  min-height: calc(100vh - 106px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 72px;
  background: var(--gray-section);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 470px;
  padding: 40px 36px 32px;
  border-radius: 24px 0 24px 0;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.1);
}
html[data-theme="dark"] .auth-card { background: #1c1c1c; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }

.auth-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 20px 0 20px 0;
  background: var(--primary);
  box-shadow: 0 12px 26px rgba(239, 90, 60, 0.28);
}
.auth-badge svg { width: 30px; height: 30px; }

.auth-title {
  font-family: "Meem", serif;
  font-size: 26px;
  line-height: 38px;
  font-weight: 700;
  text-align: center;
  color: var(--heading);
}
.auth-lead {
  margin-top: 8px;
  font-size: 15px;
  line-height: 26px;
  font-weight: 400;
  text-align: center;
  color: var(--muted);
}
.auth-lead b { font-family: "YekanBakh-FaNum", serif; color: var(--text); font-weight: 600; }

.auth-step { display: none; margin-top: 26px; }
.auth-step.is-active { display: block; }

.auth-field { margin-bottom: 16px; }
.auth-field > label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.auth-input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1.5px solid #dcdcdc;
  border-radius: 12px;
  background: var(--page-bg);
  color: var(--text);
  font-family: "YekanBakh-FaNum", serif;
  font-size: 16px;
  font-weight: 500;
  transition: border-color 0.2s, box-shadow 0.2s;
}
html[data-theme="dark"] .auth-input { border-color: #3a3a3a; background: #232323; }
.auth-input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(239, 90, 60, 0.12);
}
.auth-input::placeholder { color: #b3b3b3; font-weight: 400; }
.auth-input[type="tel"], .auth-input.ltr { direction: ltr; text-align: right; }
textarea.auth-input { height: 92px; padding: 12px 16px; resize: vertical; line-height: 26px; }

/* -- کپچا: ورودی، تصویر و دکمهٔ تازه‌سازی در یک ردیف -- */
.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.captcha-row .auth-input { flex: 1; min-width: 0; }
.captcha-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 170px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 12px;
  overflow: hidden;
  /* تصویر روی زمینهٔ روشن ساخته می‌شود، پس در تم تیره هم همان می‌ماند */
  background: #f3f3f3;
}
.captcha-image svg { width: 100%; height: 100%; }
.captcha-loading { color: #8a8a8a; font-size: 13px; }
.captcha-reload {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1.5px solid #dcdcdc;
  border-radius: 12px;
  background: var(--page-bg);
  color: var(--primary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.captcha-reload:hover { border-color: var(--primary); transform: rotate(90deg); }

@media (max-width: 420px) {
  /* در عرض کم، تصویر زیر ورودی می‌رود تا هیچ‌کدام له نشوند */
  .captcha-row { flex-wrap: wrap; }
  .captcha-row .auth-input { flex: 1 1 100%; }
  .captcha-image { flex: 1 1 auto; width: auto; }
}

/* -- کد تأیید: چهار خانهٔ جدا -- */
.otp-boxes {
  display: flex;
  /* رقم اول سمت چپ؛ مثل خودِ کد که چپ‌به‌راست خوانده می‌شود */
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  direction: ltr;
}
.otp-boxes input {
  width: 56px;
  height: 62px;
  padding: 0;
  border: 1.5px solid #dcdcdc;
  border-radius: 12px;
  background: var(--page-bg);
  color: var(--heading);
  font-family: "YekanBakh-FaNum", serif;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
html[data-theme="dark"] .otp-boxes input { border-color: #3a3a3a; background: #232323; }
.otp-boxes input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(239, 90, 60, 0.12);
}

/* -- ردیف کد ملی با دکمهٔ + -- */
.code-row { display: flex; gap: 8px; margin-bottom: 10px; }
.code-row .auth-input { flex: 1 1 auto; }
.code-btn {
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-size: 24px;
  line-height: 1;
  transition: filter 0.2s, background-color 0.2s;
}
.code-btn.add { background: var(--primary); color: #fff; }
.code-btn.remove { background: rgba(239, 90, 60, 0.1); color: var(--primary); border-color: rgba(239, 90, 60, 0.25); }
.code-btn:hover { filter: brightness(1.06); }

.auth-submit {
  width: 100%;
  height: 56px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 12px 26px rgba(239, 90, 60, 0.24);
  transition: transform 0.2s, filter 0.2s;
}
.auth-submit:hover:not(:disabled) { transform: translateY(-2px); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

.auth-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}
.auth-link {
  color: var(--primary);
  font-weight: 600;
  background: none;
  padding: 0;
}
.auth-link:disabled { color: var(--muted); font-weight: 400; cursor: default; }
.auth-timer { font-family: "YekanBakh-FaNum", serif; font-weight: 600; color: var(--text); }

.auth-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
  font-size: 13px;
  line-height: 24px;
  text-align: center;
  color: var(--muted);
}
html[data-theme="dark"] .auth-note { border-top-color: rgba(255, 255, 255, 0.08); }

.auth-alert {
  display: none;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 24px;
}
.auth-alert.is-shown { display: block; }
.auth-alert.error { background: rgba(214, 42, 42, 0.1); color: #c62828; }
.auth-alert.info { background: rgba(239, 90, 60, 0.1); color: var(--primary); }
.auth-alert.success { background: rgba(28, 145, 78, 0.1); color: #1c914e; }

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--muted);
  background: none;
  padding: 0;
}
.auth-back:hover { color: var(--primary); }


@media (max-width: 520px) {
  .auth-card { padding: 32px 20px 26px; border-radius: 20px 0 20px 0; }
  .otp-boxes input { width: 48px; height: 56px; font-size: 21px; }
}
