/* ============================================
   چتچی — استایل صفحه ورود
   پالت: سفید صدفی / شیری، با لهجه‌ای آرام
   فونت: YekanBakh
   ============================================ */

/* ---------- فونت‌ها ---------- */
@font-face {
  font-family: 'YekanBakh';
  src: url('/assets/fonts/YekanBakh-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'YekanBakh';
  src: url('/assets/fonts/YekanBakh-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'YekanBakh';
  src: url('/assets/fonts/YekanBakh-ExtraBlack.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}

/* ---------- متغیرها ---------- */
:root {
  /* صدفی / شیری */
  --shell-0:   #FBF8F3;   /* پس‌زمینه اصلی، شیری روشن */
  --shell-1:   #F5F0E8;   /* لایه دوم */
  --pearl:     #FFFEFC;   /* سطح کارت، تقریباً سفید */
  --pearl-edge:#EFE8DC;   /* لبه‌ها */

  /* جوهر و متن */
  --ink:       #2B2722;   /* متن اصلی */
  --ink-soft:  #6B6358;   /* متن کم‌رنگ */
  --ink-faint: #A39A8C;   /* راهنما */

  /* لهجه: سبزآبی آرام مثل عمق صدف */
  --accent:    #1F8A78;
  --accent-700:#176B5D;
  --accent-100:#DCEFEA;
  --accent-tint: rgba(31, 138, 120, 0.08);

  /* وضعیت‌ها */
  --danger:    #C0492F;
  --danger-bg: #FBEDE9;
  --success:   #1F8A78;

  /* اندازه گوشه‌ها */
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-pill: 999px;

  --shadow-soft: 0 1px 2px rgba(43, 39, 34, 0.04),
                 0 8px 24px rgba(43, 39, 34, 0.06);
  --shadow-lift: 0 2px 6px rgba(43, 39, 34, 0.06),
                 0 18px 50px rgba(43, 39, 34, 0.10);
}

/* ---------- پایه ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: 'YekanBakh', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  direction: rtl;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% -10%, var(--pearl) 0%, var(--shell-0) 45%, var(--shell-1) 100%);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* بافت صدفی بسیار ظریف */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 85% 8%, rgba(31,138,120,0.05), transparent 60%),
    radial-gradient(50% 50% at 10% 90%, rgba(192,73,47,0.04), transparent 60%);
  z-index: 0;
}

/* ---------- کارت ---------- */
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--pearl);
  border: 1px solid var(--pearl-edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  padding: 40px 32px 32px;
  overflow: hidden;
}

/* درخشش صدفی بالای کارت */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    transparent, var(--accent-100) 20%, var(--accent) 50%, var(--accent-100) 80%, transparent);
  opacity: 0.7;
}

/* ---------- سربرگ برند ---------- */
.brand {
  text-align: center;
  margin-bottom: 36px;
  margin-top: 8px;
}

.brand__name {
  font-weight: 900;
  font-size: 42px;
  letter-spacing: -0.5px;
  color: var(--ink);
  line-height: 1.1;
}
.brand__tagline {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--ink-faint);
  font-weight: 400;
}

/* ---------- مراحل ---------- */
.step { display: none; }
.step.active { display: block; animation: fade 0.35s ease; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step__title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 6px;
  color: var(--ink);
}
.step__hint {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 24px;
}
.step__hint b { color: var(--ink); font-weight: 700; }

/* ---------- ورودی شماره موبایل ---------- */
.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 700;
}

.phone-input {
  display: flex;
  align-items: stretch;
  background: var(--shell-0);
  border: 1.5px solid var(--pearl-edge);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  direction: ltr;
}
.phone-input:focus-within {
  border-color: var(--accent);
  background: var(--pearl);
  box-shadow: 0 0 0 4px var(--accent-tint);
}
.phone-input__prefix {
  display: grid;
  place-items: center;
  padding: 0 16px;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink-soft);
  background: rgba(43,39,34,0.03);
  border-left: 1.5px solid var(--pearl-edge);
  letter-spacing: 0;
  direction: ltr;
}
.phone-input input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 16px 18px;
  font-family: inherit;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 3px;
  color: var(--ink);
  outline: none;
  text-align: left;
  direction: ltr;
  min-width: 0;
}
.phone-input input::placeholder {
  color: var(--ink-faint);
  letter-spacing: 2px;
  font-weight: 400;
}

/* ---------- ورودی کد تأیید (OTP) ---------- */
.otp {
  display: flex;
  gap: 8px;
  direction: ltr;
  justify-content: center;
  margin-bottom: 20px;
}
.otp input {
  flex: 1 1 0;
  min-width: 0;
  max-width: 52px;
  height: 60px;
  text-align: center;
  font-family: inherit;
  font-weight: 900;
  font-size: 24px;
  color: var(--ink);
  background: var(--shell-0);
  border: 1.5px solid var(--pearl-edge);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, transform 0.18s;
}
.otp input:focus {
  border-color: var(--accent);
  background: var(--pearl);
  box-shadow: 0 0 0 4px var(--accent-tint);
  transform: translateY(-2px);
}
.otp input.filled {
  border-color: var(--accent);
  background: var(--accent-tint);
}

/* ---------- دکمه‌ها ---------- */
.btn {
  width: 100%;
  border: 0;
  border-radius: var(--r-md);
  padding: 16px;
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn--primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-700));
  color: #fff;
  box-shadow: 0 6px 18px rgba(31, 138, 120, 0.30);
}
.btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(31,138,120,0.36); }
.btn--primary:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn__spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn.loading .btn__spinner { display: block; }
.btn.loading .btn__text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- اکشن‌های ثانویه ---------- */
.actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.link-btn {
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  padding: 6px 4px;
  transition: color 0.18s;
}
.link-btn:hover { color: var(--accent-700); }
.link-btn--muted { color: var(--ink-soft); }
.link-btn--muted:hover { color: var(--ink); }
.link-btn:disabled { color: var(--ink-faint); cursor: not-allowed; }

.resend-row {
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}
.resend-row b { color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- پیام‌ها ---------- */
.alert {
  display: none;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 18px;
  line-height: 1.6;
}
.alert.show { display: block; animation: fade 0.25s ease; }
.alert--error   { background: var(--danger-bg); color: var(--danger); }
.alert--success { background: var(--accent-100); color: var(--accent-700); }

/* ---------- پاورقی ---------- */
.foot {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.8;
}
.foot a { color: var(--ink-soft); text-decoration: none; }

/* ============================================
   ریسپانسیو — مخصوص گوشی
   ============================================ */
@media (max-width: 480px) {
  body { padding: 0; align-items: stretch; }

  .card {
    max-width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  }
  .card::before { height: 4px; }

  .brand { margin-bottom: 28px; }
  .brand__name { font-size: 30px; }

  .otp input {
    max-width: 100%;
    height: 56px;
    font-size: 22px;
  }
  .otp { gap: 6px; }

  .phone-input input { font-size: 18px; }
}

@media (max-width: 360px) {
  .otp input { height: 50px; font-size: 19px; }
  .otp { gap: 5px; }
  .phone-input__prefix { padding: 0 12px; font-size: 16px; }
}

/* دسترسی‌پذیری: کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* فوکوس قابل مشاهده برای کیبورد */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
