/* ==========================================================================
   Ahora — سیستم طراحی صفحات احراز هویت
   یک فایل، به‌جای پنج کپی inline. نسخه‌دار با filemtime، پس کش مرورگر
   بعد از هر تغییر خودش تازه می‌شود.
   ========================================================================== */

/* --- فونت خودمیزبان: سریع‌تر از Google Fonts و بدون وابستگی به CDN --- */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   توکن‌ها
   -------------------------------------------------------------------------- */
:root {
  --ah-bg-deep: #071815;
  --ah-bg-mid: #0b2a28;
  --ah-bg-high: #133f3b;

  --ah-teal: #31ccbe;
  --ah-teal-dim: #368f8b;
  --ah-teal-bright: #79f2e4;

  --ah-glass: rgba(255, 255, 255, .05);
  --ah-glass-strong: rgba(255, 255, 255, .08);
  --ah-border: rgba(49, 204, 190, .18);
  --ah-border-strong: rgba(49, 204, 190, .45);

  --ah-text: #f3faf8;
  /* کنتراست متن کم‌رنگ از .55 به .68 رسید تا به نسبت 4.5:1 استاندارد WCAG AA برسد */
  --ah-text-dim: rgba(243, 250, 248, .68);
  --ah-text-faint: rgba(243, 250, 248, .45);

  --ah-danger: #f87171;
  --ah-danger-bg: rgba(239, 68, 68, .12);
  --ah-danger-border: rgba(239, 68, 68, .3);
  --ah-success: #6ee7b7;
  --ah-success-bg: rgba(16, 185, 129, .12);
  --ah-success-border: rgba(16, 185, 129, .3);
  --ah-warn: #fcd34d;
  --ah-warn-bg: rgba(245, 158, 11, .12);
  --ah-warn-border: rgba(245, 158, 11, .3);

  --ah-r-xl: 26px;
  --ah-r-lg: 20px;
  --ah-r-md: 14px;
  --ah-r-sm: 10px;

  --ah-shadow: 0 10px 30px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .05);
  --ah-shadow-lg: 0 26px 70px -14px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(49, 204, 190, .08);

  --ah-ease: cubic-bezier(.22, 1, .36, 1);
  --ah-ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* --------------------------------------------------------------------------
   چیدمان پایه
   -------------------------------------------------------------------------- */
.ahora-auth *,
.ahora-auth *::before,
.ahora-auth *::after { box-sizing: border-box; }

body.ahora-auth {
  margin: 0;
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  direction: rtl;
  color: var(--ah-text);
  background: var(--ah-bg-mid);
  /* 100dvh به‌جای 100vh: روی موبایل نوار آدرس مرورگر محتوا را نمی‌برد */
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.ah-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 88% -10%, rgba(49, 204, 190, .14), transparent 62%),
    radial-gradient(700px 420px at 4% 8%, rgba(54, 143, 139, .12), transparent 60%),
    linear-gradient(150deg, var(--ah-bg-deep) 0%, var(--ah-bg-mid) 55%, var(--ah-bg-high) 100%);
}
.ah-blob { position: absolute; border-radius: 50%; filter: blur(80px); }
.ah-blob-1 { width: 600px; height: 600px; background: radial-gradient(circle, var(--ah-teal), var(--ah-teal-dim)); opacity: .22; top: -210px; inset-inline-end: -160px; animation: ah-drift 18s ease-in-out infinite; }
.ah-blob-2 { width: 420px; height: 420px; background: var(--ah-teal-dim); opacity: .16; bottom: -130px; inset-inline-start: -110px; animation: ah-drift 22s ease-in-out infinite reverse; }

@keyframes ah-drift { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-26px, 28px) scale(1.07); } }
@keyframes ah-fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes ah-spin { to { transform: rotate(360deg); } }

/* احترام به تنظیم سیستم‌عامل برای کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
  .ahora-auth *,
  .ahora-auth *::before,
  .ahora-auth *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

.ah-page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  padding: 2rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.ah-page--narrow { max-width: 520px; }

/* --------------------------------------------------------------------------
   ستون برند
   -------------------------------------------------------------------------- */
.ah-brand {
  flex: 1;
  padding: 2rem 2.5rem;
  animation: ah-fade-up .6s var(--ah-ease) both;
}
.ah-brand__logo {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 26px;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--ah-teal), var(--ah-teal-dim));
  box-shadow: 0 10px 28px rgba(49, 204, 190, .4);
}
.ah-brand__title { font-size: clamp(22px, 3vw, 32px); font-weight: 800; line-height: 1.35; margin: 0 0 .75rem; }
.ah-brand__title span { background: linear-gradient(135deg, var(--ah-teal), var(--ah-teal-bright)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ah-brand__desc { font-size: 15px; color: var(--ah-text-dim); line-height: 1.9; max-width: 330px; margin: 0; }
.ah-brand__features { margin-top: 2rem; display: flex; flex-direction: column; gap: 10px; list-style: none; padding: 0; }
.ah-brand__features li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ah-text-dim); padding: 9px 12px; border-radius: var(--ah-r-md); }
.ah-brand__icon { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; background: rgba(49, 204, 190, .12); border: 1px solid var(--ah-border); }

/* --------------------------------------------------------------------------
   کارت
   -------------------------------------------------------------------------- */
.ah-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  padding: 2.25rem 1.9rem;
  border-radius: var(--ah-r-xl);
  background: var(--ah-glass);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--ah-border);
  border-top-color: var(--ah-border-strong);
  box-shadow: var(--ah-shadow-lg);
  overflow: hidden;
  animation: ah-fade-up .5s var(--ah-ease) both;
}
.ah-card::before {
  content: '';
  position: absolute; inset-inline: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--ah-teal), var(--ah-teal-dim), var(--ah-teal), transparent);
}
.ah-card__icon { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-size: 27px; margin: 0 auto 1.15rem; background: linear-gradient(135deg, rgba(49, 204, 190, .2), rgba(54, 143, 139, .3)); border: 1px solid var(--ah-border-strong); }
.ah-card__title { font-size: 20px; font-weight: 700; text-align: center; margin: 0 0 6px; }
.ah-card__sub { font-size: 13.5px; color: var(--ah-text-dim); text-align: center; line-height: 1.85; margin: 0 0 1.6rem; }

/* --------------------------------------------------------------------------
   پیام‌ها
   -------------------------------------------------------------------------- */
.ah-alert {
  display: flex; align-items: flex-start; gap: 9px;
  border-radius: var(--ah-r-md);
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 1.15rem;
  border: 1px solid transparent;
}
.ah-alert--error   { background: var(--ah-danger-bg);  color: var(--ah-danger);  border-color: var(--ah-danger-border); }
.ah-alert--success { background: var(--ah-success-bg); color: var(--ah-success); border-color: var(--ah-success-border); }
.ah-alert--notice  { background: var(--ah-warn-bg);    color: var(--ah-warn);    border-color: var(--ah-warn-border); }
.ah-alert__icon { flex-shrink: 0; }

/* --------------------------------------------------------------------------
   فرم
   -------------------------------------------------------------------------- */
.ah-field { margin-bottom: 1.05rem; }
.ah-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ah-text-dim); margin-bottom: 6px; }
.ah-label .ah-req { color: var(--ah-teal); }

.ah-input {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  color: var(--ah-text);
  background: var(--ah-glass);
  border: 1px solid rgba(54, 143, 139, .38);
  border-radius: var(--ah-r-md);
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s var(--ah-ease), background .2s var(--ah-ease), box-shadow .2s var(--ah-ease);
}
.ah-input::placeholder { color: var(--ah-text-faint); }
.ah-input:hover { border-color: rgba(54, 143, 139, .6); }
.ah-input:focus-visible { border-color: var(--ah-teal); background: rgba(49, 204, 190, .07); box-shadow: 0 0 0 3px rgba(49, 204, 190, .16); }
.ah-input[aria-invalid="true"] { border-color: var(--ah-danger-border); }
.ah-input:disabled { opacity: .45; cursor: not-allowed; }
.ah-input[dir="ltr"] { text-align: left; }

/* فیلد رمز + دکمه‌ی نمایش */
.ah-password { position: relative; }
.ah-password .ah-input { padding-inline-start: 46px; }
.ah-password__toggle {
  position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--ah-r-sm);
  color: var(--ah-text-faint); cursor: pointer; font-size: 15px;
  transition: color .2s, background .2s;
}
.ah-password__toggle:hover { color: var(--ah-teal); background: rgba(49, 204, 190, .1); }

/* نوار قدرت رمز */
.ah-strength { margin-top: 8px; }
.ah-strength__track { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.ah-strength__bar { height: 100%; width: 0; border-radius: 99px; transition: width .3s var(--ah-ease), background .3s; }
.ah-strength__label { display: block; font-size: 11.5px; color: var(--ah-text-faint); margin-top: 5px; }

/* کپچا */
.ah-captcha { display: flex; align-items: center; gap: 10px; }
.ah-captcha__q {
  flex-shrink: 0;
  padding: 11px 16px;
  font-size: 17px; font-weight: 700; letter-spacing: 2px;
  color: var(--ah-teal);
  background: rgba(49, 204, 190, .1);
  border: 1px solid var(--ah-border-strong);
  border-radius: var(--ah-r-md);
  user-select: none;
}
.ah-captcha__eq { color: var(--ah-text-faint); font-size: 17px; flex-shrink: 0; }
.ah-captcha .ah-input { text-align: center; }

/* کد یک‌بارمصرف */
.ah-otp .ah-input {
  text-align: center;
  letter-spacing: 12px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding-inline: 10px;
}

/* هانی‌پات: از دید کاربر و صفحه‌خوان پنهان، ولی برای بات قابل پرکردن */
.ah-hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* چک‌باکس */
.ah-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ah-text-dim); cursor: pointer; user-select: none; }
.ah-check input { width: 16px; height: 16px; accent-color: var(--ah-teal); cursor: pointer; }

.ah-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1.3rem; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   دکمه‌ها
   -------------------------------------------------------------------------- */
.ah-btn {
  position: relative;
  width: 100%;
  font: inherit; font-size: 15px; font-weight: 600;
  color: #04201d;
  background: linear-gradient(135deg, var(--ah-teal), var(--ah-teal-dim));
  border: 0; border-radius: var(--ah-r-md);
  padding: 13px 16px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(49, 204, 190, .28);
  transition: transform .18s var(--ah-ease-spring), box-shadow .2s var(--ah-ease), filter .2s;
}
.ah-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(49, 204, 190, .42); }
.ah-btn:active:not(:disabled) { transform: scale(.985); }
.ah-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.ah-btn--ghost { background: var(--ah-glass); color: var(--ah-text-dim); border: 1px solid var(--ah-border); box-shadow: none; }
.ah-btn--ghost:hover:not(:disabled) { color: var(--ah-teal); border-color: var(--ah-border-strong); }
.ah-btn--danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; box-shadow: 0 4px 20px rgba(239, 68, 68, .25); }
.ah-btn--sm { width: auto; padding: 9px 16px; font-size: 13px; }

/* حالت در حال ارسال — از ارسال دوباره‌ی فرم جلوگیری می‌کند */
.ah-btn.is-loading { color: transparent; pointer-events: none; }
.ah-btn.is-loading::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px;
  border: 2px solid rgba(4, 32, 29, .35);
  border-top-color: #04201d;
  border-radius: 50%;
  animation: ah-spin .7s linear infinite;
}

/* فوکوس قابل‌رؤیت برای پیمایش با کیبورد */
.ahora-auth :focus-visible { outline: 2px solid var(--ah-teal); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   اجزای فرعی
   -------------------------------------------------------------------------- */
.ah-divider { border: 0; border-top: 1px solid rgba(255, 255, 255, .08); margin: 1.4rem 0; }
.ah-foot { text-align: center; font-size: 13px; color: var(--ah-text-dim); margin: 0; }
.ah-foot a { color: var(--ah-teal); text-decoration: none; font-weight: 500; }
.ah-foot a:hover { text-decoration: underline; }

.ah-note { background: rgba(49, 204, 190, .08); border: 1px solid var(--ah-border); border-radius: var(--ah-r-md); padding: 12px 14px; font-size: 12.5px; color: var(--ah-text-dim); line-height: 1.9; margin-bottom: 1.2rem; }

.ah-countdown { font-variant-numeric: tabular-nums; }

/* پنل لایسنس */
.ah-vault { position: relative; border-radius: var(--ah-r-lg); padding: 18px 16px 16px; margin-bottom: 1.35rem; background: linear-gradient(160deg, rgba(49, 204, 190, .1), rgba(11, 42, 40, .4)); border: 1px solid var(--ah-border-strong); overflow: hidden; }
.ah-vault__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12.5px; font-weight: 700; color: var(--ah-teal-bright); }
.ah-vault__sample { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: ui-monospace, monospace; font-size: 17px; font-weight: 800; letter-spacing: 3px; direction: ltr; background: rgba(0, 0, 0, .28); border: 1px dashed var(--ah-border-strong); border-radius: var(--ah-r-sm); padding: 10px 12px; filter: blur(2.5px); user-select: none; }
.ah-vault__desc { font-size: 12px; color: var(--ah-text-dim); line-height: 1.95; margin-top: 10px; }
.ah-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ah-badge { font-size: 11px; color: var(--ah-teal-bright); background: rgba(49, 204, 190, .12); border: 1px solid var(--ah-border); border-radius: 999px; padding: 3px 10px; }

/* --------------------------------------------------------------------------
   واکنش‌گرایی
   -------------------------------------------------------------------------- */
@media (max-width: 880px) {
  .ah-brand { display: none; }
  .ah-page { max-width: 480px; }
}
@media (max-width: 420px) {
  .ah-page { padding: 1.25rem .9rem; }
  .ah-card { padding: 1.75rem 1.25rem; border-radius: var(--ah-r-lg); }
  .ah-captcha { flex-wrap: wrap; }
  .ah-captcha__q { flex: 1; text-align: center; }
  .ah-otp .ah-input { letter-spacing: 8px; font-size: 19px; }
}

/* حالت روشن سیستم — کارت همچنان تیره می‌ماند ولی پس‌زمینه ملایم‌تر */
@media (prefers-contrast: more) {
  :root { --ah-text-dim: rgba(243, 250, 248, .85); --ah-border: rgba(49, 204, 190, .5); }
}

/* ─────────────────────────────────────────────────────────────
   نسخه ۳.۰.۰ — کلاس‌های تازه
   ───────────────────────────────────────────────────────────── */

/* لینک متنی داخل متن‌ها */
.ah-link {
  color: var(--ah-teal);
  text-decoration: none;
  font-weight: 500;
  border-radius: 4px;
}
.ah-link:hover,
.ah-link:focus-visible { text-decoration: underline; }

/* دکمه‌ای که مثل لینک دیده می‌شود (برای <button> داخل فرم POST) */
.ah-linkbtn {
  display: inline;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ah-teal);
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
}
.ah-linkbtn:hover:not(:disabled),
.ah-linkbtn:focus-visible { text-decoration: underline; }
.ah-linkbtn:disabled { opacity: .55; cursor: not-allowed; text-decoration: none; }

/* دکمه‌ی تمام‌عرض ولی بدون پس‌زمینه‌ی پررنگ */
.ah-btn--link {
  background: none;
  box-shadow: none;
  border: 1px solid transparent;
  color: var(--ah-text-dim);
  font-weight: 500;
}
.ah-btn--link:hover:not(:disabled) {
  color: var(--ah-teal);
  background: var(--ah-glass);
  border-color: var(--ah-border);
}

/* فرم‌های تک‌دکمه‌ای (ارسال دوباره‌ی کد، انصراف و…) */
.ah-form-inline {
  display: inline;
  margin: 0;
  padding: 0;
}

/* راهنمای کوتاه زیر فیلدها (aria-describedby) */
.ah-hint {
  display: block;
  margin-top: .4rem;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ah-text-dim);
}

/* هشدار غیرفعال بودن جاوااسکریپت */
.ah-noscript {
  margin: 0 0 1rem;
  padding: .75rem 1rem;
  border-radius: var(--ah-r-md, 12px);
  background: var(--ah-warn-bg);
  color: var(--ah-warn);
  border: 1px solid var(--ah-warn-border);
  font-size: 13px;
  line-height: 1.9;
  text-align: center;
}

/* فوتر صفحه‌های احراز هویت */
.ah-sitefoot {
  margin: 1.75rem auto 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 2;
  color: var(--ah-text-dim);
  opacity: .8;
}
.ah-sitefoot a { color: var(--ah-teal); text-decoration: none; }
.ah-sitefoot a:hover { text-decoration: underline; }
.ah-sitefoot p { margin: 0; }

/* جلوگیری از پرش چیدمان وقتی دکمه در حال ارسال است */
.ah-btn[data-ah-submitting] { pointer-events: none; opacity: .75; }

/* کاهش حرکت برای کاربرانی که ترجیح داده‌اند */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* چاپ */
@media print {
  .ah-bg, .ah-brand, .ah-btn { display: none !important; }
  body.ahora-auth { background: #fff; color: #000; }
}
