/* ============================================================
   auth.css — Merivista login (Hero V2 — single-column 2026-05-04)
   ─────────────────────────────────────────────────────────────
   صفحه ورود با تمرکز بر لوگوی جدید M-V Pillars به‌عنوان المان
   مرکزی. تک‌ستون عمودی، حداقل المان، انیمیشن نرم برای
   ورودی/دکمه‌ها. تم matte black + accent platinum.
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-fa);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body#loginPage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
  overflow-x: hidden;
}

/* ────────────────────────────────────────────────────────────
   Ambient — washes ملایم گوشه برای گرما (تنها رنگ صفحه)
   ──────────────────────────────────────────────────────────── */
.lg-ambient {
  position: fixed;
  width: 720px;
  height: 720px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(140px);
  opacity: 0.05;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}
.lg-ambient--tr {
  top: -260px;
  inset-inline-end: -260px;
}
.lg-ambient--bl {
  bottom: -260px;
  inset-inline-start: -260px;
  opacity: 0.035;
}

/* ────────────────────────────────────────────────────────────
   Hero shell — تک‌ستون مرکزی، عرض محدود، با تنفس
   ──────────────────────────────────────────────────────────── */
.lg-hero {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-10);
  /* fade-up entry — Canonical 2026-05-06: ease-out-quint برای حس
     "آرام از ابتدا"، duration کوتاه‌تر برای صفحه‌ای که چندبار باز می‌شود */
  animation: lg-enter 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes lg-enter {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ────────────────────────────────────────────────────────────
   Brand block — لوگوی بزرگ + نام + شعار
   ──────────────────────────────────────────────────────────── */
.lg-hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  /* Canonical 2026-05-06: ease-out-quint + delay کوتاه‌تر */
  animation: lg-fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

@keyframes lg-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes lg-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lg-hero-mark {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  /* اشاره‌ی بسیار ملایم به accent با glow پایه */
  filter: drop-shadow(0 0 24px rgba(200, 200, 208, 0.08));
  /* زنجیرهٔ دو انیمیشن (Canonical 2026-05-06):
     1) entry — ease-out-quint با delay کوتاه‌تر
     2) idle  — تنفس دائمی ملایم پس از پایان entry */
  animation:
    lg-mark-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both,
    lg-mark-idle 4s cubic-bezier(0.16, 1, 0.3, 1) 1.0s infinite;
}
.lg-hero-mark svg {
  width: 88px;
  height: 88px;
  display: block;
}

@keyframes lg-mark-in {
  from { opacity: 0; transform: scale(0.78) rotate(-2deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

/* تنفس دائمی ملایم — صفحه «زنده» احساس می‌شود */
@keyframes lg-mark-idle {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 24px rgba(200, 200, 208, 0.08));
  }
  50% {
    transform: scale(1.025);
    filter: drop-shadow(0 0 30px rgba(200, 200, 208, 0.15));
  }
}

/* ── Loading state — لوگو در حال نبض، هم‌فرم با ساختار M-V ── */
/* تأثیرات تشدیدشده: scale بزرگ‌تر + glow پررنگ + V با opacity دراماتیک
   !important تا تنفس idle را override کند */
.lg-hero-mark.is-loading {
  animation: lg-mark-breathe 1.2s var(--ease) infinite !important;
}
.lg-hero-mark.is-loading svg polyline {
  animation: lg-v-pulse 1.2s var(--ease) infinite;
}
.lg-hero-mark.is-loading svg line {
  animation: lg-pillar-pulse 1.2s var(--ease) infinite;
}
.lg-hero-mark.is-loading svg line:nth-of-type(2) {
  animation-delay: 0.18s;
}
@keyframes lg-mark-breathe {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 12px rgba(200, 200, 208, 0.10));
  }
  50% {
    transform: scale(1.10);
    filter: drop-shadow(0 0 36px rgba(200, 200, 208, 0.40));
  }
}
@keyframes lg-v-pulse {
  0%, 100% { opacity: 0.15; }
  50%      { opacity: 1; }
}
@keyframes lg-pillar-pulse {
  0%, 100% { opacity: 0.40; }
  50%      { opacity: 1; }
}
/* نام و شعار هنگام loading به پس‌زمینه می‌روند تا لوگو focus بگیرد */
.lg-hero-brand.is-loading .lg-hero-name,
.lg-hero-brand.is-loading .lg-hero-tag {
  opacity: 0.35;
  transition: opacity var(--dur) var(--ease);
}

.lg-hero-name {
  margin: 0;
  font-family: var(--font-en);
  font-size: 32px;
  font-weight: var(--fw-thin);
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1;
}
.lg-hero-accent {
  color: var(--accent);
  font-weight: var(--fw-light);
}

.lg-hero-tag {
  margin: 0;
  font-family: var(--font-fa);
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ────────────────────────────────────────────────────────────
   Form — بدون container card (Canonical 2026-05-06)
   مطابق اصل ۱ surface uniform و اصل ۶ cards محدود: form مستقیماً
   روی پس‌زمینه matte black شناور است، بدون border/bg/radius که
   حس "container روشن‌تر" بدهد.
   ──────────────────────────────────────────────────────────── */
.lg-form-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6) 0;
  /* بدون border, بدون border-radius, بدون background */
  /* delay و duration کاهش یافت برای حس "آرام از ابتدا" */
  animation: lg-card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

@keyframes lg-card-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lg-card-title {
  margin: 0 0 var(--space-2);
  font-size: 16px;
  font-weight: var(--fw-regular);
  color: var(--text);
  letter-spacing: 0.01em;
  text-align: center;
}

/* ── Field row ────────────────────────────────────────────── */
.lg-field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lg-label {
  font-size: var(--fs-small);
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* Input shell — sharp brutalist (Canonical 2026-05-06)
   مطابق اصل ۱۱ buttons-brutalist و اصل ۱۸ form inputs:
   bg همرنگ صفحه، sharp corners، border نقره‌ای، focus با border قوی‌تر. */
.lg-input-shell {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--text-muted);
  border-radius: 0;
  transition:
    border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0 var(--space-3);
  height: 40px;
}
.lg-input-shell:hover { border-color: var(--accent); }
.lg-input-shell:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}
.lg-input-shell.is-invalid {
  border-color: var(--critical);
}

.lg-input-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.lg-input-icon svg { width: 18px; height: 18px; }
.lg-input-shell:focus-within .lg-input-icon { color: var(--text); }

.lg-input-shell input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--font-fa);
  font-size: var(--fs-body);
  padding: 0 var(--space-3);
  height: 100%;
  min-width: 0;
}
/* اصل ۱۸: placeholder کم‌رنگ‌تر از value */
.lg-input-shell input::placeholder { color: var(--text-subtle); opacity: 1; }
.lg-input-shell input:-webkit-autofill,
.lg-input-shell input:-webkit-autofill:hover,
.lg-input-shell input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--text);
  transition: background-color 999999s ease-in-out 0s;
}

/* Password input — LTR + spaced bullets */
#password { direction: ltr; text-align: start; letter-spacing: 0.05em; }

/* Show/hide password toggle — utility icon (اصل ۱۷ بدون کادر) */
.lg-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.lg-toggle:hover { color: var(--text); }
.lg-toggle:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }
.lg-toggle svg { width: 18px; height: 18px; }
.lg-toggle .eye-closed { display: none; }
.lg-toggle.is-visible .eye-open { display: none; }
.lg-toggle.is-visible .eye-closed { display: block; }

/* Field-level error */
.lg-field-error {
  min-height: 0;
  font-size: var(--fs-eyebrow);
  color: var(--critical);
  margin-top: 2px;
  display: block;
}
.lg-field-error:empty { display: none; }

/* ── Meta row ─────────────────────────────────────────────── */
.lg-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-eyebrow);
  color: var(--text-subtle);
  margin-top: 2px;
}
.lg-meta-note { letter-spacing: 0.01em; }
.lg-forgot {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text-muted);
  font-family: var(--font-fa);
  font-size: var(--fs-eyebrow);
  cursor: pointer;
  transition: color var(--dur-fast) ease;
}
.lg-forgot:hover { color: var(--text); }
.lg-forgot.is-disabled { color: var(--text-subtle); cursor: not-allowed; }
.lg-forgot.is-disabled:hover { color: var(--text-subtle); }

/* ── Submit button — brutalist with hover invert (Canonical 2026-05-06)
   Default: bg matte black + border نقره‌ای + text نقره‌ای (مطابق اصل ۱۱).
   Hover: invert (bg نقره‌ای + text مشکی) — حس "primary CTA" بدون
   نقض قاعده، چون default state همرنگ صفحه است. */
.lg-submit {
  margin-top: var(--space-3);
  height: 44px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--text-muted);
  border-radius: 0;
  font-family: var(--font-fa);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background 220ms cubic-bezier(0.16, 1, 0.3, 1),
    color 220ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 220ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}
.lg-submit:hover {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.lg-submit:active { background: var(--text-muted); border-color: var(--text-muted); }
.lg-submit:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 2px;
}
.lg-submit:disabled,
.lg-submit.is-loading {
  opacity: 0.5;
  cursor: progress;
}
.lg-submit.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text);
  border-top-color: transparent;
  border-radius: 50%;
  animation: lg-spin 0.7s linear infinite;
}
@keyframes lg-spin { to { transform: rotate(360deg); } }

/* ── Form-level state ─────────────────────────────────────── */
.lg-form-state {
  min-height: 0;
  margin: var(--space-2) 0 0;
  font-size: var(--fs-small);
  color: var(--text-muted);
  text-align: center;
}
.lg-form-state.is-error { color: var(--critical); }
.lg-form-state:empty { display: none; }

/* ── Foot — تنها متن زیر کارت ─────────────────────────────── */
.lg-foot {
  margin: 0;
  text-align: center;
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  /* Canonical 2026-05-06: ease-out-quint + delay کوتاه‌تر */
  animation: lg-fade 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

/* ────────────────────────────────────────────────────────────
   Responsive — تبلت و موبایل
   ──────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  body#loginPage { padding: var(--space-5) var(--space-4); }
  .lg-hero { gap: var(--space-8); max-width: 100%; }
  .lg-hero-mark, .lg-hero-mark svg { width: 72px; height: 72px; }
  .lg-hero-name { font-size: 28px; }
  .lg-form-card { padding: var(--space-7) var(--space-5); }
}

@media (max-width: 380px) {
  .lg-hero-mark, .lg-hero-mark svg { width: 64px; height: 64px; }
  .lg-hero-name { font-size: 24px; }
  .lg-form-card { padding: var(--space-6) var(--space-4); }
  .lg-meta { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
}

/* ────────────────────────────────────────────────────────────
   Reduced motion — احترام به prefers-reduced-motion
   ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .lg-hero,
  .lg-hero-brand,
  .lg-hero-mark,
  .lg-form-card,
  .lg-foot,
  .lg-hero-mark.is-loading svg polyline,
  .lg-hero-mark.is-loading svg line {
    animation: none !important;
  }
  .lg-input-shell,
  .lg-submit {
    transition: none;
  }
}

/* ────────────────────────────────────────────────────────────
   Tablet — 561px..1024px
   layout از قبل تک‌ستون است؛ فقط کمی padding سخاوتمندانه‌تر
   ──────────────────────────────────────────────────────────── */
@media (min-width: 561px) and (max-width: 1024px) {
  .lg-hero { gap: var(--space-10); }
}
