:root {
  --auth-purple: #764ba2;
  --auth-pink: #ec4899;
  --auth-ink: #1f2937;
  --auth-muted: #6b7280;
  --auth-border: #e5e7eb;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body.auth-body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--auth-ink);
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: #08040e;
}
a { color: inherit; }
button, input { font: inherit; }
.auth-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 40px 20px;
  background: linear-gradient(180deg, #000 0%, #1a0a2e 25%, #5b21b6 55%, #7c3aed 75%, #000 100%);
  background-size: 100% 100%;
  background-attachment: fixed;
}
.auth-page::before,
.auth-page::after {
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  content: "";
  filter: blur(75px);
  pointer-events: none;
}
.auth-page::before { top: -170px; right: -100px; background: rgba(219,39,119,.3); }
.auth-page::after { bottom: -190px; left: -110px; background: rgba(124,58,237,.38); }
.auth-orb {
  position: absolute;
  z-index: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f0abfc;
  box-shadow: 0 0 25px 8px rgba(232,121,249,.4);
  opacity: .8;
}
.auth-orb-one { top: 18%; left: 18%; }
.auth-orb-two { right: 15%; bottom: 17%; width: 5px; height: 5px; }
.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  padding: 20px 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 25px 60px rgba(0,0,0,.5), 0 0 50px rgba(196,132,252,.2);
  animation: auth-appear .38s ease both;
}
@keyframes auth-appear {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-heading, .auth-state { margin-bottom: 18px; text-align: center; }
.auth-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
  box-shadow: 0 8px 30px rgba(147,51,234,.3);
  font-size: 22px;
}
.auth-icon.success { background: linear-gradient(135deg, #059669, #34d399); }
.auth-icon.error { background: linear-gradient(135deg, #dc2626, #f97316); }
.auth-heading h1, .auth-state h1 {
  margin: 0 0 5px;
  color: #1f2937;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.55;
}
.auth-heading p, .auth-state p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 12px;
  line-height: 1.6;
}
.auth-form { display: grid; gap: 0; }
.auth-field { min-width: 0; margin-bottom: 14px; }
.auth-field label {
  display: block;
  margin-bottom: 4px;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}
.auth-field input {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  outline: none;
  color: #1f2937;
  background: #fff;
  font-size: 13px;
  text-align: left;
  transition: border-color .2s, box-shadow .2s;
}
.auth-field input[dir="rtl"] { text-align: right; }
.auth-field input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102,126,234,.12);
}
.auth-field input::placeholder { color: #9ca3af; }
.auth-field small { display: block; margin-top: 4px; color: #6b7280; font-size: 10px; }
.auth-optional { color: #9ca3af; font-size: 10px; font-weight: 400; }
.auth-password { position: relative; }
.auth-password input { padding-left: 42px; }
.auth-password button {
  position: absolute;
  top: 50%;
  left: 7px;
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 7px;
  color: #6b7280;
  background: transparent;
  cursor: pointer;
}
.auth-password button:hover { color: var(--auth-purple); background: #f5f3ff; }
.auth-password button svg { width: 18px; height: 18px; }
.auth-phone { display: flex; align-items: center; direction: ltr; }
.auth-phone span {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--auth-border);
  border-right: 0;
  border-radius: 9px 0 0 9px;
  color: #6b7280;
  background: #f9fafb;
  font-size: 12px;
}
.auth-phone input { border-radius: 0 9px 9px 0; }
.auth-note { margin: -1px 0 0; color: #6b7280; font-size: 10px; line-height: 1.8; }
.auth-options { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 14px; }
.auth-method-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin: 0 0 16px;
  border-radius: 11px;
  background: #f3f4f6;
}
.auth-method-switch a {
  padding: 9px 7px;
  border-radius: 8px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.auth-method-switch a[aria-current="page"] {
  color: #6d28d9;
  background: #fff;
  box-shadow: 0 1px 4px rgba(31,41,55,.12);
}
.auth-otp-hint {
  margin: 0 0 13px;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.8;
}
.auth-resend-form { margin-top: 11px; text-align: center; }
.auth-link-button {
  padding: 6px 10px;
  border: 0;
  color: #7c3aed;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.auth-link-button:hover { color: #db2777; text-decoration: underline; }
.auth-options a, .auth-footer a, .auth-home-link {
  color: #7c3aed;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.auth-options a:hover, .auth-footer a:hover, .auth-home-link:hover { color: #db2777; text-decoration: underline; }
.auth-button {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  padding: 14px 24px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(90deg, #764ba2 0%, #9333ea 25%, #ec4899 50%, #9333ea 75%, #764ba2 100%);
  background-size: 400% 100%;
  box-shadow: 0 4px 15px rgba(0,0,0,.2);
  animation: auth-button-gradient 8s ease-in-out infinite;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
@keyframes auth-button-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.auth-button:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(124,58,237,.4); filter: brightness(1.1); }
.auth-button-static { margin-top: 18px; }
.auth-message {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.9;
}
.auth-message.info, .auth-message.success { color: #065f46; border-color: #a7f3d0; background: #ecfdf5; }
.auth-message.error { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.auth-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.8;
  text-align: center;
}
.auth-home-link {
  display: block;
  width: fit-content;
  margin: 17px auto 0;
  color: #6b7280;
  font-weight: 500;
}
.auth-honeypot {
  position: absolute;
  right: 10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.auth-card :focus-visible { outline: 3px solid #a78bfa; outline-offset: 3px; }

@media (max-width: 420px) {
  .auth-page { padding: 20px 13px; }
  .auth-card { padding: 21px 18px 18px; border-radius: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
