@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-DemiBold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-50: #fff8ed;
  --brand-100: #ffedd5;
  --brand-500: #fb9414;
  --brand-600: #ec6c07;
  --ink-50: #f7f7f8;
  --ink-100: #ececef;
  --ink-200: #d9d9de;
  --ink-300: #c4c4cc;
  --ink-400: #9696a0;
  --ink-500: #727280;
  --ink-700: #52525b;
  --ink-800: #46464e;
  --ink-900: #38383e;
  --ink-950: #232327;
  --font-sans: "IRANSansX", ui-sans-serif, system-ui, sans-serif;
  --shadow-popup: 0 16px 48px rgb(35 35 39 / 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.7;
  background: rgb(24 24 27 / 0.48);
  color: var(--ink-900);
  direction: rtl;
}

body.standalone {
  background: rgb(24 24 27 / 0.35);
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.popup {
  width: 100%;
  max-width: 26rem;
  background: #fff;
  border-radius: 1rem;
  padding: 1.75rem 1.5rem 1.35rem;
  box-shadow: var(--shadow-popup);
}

.header {
  text-align: right;
}

h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink-950);
  line-height: 1.5;
}

.subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--ink-500);
  line-height: 1.7;
}

.form {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.75rem;
}

.field-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-800);
  text-align: right;
}

.input {
  width: 100%;
  height: 3rem;
  border: 1px solid var(--ink-200);
  border-radius: 0.65rem;
  padding: 0 0.9rem;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-950);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgb(251 148 20 / 0.15);
}

.input::placeholder {
  color: var(--ink-300);
  font-weight: 400;
}

.phone-input {
  direction: ltr;
  text-align: left;
  letter-spacing: 0.02em;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: right;
}

.code-subtitle {
  margin-top: 0.65rem;
}

.otp-timer {
  flex-shrink: 0;
  min-width: 3.6rem;
  height: 1.85rem;
  padding: 0 0.65rem;
  border: 0;
  border-radius: 0.45rem;
  background: #eef3f8;
  color: var(--ink-700);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  direction: ltr;
  cursor: default;
}

.otp-timer:disabled {
  opacity: 1;
  cursor: default;
}

.otp-timer.is-ready {
  background: var(--brand-50);
  color: var(--brand-600);
  cursor: pointer;
}

.otp-timer.is-ready:hover {
  background: var(--brand-100);
}

.code-form {
  margin-top: 1.25rem;
  gap: 1rem;
  justify-items: center;
}

.otp-boxes {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
}

.otp-digit {
  width: 3.15rem;
  height: 3.15rem;
  border: 1px solid #c9d4e0;
  border-radius: 0.65rem;
  background: #fff;
  text-align: center;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-950);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.otp-digit:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgb(251 148 20 / 0.15);
}

.link-edit {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-500);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.link-edit:hover {
  color: var(--brand-600);
}

.code-form .btn {
  margin-top: 0.35rem;
}

.hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-400);
  text-align: right;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 3rem;
  margin-top: 0.35rem;
  border: 0;
  border-radius: 0.65rem;
  background: var(--brand-500);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:hover {
  background: var(--brand-600);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-danger {
  background: #e11d48;
}

.btn-danger:hover {
  background: #be123c;
}

.session-info {
  margin-top: 1.1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--ink-100);
  border-radius: 0.65rem;
  background: var(--ink-50);
  font-size: 0.8125rem;
  color: var(--ink-700);
  word-break: break-all;
}

.btn-ghost {
  margin-top: 0.15rem;
  background: transparent;
  color: var(--ink-500);
  height: auto;
  padding: 0.55rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-ghost:hover {
  background: transparent;
  color: var(--brand-600);
}

.alert {
  border-radius: 0.65rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 1rem;
  text-align: right;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
}

.alert-ok {
  background: #ecfdf5;
  color: #047857;
}

.footer-note {
  margin: 1.15rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.85;
  color: var(--ink-400);
}

.footer-note a {
  color: var(--brand-600);
  font-weight: 500;
  text-decoration: none;
}

.footer-note a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid rgb(255 255 255 / 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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