/* Auth modal — RTL Persian */
.auth-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-modal-overlay.open {
  display: flex;
}

.auth-modal {
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
  position: relative;
}

.auth-modal-bar {
  height: 4px;
  background: linear-gradient(90deg, #2563EB, #7C3AED, #06B6D4);
  border-radius: 20px 20px 0 0;
}

.auth-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0;
}

.auth-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0F172A;
}

.auth-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: #F1F5F9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.auth-modal-close:hover { background: #E2E8F0; }
.auth-modal-close svg { width: 18px; height: 18px; stroke: #64748B; fill: none; stroke-width: 2; }

.auth-modal-body { padding: 1rem 1.25rem 1.5rem; }

.auth-step { display: none; }
.auth-step.active { display: block; animation: authStepIn 0.3s ease both; }

@keyframes authStepIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.auth-lead {
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-lead h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.auth-lead p {
  font-size: 0.85rem;
  color: #64748B;
  line-height: 1.6;
}

.auth-field { margin-bottom: 0.85rem; }

.auth-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #0F172A;
}

.auth-input {
  width: 100%;
  height: 50px;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  padding: 0 0.9rem;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
  background: #F8FAFC;
}

.auth-input:focus {
  border-color: #2563EB;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.auth-input.error { border-color: #EF4444; background: #FEF2F2; }
.auth-input.ltr { direction: ltr; text-align: right; letter-spacing: 0.05em; }

.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.auth-error {
  display: none;
  font-size: 0.72rem;
  color: #EF4444;
  margin-top: 0.35rem;
}

.auth-error.show { display: block; }

.auth-hint {
  font-size: 0.72rem;
  color: #64748B;
  margin-top: 0.35rem;
}

.auth-btn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.auth-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
}

.auth-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.auth-btn-ghost {
  background: transparent;
  color: #2563EB;
  border: 1.5px solid rgba(37, 99, 235, 0.25);
  margin-top: 0.5rem;
}

.auth-btn-ghost:hover:not(:disabled) {
  background: rgba(37, 99, 235, 0.05);
  box-shadow: none;
}

.auth-terms {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.75rem 0;
  cursor: pointer;
  font-size: 0.75rem;
  color: #64748B;
  line-height: 1.6;
}

.auth-check {
  width: 18px;
  height: 18px;
  border: 2px solid #E2E8F0;
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.2s ease;
}

.auth-check.on {
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  border-color: transparent;
}

.auth-check svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
  fill: none;
  stroke-width: 3;
  opacity: 0;
}

.auth-check.on svg { opacity: 1; }

.auth-phone-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #EFF6FF;
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 100px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #2563EB;
  direction: ltr;
  margin: 0.5rem auto;
}

.auth-otp-boxes {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  direction: ltr;
  margin: 0.75rem 0;
}

.auth-otp-inp {
  width: 44px;
  height: 52px;
  text-align: center;
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  border: 2px solid #E2E8F0;
  border-radius: 11px;
  outline: none;
  background: #F8FAFC;
  transition: all 0.2s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}

.auth-otp-inp:focus {
  border-color: #2563EB;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.auth-otp-inp.filled { border-color: #7C3AED; color: #7C3AED; }
.auth-otp-inp.err { border-color: #EF4444; animation: authShake 0.35s ease; }

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.auth-timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.78rem;
  color: #64748B;
}

.auth-resend {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2563EB;
  cursor: pointer;
  padding: 0;
}

.auth-resend:disabled { color: #94A3B8; cursor: default; }

.auth-spin {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
}

@keyframes authSpin { to { transform: rotate(360deg); } }

/* Toast */
.auth-toast-wrap {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(92vw, 380px);
  pointer-events: none;
}

.auth-toast {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
  animation: toastIn 0.3s ease both;
  pointer-events: auto;
}

.auth-toast.success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.auth-toast.error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.auth-toast.info { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .auth-row { grid-template-columns: 1fr; }
  .auth-otp-inp { width: 40px; height: 48px; font-size: 1.2rem; }
}

.auth-debug-otp {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #FFFBEB;
  border: 1.5px dashed #F59E0B;
  text-align: center;
}

.auth-debug-label {
  display: block;
  font-size: 0.75rem;
  color: #92400E;
  margin-bottom: 0.35rem;
}

.auth-debug-code {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: #B45309;
  direction: ltr;
  display: inline-block;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  font-family: inherit;
}

.auth-debug-code:hover {
  background: rgba(245, 158, 11, 0.15);
}

.auth-birth-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.auth-birth-select {
  min-height: 48px;
  padding: 0.55rem 0.45rem;
  font-size: 16px;
  appearance: auto;
  -webkit-appearance: menulist;
  background-color: #F8FAFC;
  cursor: pointer;
}

.auth-birth-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
