/* ============================================================
   AL MOUTMAG — المتمم · hero.css  (Task 7-D · مكمّل بواسطة المشرف)
   ─ بطاقة Hero لحالة الفراغ (almx-hero) + نافذة الإحصاءات (almx-ins)
   ─ تعمل على متغيرات --alm-* حصراً → تتبع الثيم الداكن/الفاتح تلقائياً
   ─ لا تُعدّل أي قاعدة قائمة — إضافة معزولة تحت مساحتيها
   ============================================================ */

/* ---------- إخفاء محتوى hero-view الأصلي عندما يركب Hero (عمد hero.js) ---------- */
[data-hook="hero-view"][data-almx-hero="on"] > :not(.almx-hero) { display: none !important; }

/* ---------- بطاقة Hero ---------- */
.almx-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--alm-gap-4, 18px);
  max-width: 720px; margin-inline: auto;
  padding: clamp(22px, 4vw, 44px) clamp(14px, 3vw, 28px);
  text-align: center;
  animation: almxHeroIn .34s cubic-bezier(.2,.8,.25,1) both;
}
@keyframes almxHeroIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.almx-hero__mark {
  width: 64px; height: 64px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--alm-surface-1, rgba(255,255,255,.05));
  border: 1px solid var(--alm-border, rgba(255,255,255,.12));
  box-shadow: var(--alm-shadow, 0 10px 34px rgba(0,0,0,.35));
  overflow: hidden;
}
.almx-hero__mark img { width: 42px; height: 42px; display: block; }

.almx-hero__title {
  margin: 0; font-weight: 800; line-height: 1.35;
  font-size: clamp(19px, 2.6vw, 27px);
  color: var(--alm-text, #e6edf7);
}
.almx-hero__grad {
  background: var(--alm-grad, linear-gradient(90deg,#22d3ee,#8b5cf6));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.almx-hero__sub {
  margin: -6px 0 0; font-size: 13px; font-weight: 600; letter-spacing: .2px;
  color: var(--alm-text-2, rgba(230,237,247,.62));
}

/* شبكة بطاقات البداية السريعة */
.almx-hero__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px; width: 100%; margin-top: 4px;
}
.almx-hero__qcard {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 13px; min-height: 52px;
  border-radius: var(--alm-radius, 14px);
  background: var(--alm-surface-1, rgba(255,255,255,.05));
  border: 1px solid var(--alm-border, rgba(255,255,255,.12));
  color: var(--alm-text, #e6edf7);
  font: inherit; font-size: 13px; font-weight: 600; text-align: start;
  cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.almx-hero__qcard:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--alm-cyan, #22d3ee) 55%, transparent);
  background: var(--alm-surface-2, rgba(255,255,255,.08));
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
}
.almx-hero__qcard:focus-visible { outline: 2px solid var(--alm-cyan, #22d3ee); outline-offset: 2px; }
.almx-hero__qico {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--alm-cyan, #22d3ee) 14%, transparent);
  color: var(--alm-cyan, #22d3ee);
}
.almx-hero__qico .icon { width: 16px; height: 16px; }
.almx-hero__qt { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* تذييل البطاقة: إحصاءات حية + أزرار */
.almx-hero__foot {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; width: 100%; margin-top: 6px;
}
.almx-hero__stats { font-size: 12px; font-weight: 600; color: var(--alm-text-3, rgba(230,237,247,.5)); }
.almx-hero__insights, .almx-hero__install {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; min-height: 36px; border-radius: 10px;
  background: var(--alm-surface-1, rgba(255,255,255,.05));
  border: 1px solid var(--alm-border, rgba(255,255,255,.12));
  color: var(--alm-text, #e6edf7);
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.almx-hero__insights:hover, .almx-hero__install:hover {
  background: var(--alm-surface-2, rgba(255,255,255,.08));
  border-color: color-mix(in srgb, var(--alm-purple, #8b5cf6) 55%, transparent);
}
.almx-hero__insights .icon, .almx-hero__install .icon { width: 15px; height: 15px; }
.almx-hero__install { display: none; }
.almx-hero__install.is-show { display: inline-flex; }

/* ---------- نافذة الإحصاءات ---------- */
.almx-ins { position: fixed; inset: 0; z-index: 78; display: grid; place-items: center; padding: 18px; }
.almx-ins[hidden] { display: none; }
.almx-ins__backdrop {
  position: absolute; inset: 0;
  background: rgba(2,6,16,.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.almx-ins__panel {
  position: relative; width: min(560px, 100%); max-height: min(82vh, 640px);
  display: flex; flex-direction: column;
  border-radius: 18px;
  background: var(--alm-surface-1, rgba(16,22,38,.86));
  border: 1px solid var(--alm-border, rgba(255,255,255,.12));
  box-shadow: 0 24px 70px rgba(0,0,0,.5);
  overflow: hidden;
  animation: almxHeroIn .26s cubic-bezier(.2,.8,.25,1) both;
}
.almx-ins__head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--alm-border, rgba(255,255,255,.1));
}
.almx-ins__head h3 { margin: 0; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; color: var(--alm-text, #e6edf7); }
.almx-ins__head .icon { width: 16px; height: 16px; color: var(--alm-cyan, #22d3ee); }
.almx-ins__local {
  font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px;
  color: var(--alm-ok, #34d399);
  background: color-mix(in srgb, var(--alm-ok, #34d399) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--alm-ok, #34d399) 35%, transparent);
}
.almx-ins__body { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.almx-ins__tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.almx-ins__tile {
  padding: 10px; border-radius: 12px; text-align: center;
  background: var(--alm-surface-1, rgba(255,255,255,.05));
  border: 1px solid var(--alm-border, rgba(255,255,255,.1));
}
.almx-ins__k { display: block; font-size: 11px; font-weight: 600; color: var(--alm-text-3, rgba(230,237,247,.5)); margin-bottom: 3px; }
.almx-ins__v { display: block; font-size: 19px; font-weight: 800; color: var(--alm-text, #e6edf7); font-variant-numeric: tabular-nums; }
.almx-ins__sec { font-size: 12px; font-weight: 800; color: var(--alm-text-2, rgba(230,237,247,.65)); margin: 2px 2px -6px; }
.almx-ins__rows { display: flex; flex-direction: column; gap: 4px; }
.almx-ins__row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 11px; border-radius: 10px;
  background: var(--alm-surface-1, rgba(255,255,255,.04));
  border: 1px solid var(--alm-border, rgba(255,255,255,.08));
  font-size: 12.5px;
}
.almx-ins__row .almx-ins__k { margin: 0; }
.almx-ins__row .almx-ins__v { font-size: 13px; font-weight: 700; }
.almx-ins__empty { text-align: center; color: var(--alm-text-3, rgba(230,237,247,.5)); font-size: 13px; padding: 18px 6px; }
.almx-ins__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--alm-border, rgba(255,255,255,.1));
}
.almx-ins__privacy { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--alm-text-3, rgba(230,237,247,.55)); }
.almx-ins__privacy .icon { width: 13px; height: 13px; color: var(--alm-ok, #34d399); }
.almx-ins__actions { display: flex; gap: 8px; }
.almx-ins__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 36px; border-radius: 10px; cursor: pointer;
  background: var(--alm-surface-1, rgba(255,255,255,.05));
  border: 1px solid var(--alm-border, rgba(255,255,255,.12));
  color: var(--alm-text, #e6edf7); font: inherit; font-size: 12.5px; font-weight: 700;
}
.almx-ins__btn .icon { width: 14px; height: 14px; }
.almx-ins__btn--primary {
  background: var(--alm-grad, linear-gradient(90deg,#22d3ee,#8b5cf6));
  border: none; color: #04101d; font-weight: 800;
}
.almx-ins__btn:focus-visible { outline: 2px solid var(--alm-cyan, #22d3ee); outline-offset: 2px; }

/* ---------- موبايل ---------- */
@media (max-width: 520px) {
  .almx-hero__grid { grid-template-columns: repeat(2, 1fr); }
  .almx-ins { padding: 10px; }
  .almx-ins__tiles { grid-template-columns: repeat(2, 1fr); }
  .almx-ins__foot { justify-content: center; }
}
@media (max-width: 380px) {
  .almx-hero__grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .almx-hero, .almx-ins__panel { animation: none; }
  .almx-hero__qcard { transition: none; }
}
