/* ========== Auth / Profile login — ایوان کالا ========== */
:root {
  --auth-red: #ef394e;
  --auth-red-dark: #d92d42;
  --auth-text: #0c0c0c;
  --auth-muted: #81858b;
  --auth-border: #e0e0e2;
  --auth-bg: #f5f5f5;
  --auth-blue: #19bfd3;
  --font: "Yekan Bakh", "YekanBakh", Estedad, Vazirmatn, Tahoma, sans-serif;
}

.auth-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--auth-bg);
  color: var(--auth-text);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
}
.auth-page .site-footer {
  position: relative;
  z-index: 1;
  margin-top: 24px;
}
@media (min-width: 1024px) {
  .auth-page { padding-bottom: 24px; }
}

.auth-page a,
.auth-page button,
.auth-page input {
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.ti-icon--arrow-right { --ti: url("icons/tabler/arrow-right.svg"); }

/* پس‌زمینه نرم متحرک */
.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.auth-bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: authOrb 12s ease-in-out infinite alternate;
}
.auth-bg__orb--a {
  width: 280px;
  height: 280px;
  background: rgba(239, 57, 78, 0.28);
  top: -60px;
  right: -40px;
}
.auth-bg__orb--b {
  width: 220px;
  height: 220px;
  background: rgba(25, 191, 211, 0.22);
  bottom: 10%;
  left: -50px;
  animation-delay: -4s;
}
.auth-bg__orb--c {
  width: 180px;
  height: 180px;
  background: rgba(107, 58, 168, 0.18);
  top: 42%;
  left: 40%;
  animation-delay: -7s;
}
@keyframes authOrb {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(18px, 24px, 0) scale(1.12); }
}

.auth-page .header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.auth {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 130px);
  min-height: calc(100dvh - 130px);
  display: grid;
  place-items: center;
  padding: 20px 16px calc(112px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 1024px) {
  .auth {
    min-height: calc(100dvh - 160px);
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

.auth-card {
  width: min(400px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(224, 224, 226, 0.9);
  border-radius: 18px;
  padding: 22px 20px 24px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 18px 48px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
  animation: authCardIn 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-card__head {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: 12px;
}
.auth-card__head:has(.auth-back[hidden]) {
  min-height: 0;
  margin-bottom: 0;
}

.auth-back {
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #0c0c0c;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.auth-back:hover { background: #f2f3f5; }
.auth-back:active { transform: translateY(-50%) scale(0.94); }
.auth-back .ti-icon {
  width: 22px;
  height: 22px;
  font-size: 22px;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  line-height: 0;
}
.auth-logo .header__logo-sq {
  width: 48px;
  height: 48px;
  box-shadow: 0 1px 2px rgba(239, 57, 78, 0.25);
}
.auth-logo__name {
  color: var(--auth-red);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.auth-step {
  display: none;
}
.auth-step.is-active {
  display: block;
  animation: authStepIn 0.45s cubic-bezier(0.22, 1.15, 0.36, 1) both;
}
.auth-step.is-leaving {
  display: block;
  animation: authStepOut 0.28s ease forwards;
}
@keyframes authStepIn {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes authStepOut {
  to {
    opacity: 0;
    transform: translateX(14px);
  }
}

.auth-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--auth-text);
  line-height: 1.5;
}
.auth-sub {
  margin: 0 0 22px;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.7;
}

.auth-field {
  display: block;
  margin-bottom: 18px;
}
.auth-field__label {
  display: block;
  margin-bottom: 8px;
  color: #424750;
  font-size: 12px;
  font-weight: 600;
}
.auth-field__box {
  position: relative;
  border: 1.5px solid var(--auth-border);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.auth-field__box:focus-within {
  border-color: var(--auth-red);
  box-shadow: 0 0 0 4px rgba(239, 57, 78, 0.12);
}
.auth-field.is-invalid .auth-field__box {
  border-color: var(--auth-red);
  animation: authShake 0.4s ease;
}
@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
}

.auth-input {
  width: 100%;
  height: 48px;
  border: 0;
  background: transparent;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--auth-text);
  outline: none;
  letter-spacing: 0.04em;
}
.auth-input::placeholder {
  color: #c0c2c5;
  font-weight: 500;
  letter-spacing: 0;
}

.auth-field__hint {
  display: block;
  margin-top: 8px;
  color: var(--auth-red);
  font-size: 12px;
  font-weight: 600;
}
.auth-field__hint[hidden] {
  display: none !important;
}
.auth-field__hint--center {
  text-align: center;
}

.auth-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--auth-red) 0%, #ff5a6d 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(239, 57, 78, 0.28);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.auth-btn:hover:not(:disabled) {
  filter: brightness(1.03);
  box-shadow: 0 12px 26px rgba(239, 57, 78, 0.34);
}
.auth-btn:active:not(:disabled) {
  transform: scale(0.985);
}
.auth-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.auth-btn__text {
  position: relative;
  z-index: 1;
}
.auth-btn__shine {
  position: absolute;
  inset: 0 auto 0 -40%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  animation: authShine 2.8s ease-in-out infinite;
}
@keyframes authShine {
  0%, 40% { left: -40%; }
  70%, 100% { left: 120%; }
}
.auth-btn.is-loading .auth-btn__text {
  opacity: 0.85;
}

.auth-legal {
  margin: 18px 0 0;
  text-align: center;
  color: var(--auth-muted);
  font-size: 11.5px;
  line-height: 1.8;
}
.auth-legal a {
  color: var(--auth-blue);
  font-weight: 600;
}

/* OTP */
.otp {
  display: flex;
  justify-content: center;
  gap: 8px;
  direction: ltr;
  margin: 4px 0 10px;
}
.otp__cell {
  width: 48px;
  height: 56px;
  border: 1.5px solid var(--auth-border);
  border-radius: 12px;
  background: #fff;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--auth-text);
  outline: none;
  caret-color: var(--auth-red);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
  animation: otpCellIn 0.45s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
.otp__cell:nth-child(1) { animation-delay: 0.04s; }
.otp__cell:nth-child(2) { animation-delay: 0.1s; }
.otp__cell:nth-child(3) { animation-delay: 0.16s; }
.otp__cell:nth-child(4) { animation-delay: 0.22s; }
@keyframes otpCellIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.otp__cell:focus {
  border-color: var(--auth-red);
  box-shadow: 0 0 0 4px rgba(239, 57, 78, 0.14);
  transform: translateY(-2px);
}
.otp__cell.is-filled {
  background: #fff7f8;
  border-color: #ffb3bd;
  animation: otpPop 0.28s cubic-bezier(0.22, 1.4, 0.36, 1);
}
@keyframes otpPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.otp.is-wrong .otp__cell {
  border-color: var(--auth-red);
  animation: authShake 0.4s ease;
}
.otp.is-ok .otp__cell {
  border-color: #00a049;
  background: #e9f8ef;
  color: #007a37;
  box-shadow: 0 0 0 4px rgba(0, 160, 73, 0.16);
  animation: otpOkPop 0.45s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}
.otp.is-ok .otp__cell:nth-child(1) { animation-delay: 0.02s; }
.otp.is-ok .otp__cell:nth-child(2) { animation-delay: 0.07s; }
.otp.is-ok .otp__cell:nth-child(3) { animation-delay: 0.12s; }
.otp.is-ok .otp__cell:nth-child(4) { animation-delay: 0.17s; }
.otp.is-ok .otp__cell:focus {
  border-color: #00a049;
  box-shadow: 0 0 0 4px rgba(0, 160, 73, 0.2);
}
@keyframes otpOkPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.otp-meta {
  min-height: 28px;
  margin: 8px 0 18px;
  text-align: center;
}
.otp-timer {
  margin: 0;
  color: var(--auth-muted);
  font-size: 12.5px;
  font-weight: 600;
}
.otp-resend {
  border: 0;
  background: transparent;
  color: var(--auth-blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.otp-resend:hover {
  background: rgba(25, 191, 211, 0.1);
}

@media (max-width: 420px) {
  .auth-card {
    padding: 18px 16px 20px;
    border-radius: 16px;
  }
  .otp__cell {
    width: 44px;
    height: 52px;
    font-size: 20px;
  }
  .auth-title {
    font-size: 16px;
  }
}

/* مرحله نام — اولین ثبت‌نام */
.auth-title--center,
.auth-sub--center {
  text-align: center;
}
.auth-name-hero {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 4px auto 18px;
  display: grid;
  place-items: center;
}
.auth-name-hero__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(239, 57, 78, 0.28);
  animation: authNameRing 2.4s ease-out infinite;
}
.auth-name-hero__ring--2 {
  animation-delay: 0.85s;
}
.auth-name-hero__face {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 28%, #fff 0%, transparent 42%),
    linear-gradient(145deg, #ef394e 0%, #ff6b5b 100%);
  box-shadow: 0 12px 28px rgba(239, 57, 78, 0.28);
  animation: authNamePop 0.7s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
.auth-name-hero__face .ti-icon {
  width: 28px;
  height: 28px;
  background: #fff;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.auth-input--name {
  letter-spacing: 0;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
}
@keyframes authNameRing {
  0% {
    transform: scale(0.72);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}
@keyframes authNamePop {
  from {
    opacity: 0;
    transform: scale(0.6) translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-step.is-active,
  .otp__cell,
  .auth-bg__orb,
  .auth-btn__shine,
  .auth-name-hero__ring,
  .auth-name-hero__face {
    animation: none !important;
  }
}
