/* ═══════════════════════════════════════════════════════════════════
   login3d.css — صفحه‌ی ورودی سه‌بعدی (v20)
   همه‌چیز با CSS 3D و بدون هیچ کتابخانه‌ای (بدون CDN).
   ─ صحنه: زمین شبکه‌ای در عمق، هاله، مکعب سرور، گره‌های سنسور
   ─ کارت: شیشه‌ای با لایه‌های عمق (translateZ) و تیلت نرم با ماوس
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --a3d-lime: #c0f15c;
  --a3d-deep: #050c08;
  --a3d-glass: rgba(14, 25, 20, 0.72);
  --a3d-line: rgba(192, 241, 92, 0.16);
}

.auth-body:has(.auth3d) {
  background: var(--a3d-deep);
  overflow-x: hidden;
}

/* ─────────── چیدمان ─────────── */
.auth3d {
  position: relative;
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px 80px;
  perspective: 1500px;
  perspective-origin: 50% 45%;
  overflow: hidden;
  isolation: isolate;
}

.auth3d__inner {
  position: relative;
  z-index: 3;
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  transform-style: preserve-3d;
}

/* ─────────── صحنه‌ی پس‌زمینه ─────────── */
.scene {
  position: absolute;
  inset: -10% -5%;
  z-index: 1;
  transform-style: preserve-3d;
  pointer-events: none;
  /* صحنه از بقیه‌ی صفحه جدا شود: تغییراتش روی چیدمان بیرون اثر ندارد */
  contain: layout paint;
}

/* زمین شبکه‌ای که تا افق می‌رود */
.scene__floor {
  position: absolute;
  left: 50%;
  bottom: -18%;
  width: 190%;
  height: 120%;
  margin-left: -95%;
  background-image:
    linear-gradient(to right, rgba(192, 241, 92, 0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(192, 241, 92, 0.18) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: rotateX(76deg) translate3d(0, 0, -40px);
  transform-origin: 50% 100%;
  will-change: transform;
  -webkit-mask-image: radial-gradient(ellipse 60% 62% at 50% 78%, #000 5%, transparent 72%);
  mask-image: radial-gradient(ellipse 60% 62% at 50% 78%, #000 5%, transparent 72%);
  animation: floorMove 14s linear infinite;
  opacity: 0.9;
}

/* حرکت زمین با translate است نه background-position:
   جابه‌جایی لایه‌ی کامپوزیت‌شده، بدون هیچ repaint روی مساحت بزرگ. */
@keyframes floorMove {
  from { transform: rotateX(76deg) translate3d(0, 0, -40px); }
  to   { transform: rotateX(76deg) translate3d(0, 64px, -40px); }
}

/* هاله‌ی نور پشت کارت */
.scene__glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 780px;
  height: 780px;
  margin: -390px 0 0 -390px;
  background: radial-gradient(circle at 50% 50%, rgba(192, 241, 92, 0.18), rgba(31, 122, 74, 0.1) 40%, transparent 68%);
  animation: glowPulse 9s ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50%      { transform: scale(1.09); opacity: 1; }
}

/* حلقه‌های افقی در عمق */
.scene__ring {
  position: absolute;
  left: 50%;
  top: 62%;
  border: 1px solid var(--a3d-line);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotateX(74deg);
  transform-style: preserve-3d;
}
.scene__ring--1 { width: 620px; height: 620px; animation: ringSpin 26s linear infinite; }
.scene__ring--2 { width: 900px; height: 900px; animation: ringSpin 40s linear infinite reverse; border-style: dashed; opacity: 0.6; }

@keyframes ringSpin {
  from { transform: translate(-50%, -50%) rotateX(74deg) rotateZ(0deg); }
  to   { transform: translate(-50%, -50%) rotateX(74deg) rotateZ(360deg); }
}

/* مکعب سرور (۶ وجه) */
.cube {
  position: absolute;
  left: 9%;
  top: 60%;
  width: 78px;
  height: 78px;
  transform-style: preserve-3d;
  opacity: 0.5;
  animation: cubeSpin 26s linear infinite;
}
.cube__face {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(192, 241, 92, 0.45);
  background:
    linear-gradient(135deg, rgba(192, 241, 92, 0.14), rgba(192, 241, 92, 0.02));
  box-shadow: inset 0 0 24px rgba(192, 241, 92, 0.12);
}
.cube__face--f { transform: translateZ(39px); }
.cube__face--b { transform: rotateY(180deg) translateZ(39px); }
.cube__face--r { transform: rotateY(90deg) translateZ(39px); }
.cube__face--l { transform: rotateY(-90deg) translateZ(39px); }
.cube__face--t { transform: rotateX(90deg) translateZ(39px); }
.cube__face--d { transform: rotateX(-90deg) translateZ(39px); }

@keyframes cubeSpin {
  from { transform: rotateX(-18deg) rotateY(0deg); }
  to   { transform: rotateX(-18deg) rotateY(360deg); }
}

/* گره‌های سنسور شناور */
.node {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--a3d-lime);
  box-shadow: 0 0 18px rgba(192, 241, 92, 0.8);
  animation: nodeFloat 7s ease-in-out infinite;
}
.node::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(192, 241, 92, 0.28);
  border-radius: 6px;
  animation: nodePing 3.4s ease-out infinite;
}
.node--1 { left: 12%; top: 34%; animation-delay: 0s; }
.node--2 { left: 26%; top: 58%; animation-delay: 1.1s; width: 9px; height: 9px; }
.node--2::after, .node--3::after, .node--5::after { animation: none; opacity: 0.5; }
.node--3 { left: 8%;  top: 68%; animation-delay: 2.2s; width: 8px; height: 8px; }
.node--4 { right: 26%; top: 70%; animation-delay: 0.7s; }
.node--5 { right: 8%; top: 52%; animation-delay: 1.8s; width: 10px; height: 10px; }

@keyframes nodeFloat {
  0%, 100% { transform: translateY(0) translateZ(0); }
  50%      { transform: translateY(-16px) translateZ(30px); }
}
@keyframes nodePing {
  0%   { transform: scale(0.7); opacity: 0.9; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* خطوط داده که از گره‌ها به بالا می‌روند */
.scene__beam {
  position: absolute;
  width: 1px;
  background: linear-gradient(to top, rgba(192, 241, 92, 0.55), transparent);
  opacity: 0.75;
  will-change: transform;
  animation: beamRise 5s linear infinite;
}
.scene__beam--1 { left: 13%; top: 18%; height: 26%; animation-delay: 0.4s; }
.scene__beam--2 { left: 27%; top: 34%; height: 30%; animation-delay: 1.6s; }
.scene__beam--3 { right: 27%; top: 30%; height: 34%; animation-delay: 2.6s; display: none; }

@keyframes beamRise {
  from { transform: translate3d(0, 30px, 0) scaleY(0.35); }
  to   { transform: translate3d(0, -40px, 0) scaleY(1); }
}

/* ─────────── کارت سه‌بعدی ─────────── */
.auth3d__card {
  position: relative;
  transform-style: preserve-3d;
  transform:
    rotateY(calc(var(--tilt-y, 0) * 1deg))
    rotateX(calc(var(--tilt-x, 0) * 1deg))
    translateZ(0);
  /* عمداً will-change نداریم: لایه‌ی ارتقایافته + preserve-3d باعث می‌شد
     کروم محتوای کارت را هر فریم دوباره رستر کند (۷ فریم روی دستگاه ضعیف). */
  backface-visibility: hidden;
}

/* ضخامت کارت: یک اسلب تیره که پشت کارت می‌نشیند و در تیلت لبه‌اش دیده می‌شود */
.auth3d__card::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 26px;
  background: linear-gradient(160deg, #0b1712, #040907);
  border: 1px solid rgba(192, 241, 92, 0.12);
  transform: translateZ(-42px) translate(10px, 16px);
  box-shadow: 0 70px 100px -60px rgba(0, 0, 0, 0.95);
  z-index: -1;
}

/* سایه/بازتاب روی زمین زیر کارت */
/* سایه‌ی نشستن کارت روی زمین — نسخه‌ی سبک:
   قبلاً یک pseudo با translateZ(-70px) بود؛ در لایه‌ی سه‌بعدی کارت،
   هر فریم دوباره رستر می‌شد. حالا با box-shadow ساده انجام می‌شود. */
.auth3d__card > .auth3d__glass {
  box-shadow:
    0 90px 70px -80px rgba(192, 241, 92, 0.28),
    0 40px 80px -30px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.auth3d__glass {
  position: relative;
  padding: clamp(24px, 3.2vw, 38px);
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(24, 40, 32, 0.94), rgba(8, 16, 12, 0.96));
  border: 1px solid rgba(192, 241, 92, 0.22);
  box-shadow:
    0 40px 80px -30px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  /* نسخه‌ی سبک: backdrop-filter حذف شد — روی صحنه‌ی متحرک، هر فریم
     کل کارت را دوباره بلور می‌کرد و صفحه را به ۷ فریم می‌رساند. */
  overflow: hidden;
}

/* بازتاب نور که با ماوس حرکت می‌کند ── نسخه‌ی سبک:
   یک دایره‌ی ثابت که فقط با transform جابه‌جا می‌شود (بدون repaint گرادیان). */
.auth3d__glass::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 460px;
  height: 460px;
  margin: -230px 0 0 -230px;
  background: radial-gradient(circle at center, rgba(192, 241, 92, 0.16), transparent 62%);
  transform: translate3d(var(--sx, 50%), var(--sy, 40%), 0);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  will-change: transform;
}
.auth3d__glass.is-lit::before { opacity: 1; }
.auth3d__card:hover .auth3d__glass::before { opacity: 1; }

/* لبه‌ی نورانی بالای کارت */
.auth3d__glass::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(192, 241, 92, 0.85), transparent);
}

/* لایه‌های عمق: هر عنصر کمی جلوتر از کارت می‌ایستد */
.auth3d__glass > * {
  transform: translateZ(9px);
  transform-style: preserve-3d;
}
.auth3d__badge { transform: translateZ(26px); }
.auth3d__title { transform: translateZ(18px); }

.auth3d__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--a3d-lime);
  border: 1px solid rgba(192, 241, 92, 0.35);
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(192, 241, 92, 0.07);
  box-shadow: 0 10px 24px -12px rgba(192, 241, 92, 0.5);
}
.auth3d__badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--a3d-lime);
  box-shadow: 0 0 10px var(--a3d-lime);
  animation: badgeBlink 2.4s ease-in-out infinite;
}
@keyframes badgeBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.auth3d__title {
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  margin: 16px 0 6px;
  line-height: 1.35;
}
.auth3d__title em { color: var(--a3d-lime); font-style: normal; }
.auth3d__hint { color: var(--muted); font-size: 0.85rem; margin-bottom: 20px; line-height: 1.9; }

/* فیلدها: عمق و شیشه‌ای */
.auth3d .field input {
  background: rgba(5, 12, 8, 0.72);
  border: 1px solid rgba(192, 241, 92, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.auth3d .field input:focus {
  outline: none;
  border-color: rgba(192, 241, 92, 0.6);
  box-shadow: 0 0 0 3px rgba(192, 241, 92, 0.12), 0 12px 26px -18px rgba(192, 241, 92, 0.9);
  transform: translateZ(10px);
}
.auth3d .field label { font-size: 0.78rem; color: rgba(238, 243, 238, 0.7); }

.auth3d .button.btn-block {
  margin-top: 6px;
  border-radius: 12px;
  box-shadow: 0 18px 34px -18px rgba(192, 241, 92, 0.75);
  transform: translateZ(14px);
}

/* ستون کنار کارت */
.auth3d__side {
  color: var(--text);
  transform-style: preserve-3d;
}
.auth3d__side h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  line-height: 1.3;
  margin: 10px 0 14px;
}
.auth3d__side h1 em { color: var(--a3d-lime); font-style: normal; }
.auth3d__side p { color: var(--muted); font-size: 0.9rem; line-height: 2; max-width: 46ch; }

.auth3d__points {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  padding: 0;
  list-style: none;
}
.auth3d__points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: rgba(238, 243, 238, 0.86);
  border: 1px solid rgba(192, 241, 92, 0.14);
  border-radius: 12px;
  padding: 10px 14px;
  background: linear-gradient(120deg, rgba(192, 241, 92, 0.06), transparent 70%);
  transform: translateZ(18px);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.auth3d__points li:hover {
  transform: translateZ(30px) translateX(-4px);
  border-color: rgba(192, 241, 92, 0.4);
}
.auth3d__points svg { color: var(--a3d-lime); flex: none; }

/* حساب‌های نمونه و ورود سریع: جمع‌شده تا صفحه شلوغ نشود */
.auth3d .auth-more {
  margin-top: 18px;
  border: 1px solid rgba(192, 241, 92, 0.16);
  border-radius: 14px;
  background: rgba(5, 12, 8, 0.5);
  overflow: hidden;
}
.auth3d .auth-more > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 0.82rem;
  color: rgba(238, 243, 238, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
}
.auth3d .auth-more > summary::-webkit-details-marker { display: none; }
.auth3d .auth-more > summary::after {
  content: "▾";
  color: var(--a3d-lime);
  transition: transform 0.2s ease;
}
.auth3d .auth-more[open] > summary::after { transform: rotate(180deg); }
.auth3d .auth-more__body { padding: 0 12px 12px; }
.auth3d .auth-more .table-card { background: rgba(5, 12, 8, 0.6); border-radius: 12px; }

.auth3d .form-foot {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
}
.auth3d .form-foot a { color: var(--a3d-lime); }

/* ─────────── واکنش‌گرا ─────────── */
@media (max-width: 940px) {
  .auth3d { padding: 30px 16px 60px; min-height: auto; }
  .auth3d__inner { grid-template-columns: 1fr; gap: 26px; }
  .auth3d__side { order: 2; }
  .auth3d__card { order: 1; transform: none !important; }
  .scene__floor { opacity: 0.55; }
  .cube { display: none; }
  .scene__ring--2 { display: none; }
}

@media (max-width: 640px) {
  /* موبایل: صحنه ثابت می‌شود؛ عمق می‌ماند، ولی هیچ انیمیشنی اجرا نمی‌شود */
  .scene__ring,
  .node,
  .node::after,
  .scene__beam,
  .scene__floor { animation: none !important; }
  .scene__floor { opacity: 0.4; }
}

@media (max-width: 520px) {
  .auth3d__glass { padding: 20px; border-radius: 18px; }
  .auth3d__side h1 { font-size: 1.4rem; }
  .auth3d__points li { font-size: 0.78rem; }
}

/* ─────────── احترام به تنظیم کاهش حرکت ─────────── */
@media (prefers-reduced-motion: reduce) {
  .scene__floor,
  .scene__glow,
  .scene__ring,
  .cube,
  .node,
  .node::after,
  .scene__beam,
  .auth3d__badge i { animation: none !important; }
  .auth3d__card { transform: none !important; transition: none; }
}

/* ─────────── حالت سبک (fx-low) ───────────
   اگر همان ثانیه‌ی اول نرخ فریم پایین باشد، اسکریپت این کلاس را روی <html>
   می‌گذارد: همه‌ی انیمیشن‌های صحنه و تیلت خاموش می‌شوند تا فرم ورود
   بدون معطلی پاسخ بدهد. ظاهر (عمق، شیشه، شبکه) دست‌نخورده می‌ماند. */
.fx-low .scene *,
.fx-low .scene *::before,
.fx-low .scene *::after { animation: none !important; }

.fx-low .auth3d__card { transform: none !important; will-change: auto; }
.fx-low .node { box-shadow: none; }

/* حالت میانه: دستگاه نیمه‌قوی — انیمیشن‌های تزئینی خاموش، کارت و شبکه بمانند */
.fx-mid .scene__beam,
.fx-mid .node::after,
.fx-mid .auth3d__badge i { animation: none !important; }

/* ── «مرا به یاد بسپار» (v26) ── */
.auth-remember {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 14px;
  padding: 9px 12px;
  border: 1px solid rgba(238, 243, 238, .12);
  border-radius: 11px;
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
  user-select: none;
}

.auth-remember:hover {
  border-color: rgba(192, 241, 92, .35);
}

.auth-remember input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: none;
  border: 1px solid rgba(238, 243, 238, .3);
  border-radius: 5px;
  background: rgba(0, 0, 0, .25);
  cursor: pointer;
  position: relative;
  transition: background .15s, border-color .15s;
}

.auth-remember input[type="checkbox"]:checked {
  background: var(--lime, #c0f15c);
  border-color: var(--lime, #c0f15c);
}

.auth-remember input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: no-repeat center/12px 12px
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23080f0c' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>");
}

.auth-remember input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--lime, #c0f15c);
  outline-offset: 2px;
}

.auth-remember span {
  display: block;
  line-height: 1.6;
}

.auth-remember b {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #eef3ee);
}

.auth-remember small {
  display: block;
  font-size: 0.7rem;
  color: var(--muted, #9fb0a6);
}
