/* ══════════════════════════════════════════════════════════════════════════
   محطة — الحركة. الهوية: «الشحن» — شعارنا صاعقة، فالتحميل شحنة والنجاح شرارة.
   كل دخول بـ animation-fill-mode: both كي يكتمل ولو فُتحت الصفحة في الخلفية.
   «تقليل الحركة» في النظام يوقف كل ما هنا (آخر الملف).
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --ease-emph: cubic-bezier(.16, 1, .3, 1);
  --ease-back: cubic-bezier(.34, 1.45, .64, 1);
  --coral: #FD655A; --bolt: #FCC300; --teal: #02A1A5;
}

/* ───── الشعار يشحن ───── */
.brand-mark { position: relative; display: inline-grid; place-items: center; width: var(--bm, 72px); height: var(--bm, 72px); flex: none; }
.bm-svg { position: relative; z-index: 1; width: 100%; height: 100%; overflow: visible; animation: bm-pop .7s var(--ease-back) both; }
/* ظلّ الشعار: تدرّج ثابت تحته بدل drop-shadow على رسمٍ يتحرّك (كان يُعاد حسابه مع كل إطار) */
.brand-mark::after { content: ""; position: absolute; z-index: 0; left: 8%; right: 8%; bottom: -14%; height: 34%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgb(253 101 90 / .5), transparent); animation: bm-shadow .7s var(--ease-back) both; }
@keyframes bm-shadow { from { opacity: 0; transform: scale(.4); } }
.bm-tile { fill: var(--coral); }
.bm-bolt { fill: var(--bolt); fill-opacity: 0; stroke: #fff; stroke-width: 22; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: bm-draw .55s var(--ease-emph) .12s forwards, bm-fill .3s ease-out .55s forwards, bm-zap 1.6s ease-in-out 1s infinite; }
.bm-plus { stroke: var(--bolt); stroke-width: 34; stroke-linecap: round; fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; animation: bm-draw .35s var(--ease-emph) .6s forwards; }
.bm-ring { position: absolute; inset: calc(var(--bm) * -.16); border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 15%, var(--bolt) 45%, var(--coral) 70%, var(--teal) 90%, transparent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: spin 1.1s linear infinite; opacity: .95; }
.bm-sparks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.bm-sparks > i { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: var(--bolt); box-shadow: 0 0 8px var(--bolt);
  transform: rotate(var(--a)) translateY(0) scale(0); animation: bm-spark 1.6s var(--ease-emph) infinite; animation-delay: calc(.6s + var(--d)); }
@keyframes bm-pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
@keyframes bm-draw { to { stroke-dashoffset: 0; } }
@keyframes bm-fill { 0% { fill-opacity: 0; } 40% { fill-opacity: 1; fill: #fff; } 100% { fill-opacity: 1; } }
@keyframes bm-zap { 0%, 86%, 100% { fill: var(--bolt); } 90% { fill: #fff; } 94% { fill: var(--bolt); } 97% { fill: #fff8d6; } }
@keyframes bm-spark { 0% { transform: rotate(var(--a)) translateY(0) scale(0); opacity: 1; } 55% { opacity: 1; } 100% { transform: rotate(var(--a)) translateY(calc(var(--bm) * -.95)) scale(1); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.brand-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-4, 16px); padding: var(--s-12, 48px) var(--s-4, 16px); color: var(--text-2); font: var(--t-callout); text-align: center; }
.brand-loader.compact { padding: var(--s-6, 24px) 0; }
.brand-loader-label { animation: label-breathe 1.8s ease-in-out infinite; }
@keyframes label-breathe { 50% { opacity: .55; } }

/* ───── تحميل صفحة لم يصل كودها: شكل شاشة البدء داخل منطقة المحتوى ─────
   لا يظهر قبل 250 ملّي ثانية من الانتظار: الصفحة الأسرع من ذلك لا ترى أي مؤشّر. */
.route-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; min-height: 60vh;
  animation: wait-in .22s ease-out .25s both; }
.route-loader-bar { position: relative; width: 120px; height: 4px; border-radius: 4px; overflow: hidden; background: rgb(0 0 0 / .06); }
.route-loader-bar::after { content: ""; position: absolute; inset: 0; width: 45%; border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--bolt), var(--coral)); animation: progress-run 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }
:root[data-theme="dark"] .route-loader-bar { background: rgb(255 255 255 / .1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .route-loader-bar { background: rgb(255 255 255 / .1); } }
/* أي انتظار داخل الصفحة (الشعار أو الهياكل) يظهر بعد مهلة قصيرة فقط، فالرد السريع لا يومض */
@keyframes wait-in { from { opacity: 0; } }
.brand-loader { animation: wait-in .22s ease-out .25s both; }
/* the same mark for data inside a page (orders, statement, products…), with less room */
.route-loader-inline { min-height: 0; padding: 40px 16px; gap: 16px; }
.route-loader-inline .route-loader-bar { width: 96px; }
.tr-loading td, .tr-loading:hover td { background: transparent !important; }

/* ───── شريط الشحن أعلى الصفحة ───── */
.top-progress { position: fixed; inset-inline: 0; top: 0; height: 3px; z-index: 96; pointer-events: none; opacity: 0; transition: opacity .3s ease; }
.top-progress[data-active="true"] { opacity: 1; }
.top-progress > span { position: absolute; inset-block: 0; width: 40%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--bolt), var(--coral), transparent);
  box-shadow: 0 0 12px rgb(252 195 0 / .7); animation: progress-run 1.1s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes progress-run { from { transform: translateX(260%); } to { transform: translateX(-130%); } }

/* ───── دخول الصفحة ───── */
@keyframes m-rise { from { opacity: 0; transform: translate3d(0, 12px, 0) scale(.99); } to { opacity: 1; transform: none; } }
/* قصيرة: المحتوى مقروء خلال ربع ثانية، والعناصر تتتابع بفارق صغير */
.page-transition > * { animation: m-rise .3s var(--ease-emph) both; }
.page-transition > *:nth-child(2) { animation-delay: 35ms; }
.page-transition > *:nth-child(3) { animation-delay: 70ms; }
.page-transition > *:nth-child(n+4) { animation-delay: 100ms; }

/* ───── البطاقات: تدخل متتابعة، تتوهّج وتلمع عند التحويم ───── */
@keyframes tile-in { from { opacity: 0; transform: translate3d(0, 26px, 0) scale(.9) rotate(-2deg); } to { opacity: 1; transform: none; } }
.tiles { animation: none; }
.tiles > .tile, .tiles > li { animation: tile-in .6s var(--ease-emph) both; animation-delay: calc(min(var(--i, 0), 18) * 45ms); }
.tiles > li > .tile { animation: none; }
.tile-img { isolation: isolate; }
.tile-img::after {
  content: ""; position: absolute; inset: 0; z-index: 25; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / .42) 50%, transparent 65%);
  transform: translateX(130%); transition: transform 0s;
}
.tile:hover .tile-img::after, .tile:focus-visible .tile-img::after { transform: translateX(-130%); transition: transform .9s var(--ease-emph); }
.tile:hover .tile-img { box-shadow: 0 18px 34px -18px rgb(2 161 165 / .7) !important; }
.tile .tile-name { transition: color .2s, transform .4s var(--ease-back); }
.tile:hover .tile-name { color: var(--accent-text); transform: translateY(-2px); }
.tile[aria-disabled="true"]:hover .tile-img::after { transform: translateX(130%); transition: none; }
/* الفئات المولَّدة: الإطار يأخذ ألوان الفئة عند التحويم */
.tile-art { background: var(--surface-3); }

/* ───── الظهور عند التمرير ───── */
.reveal-on [data-reveal]:not([data-revealed]) { opacity: 0; transform: translateY(28px); }
.reveal-on [data-reveal][data-revealed] { animation: m-rise .7s var(--ease-emph) both; }

/* ───── تموّج الضغط ───── */
.ui-btn, .nav-item { position: relative; overflow: hidden; isolation: isolate; }
.ui-btn[data-ripple]::before, .nav-item[data-ripple]::before, .tile[data-ripple] .tile-img::before {
  content: ""; position: absolute; left: var(--rx, 50%); top: var(--ry, 50%); width: 12px; height: 12px; margin: -6px; border-radius: 50%; z-index: -1;
  background: currentColor; opacity: .18; pointer-events: none; animation: ripple .6s var(--ease-emph) forwards;
}
.tile[data-ripple] .tile-img::before { z-index: 26; background: #fff; opacity: .35; }
@keyframes ripple { to { transform: scale(40); opacity: 0; } }
.ui-btn-primary:not(.ui-btn-loading)::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / .3) 50%, transparent 70%); transform: translateX(120%); }
.ui-btn-primary:not(.ui-btn-loading):hover:not(:disabled)::after { transform: translateX(-120%); transition: transform .75s var(--ease-emph); }


/* ───── القائمة الجانبية ───── */
.nav-item > svg { transition: transform .35s var(--ease-back); }
.nav-item:hover > svg { transform: rotate(-10deg) scale(1.12); }
.nav-item.active > svg { animation: icon-zap .5s var(--ease-back); }
.nav-item.active { box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .nav-item.active { box-shadow: inset -3px 0 0 var(--accent); }
@keyframes icon-zap { 0% { transform: scale(.7) rotate(-20deg); } 100% { transform: none; } }
.user-card { position: relative; overflow: hidden; isolation: isolate; }
/* لمعة تعبر البطاقة: طبقة تنزلق بالتحويل (لا background-position يُعاد رسمه كل إطار) */
.user-card::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgb(2 161 165 / .14) 50%, transparent 70%); transform: translateX(-110%); animation: card-sheen 6s ease-in-out infinite; }
@keyframes card-sheen { 0%, 60% { transform: translateX(110%); } 100% { transform: translateX(-110%); } }
.sidebar .logo-lockup { animation: logo-in .8s var(--ease-back) both; }
@keyframes logo-in { from { opacity: 0; transform: translateY(-10px) scale(.88); } }

/* ───── نجاح: علامة صح وشرارات ───── */
.success-wrap { position: relative; display: inline-grid; place-items: center; flex: none; }
.success-wrap > .success-check { position: relative; z-index: 1; }
.burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.burst > i { position: absolute; width: 7px; height: 7px; margin: -3.5px; border-radius: 2px; background: var(--teal); transform: rotate(var(--a)) translateY(0) scale(0); animation: burst .9s var(--ease-emph) both; animation-delay: calc(.25s + var(--d)); }
.burst > i:nth-child(3n+1) { background: var(--bolt); border-radius: 50%; }
.burst > i:nth-child(3n+2) { background: var(--coral); width: 4px; height: 10px; }
@keyframes burst { 0% { transform: rotate(var(--a)) translateY(0) scale(0); opacity: 1; } 60% { opacity: 1; } 100% { transform: rotate(var(--a)) translateY(calc(var(--spread, 48px) * -1)) scale(1); opacity: 0; } }
.buy-done h3 { animation: m-rise .5s var(--ease-emph) .35s both; }
.buy-done p { animation: m-rise .5s var(--ease-emph) .45s both; }

/* ───── الحالة الفارغة، الحوار، الرصيد ───── */
.empty-icon { animation: float 4s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-4deg); } }
.scrim { backdrop-filter: blur(6px) saturate(140%); -webkit-backdrop-filter: blur(6px) saturate(140%); }
.buy-banner img { animation: banner-zoom 1.2s var(--ease-emph) both; }
@keyframes banner-zoom { from { transform: scale(1.16); opacity: .4; } }
.pill-price { animation: m-rise .5s var(--ease-back) .2s both; }
.order-fields > * { animation: m-rise .45s var(--ease-emph) both; }
.order-fields > *:nth-child(2) { animation-delay: 50ms; } .order-fields > *:nth-child(3) { animation-delay: 100ms; } .order-fields > *:nth-child(n+4) { animation-delay: 140ms; }

/* ───── صفحات الدخول: شفق ملوّن يتحرّك ببطء ───── */
.auth { position: relative; isolation: isolate; overflow: hidden; }
.auth::before, .auth::after { content: ""; position: absolute; z-index: 0; width: 60vmax; height: 60vmax; border-radius: 50%; opacity: .5; pointer-events: none;
  background: radial-gradient(circle, rgb(2 161 165 / .55), transparent 65%); inset-inline-start: -15vmax; top: -20vmax; animation: aurora 18s ease-in-out infinite alternate;
  will-change: transform; }
.auth::after { background: radial-gradient(circle, rgb(252 195 0 / .5), transparent 65%); inset-inline-start: auto; inset-inline-end: -20vmax; top: auto; bottom: -25vmax; animation-duration: 22s; animation-direction: alternate-reverse; }
@keyframes aurora { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(8vmax, 6vmax) scale(1.15); } 100% { transform: translate(-4vmax, 10vmax) scale(.95); } }
.auth-inner { animation: m-rise .7s var(--ease-emph) both; }
.auth-brand .logo-lockup, .public-header .logo-lockup { animation: logo-in .9s var(--ease-back) both; }

/* ───── صفحة غير موجودة ───── */
.nf-art { display: grid; place-items: center; gap: var(--s-2, 8px); margin-top: var(--s-8, 32px); }
.nf-code { font: 900 clamp(72px, 18vw, 140px)/1 var(--font-display); letter-spacing: -.04em; background: linear-gradient(120deg, var(--teal), var(--bolt) 45%, var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% 100%; animation: nf-flow 5s ease-in-out infinite alternate; }
@keyframes nf-flow { to { background-position: 100% 0; } }

@media (prefers-reduced-motion: reduce) {
  .bm-svg, .brand-mark::after, .bm-bolt, .bm-plus, .bm-ring, .bm-sparks > i, .brand-loader-label, .page-transition > *, .tiles > .tile, .tiles > li,
  .reveal-on [data-reveal][data-revealed], .burst > i, .buy-done h3, .buy-done p, .empty-icon, .buy-banner img, .pill-price, .order-fields > *,
  .auth::before, .auth::after, .auth-inner, .auth-brand .logo-lockup, .public-header .logo-lockup, .sidebar .logo-lockup, .user-card::after, .nf-code, .nav-item.active > svg { animation: none !important; }
  .bm-bolt { stroke-dashoffset: 0; fill-opacity: 1; } .bm-plus { stroke-dashoffset: 0; }
  .reveal-on [data-reveal]:not([data-revealed]) { opacity: 1; transform: none; }
  .route-loader-bar::after { animation-duration: 3s; }
  .tile-img::after, .ui-btn-primary::after { display: none; }
  .top-progress > span { animation-duration: 3s; }
}

.buy-done .success-check, .deposit-arrived .success-check { color: var(--teal); filter: drop-shadow(0 6px 14px rgb(2 161 165 / .35)); }

/* ───── القائمة الجانبية: مؤشّر ينزلق بين الأقسام، وأيقونة في مربّع يتلوّن ───── */
.nav-item.active { background: transparent; box-shadow: none !important; }
.nav-active { position: absolute; inset: 0; z-index: -1; border-radius: var(--r-2); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgb(2 161 165 / .18), 0 8px 18px -12px rgb(2 161 165 / .7); }
.nav-active::before { content: ""; position: absolute; inset-block: 9px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2);
  transition: background .25s, color .25s, transform .35s var(--ease-back); }
.nav-ic > svg { width: 17px; height: 17px; }
.nav-item:hover .nav-ic { transform: rotate(-8deg) scale(1.08); color: var(--text); }
.nav-item.active .nav-ic { background: var(--accent); color: #fff; box-shadow: 0 6px 14px -6px var(--accent); animation: icon-zap .5s var(--ease-back); }
.nav-item:hover > svg, .nav-item.active > svg { transform: none; animation: none; }
.nav-group { display: flex; align-items: center; gap: 8px; }
.nav-group::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
[dir="rtl"] .nav-group::after { background: linear-gradient(270deg, var(--border), transparent); }
.section:has(> .cat-band) { gap: var(--s-6, 24px); }
@media (prefers-reduced-motion: reduce) { .nav-item.active .nav-ic { animation: none; } }
/* المؤشّر المنزلق يعبر حدود الصفوف — لا قصّ هنا ولا تموّج */
.nav-item { overflow: visible; }
.nav-item[data-ripple]::before { display: none; }

