@font-face {
  font-family: Dana;
  src: url('/assets/fonts/DanaVF.woff2') format('woff2');
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #09070c;
  --panel: #121016;
  --field: #19161f;
  --line: rgba(255, 255, 255, .09);
  --text: #f6f0f8;
  --muted: #8f8298;
  --accent: #ae4cff;
  --accent-2: #547dff;
  --danger: #ff6578;
  --success: #64dda0;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  direction: rtl;
  font-family: Dana, Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 100%, rgba(103, 51, 176, .18), transparent 35%),
    radial-gradient(circle at 82% 0%, rgba(28, 92, 179, .13), transparent 31%),
    var(--bg);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.auth-shell {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 34px 18px;
  position: relative;
}

.home-link {
  position: fixed;
  inset: 24px 28px auto auto;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  transition: color .2s ease, transform .2s ease;
}

.home-link:hover { color: var(--text); transform: translateX(3px); }

.auth-wrap { width: min(100%, 410px); position: relative; z-index: 1; }

.brand {
  display: grid;
  justify-items: center;
  gap: 13px;
  margin-bottom: 25px;
}

.brand-logo {
  width: 74px;
  height: 74px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.025));
  box-shadow: 0 18px 50px rgba(63, 33, 91, .32), inset 0 1px rgba(255,255,255,.06);
}

.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand h1 { margin: 0; font-size: 27px; letter-spacing: -.8px; }
.brand p { margin: -5px 0 0; color: var(--muted); font-size: 12px; }

.auth-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  background: linear-gradient(155deg, rgba(19, 16, 23, .98), rgba(13, 11, 16, .98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .34), inset 0 1px rgba(255,255,255,.025);
}

.card-heading { margin-bottom: 21px; }
.card-heading h2 { margin: 0 0 6px; font-size: 18px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }

.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field label { font-size: 12px; font-weight: 650; color: #ded4e3; }
.field-link { border: 0; padding: 0; background: none; color: #aa9cb2; cursor: pointer; font-size: 11px; }
.field-link:hover { color: var(--text); }

.input-wrap { position: relative; }
.input-wrap input {
  width: 100%;
  height: 48px;
  border: 1px solid #302a39;
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: var(--field);
  padding: 0 15px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.input-wrap input:focus {
  border-color: rgba(174, 76, 255, .65);
  background: #1c1822;
  box-shadow: 0 0 0 4px rgba(174, 76, 255, .09);
}

.input-wrap input::placeholder { color: #675d6e; }
.latin-input { direction: ltr; text-align: center; letter-spacing: .6px; }
.code-input { letter-spacing: 11px; font-size: 19px; font-weight: 700; padding-right: 25px !important; }

.password-toggle {
  position: absolute;
  inset: 7px auto 7px 7px;
  width: 36px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  color: #8e8197;
  background: rgba(255,255,255,.035);
}
.password-toggle:hover { color: white; background: rgba(255,255,255,.07); }

.primary-button, .secondary-button {
  width: 100%;
  min-height: 48px;
  border-radius: 13px;
  border: 0;
  cursor: pointer;
  font-weight: 750;
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}

.primary-button {
  color: white;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 34px rgba(135, 63, 229, .23);
}

.primary-button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
.primary-button:disabled { cursor: wait; opacity: .62; }
.secondary-button { color: #cfc3d5; background: rgba(255,255,255,.045); border: 1px solid var(--line); }
.secondary-button:hover:not(:disabled) { background: rgba(255,255,255,.075); }

.form-message {
  display: none;
  margin: 0 0 15px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 11px;
  line-height: 1.7;
}
.form-message.show { display: block; }
.form-message.error { color: #ffb5bf; border-color: rgba(255, 101, 120, .2); background: rgba(255, 101, 120, .08); }
.form-message.success { color: #a9f2ca; border-color: rgba(100, 221, 160, .19); background: rgba(100, 221, 160, .075); }

.auth-switch { margin: 19px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
.auth-switch a { color: #e2d8e7; font-weight: 700; }
.auth-switch a:hover { color: #c77cff; }

.verify-phone {
  direction: ltr;
  display: inline-block;
  color: #d6c9dc;
  font-weight: 700;
}

.resend-row { display: flex; justify-content: space-between; align-items: center; margin: -3px 0 16px; font-size: 11px; color: var(--muted); }
.resend-button { border: 0; background: none; color: #b56aff; padding: 0; cursor: pointer; }
.resend-button:disabled { color: #685e6e; cursor: default; }

.hidden { display: none !important; }

.account-card { text-align: center; }
.account-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 20px;
  color: var(--success);
  background: rgba(100, 221, 160, .09);
  border: 1px solid rgba(100, 221, 160, .16);
  font-size: 27px;
}
.account-phone { direction: ltr; font-size: 20px; margin: 8px 0 24px; }
.account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-left: 8px;
  border: 2px solid rgba(255,255,255,.34);
  border-top-color: white;
  border-radius: 50%;
  vertical-align: -3px;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 540px) {
  .auth-shell { padding: 72px 14px 26px; align-items: start; }
  .home-link { inset: 20px 18px auto auto; }
  .auth-card { padding: 21px 17px; border-radius: 19px; }
  .brand { margin-bottom: 20px; }
  .brand-logo { width: 66px; height: 66px; }
  .brand h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
