/* ═══════════════════════════════════════════════════════════════════════
   کندول — «نت ملی» + انیمیشن‌های افزوده
   این فایل بعد از panel.css بارگذاری می‌شود، پس می‌تواند روی آن سوار شود.
   همه‌چیز محلی است: هیچ فونت، آیکون یا اسکریپتی از اینترنت گرفته نمی‌شود
   (شرط بقا در حالت قطع نت ملی).
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --ir-ok:   var(--colors-green);
  --ir-warn: var(--colors-orange);
  --ir-crit: var(--colors-red);
}

/* ── ۱) کارت قهرمان «نت ملی» ───────────────────────────────────────── */
.ir-hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 22px 24px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgb(var(--colors-ghost-blue) / .16), transparent 62%),
    radial-gradient(110% 130% at 0% 100%, rgb(var(--colors-sea-green) / .12), transparent 60%),
    rgb(var(--colors-widget));
  border: 1px solid rgb(var(--colors-cold-gray) / .12);
  box-shadow: 0 18px 46px -26px rgb(var(--colors-dark-blue-5, 5 10 25) / .9);
  isolation: isolate;
}
/* نوار نور متحرک — «ضربان» شبکه */
.ir-hero::before {
  content: '';
  position: absolute; inset: -2px;
  background: conic-gradient(from 0deg,
    transparent 0deg, rgb(var(--colors-ghost-blue) / .55) 40deg,
    transparent 90deg, transparent 360deg);
  animation: ir-spin 7s linear infinite;
  z-index: -1; opacity: .5;
}
@keyframes ir-spin { to { transform: rotate(360deg); } }

.ir-hero .ir-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ir-hero .ir-orb {
  width: 54px; height: 54px; flex: none; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background: rgb(var(--colors-gray) / .12);
  color: rgb(var(--colors-gray));
  transition: background .4s ease, color .4s ease;
}
/* سه حلقهٔ رادار؛ سرعت و رنگ تابع وضعیت */
.ir-hero .ir-orb::after,
.ir-hero .ir-orb::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: .5;
  animation: ir-ring 2.4s cubic-bezier(.2,.6,.4,1) infinite;
}
.ir-hero .ir-orb::after { animation-delay: 1.2s; }
@keyframes ir-ring {
  0%   { transform: scale(.72); opacity: .65; }
  80%  { transform: scale(1.85); opacity: 0; }
  100% { transform: scale(1.85); opacity: 0; }
}
.ir-hero[data-level="ok"]       .ir-orb { background: rgb(var(--colors-green) / .16);  color: rgb(var(--colors-green)); }
.ir-hero[data-level="degraded"] .ir-orb { background: rgb(var(--colors-orange) / .16); color: rgb(var(--colors-orange)); }
.ir-hero[data-level="down"]     .ir-orb { background: rgb(var(--colors-red) / .18);    color: rgb(var(--colors-red)); }
/* در قطعی، پالس سریع‌تر و هشداردهنده */
.ir-hero[data-level="down"] .ir-orb::after,
.ir-hero[data-level="down"] .ir-orb::before { animation-duration: 1.1s; }
.ir-hero[data-level="down"] { border-color: rgb(var(--colors-red) / .35); }
.ir-hero[data-level="degraded"] { border-color: rgb(var(--colors-orange) / .3); }

.ir-hero .ir-title { font-size: 17px; font-weight: 700; }
.ir-hero .ir-sub { font-size: 12.5px; color: rgb(var(--colors-gray)); margin-top: 3px; }
.ir-hero .ir-verdict {
  margin-inline-start: auto; display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 100px;
  border: 1px solid rgb(var(--colors-cold-gray) / .16);
  background: rgb(var(--colors-cold-gray) / .06);
  white-space: nowrap;
}

/* ── ۲) شمارنده‌های زنده ───────────────────────────────────────────── */
.ir-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 18px; }
.ir-stat {
  background: rgb(var(--colors-cold-gray) / .05);
  border: 1px solid rgb(var(--colors-cold-gray) / .1);
  border-radius: 12px; padding: 13px 15px; position: relative; overflow: hidden;
}
.ir-stat .k { font-size: 11.5px; color: rgb(var(--colors-gray)); }
.ir-stat .v { font-size: 22px; font-weight: 700; margin-top: 5px; font-variant-numeric: tabular-nums; }
.ir-stat .v small { font-size: 12px; font-weight: 400; opacity: .65; margin-inline-start: 3px; }
.ir-stat .u { font-size: 11px; color: rgb(var(--colors-gray)); margin-top: 2px; }
/* خط پیشرفت افقی زیر هر شمارنده */
.ir-stat .u-bar { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: rgb(var(--colors-cold-gray) / .12); }
.ir-stat .u-bar > i { display: block; height: 100%; border-radius: 0 3px 3px 0;
  background: rgb(var(--colors-ghost-blue)); transition: width .7s cubic-bezier(.2,.7,.3,1); }
.ir-stat.ok   .u-bar > i { background: rgb(var(--colors-green)); }
.ir-stat.warn .u-bar > i { background: rgb(var(--colors-orange)); }
.ir-stat.crit .u-bar > i { background: rgb(var(--colors-red)); }

/* ── ۳) نقشهٔ نودهای ایرانی ────────────────────────────────────────── */
.ir-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; margin-top: 6px; }
.ir-node {
  position: relative; border-radius: 12px; padding: 12px 13px;
  background: rgb(var(--colors-cold-gray) / .05);
  border: 1px solid rgb(var(--colors-cold-gray) / .1);
  transition: transform .22s cubic-bezier(.2,.7,.3,1), border-color .22s ease, background .22s ease;
  animation: ir-in .42s cubic-bezier(.2,.7,.3,1) backwards;
}
@keyframes ir-in { from { opacity: 0; transform: translateY(9px) scale(.97); } }
.ir-node:hover { transform: translateY(-3px); border-color: rgb(var(--colors-ghost-blue) / .38); }
.ir-node .top { display: flex; align-items: center; gap: 8px; }
.ir-node .city { font-size: 13px; font-weight: 600; }
.ir-node .prov { font-size: 10.5px; color: rgb(var(--colors-gray)); margin-top: 2px; font-family: ui-monospace, monospace; direction: ltr; text-align: right; }
.ir-node .ms { margin-inline-start: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
/* LED وضعیت با هالهٔ نبض‌دار */
.ir-node .led {
  width: 9px; height: 9px; border-radius: 50%; flex: none; position: relative;
  background: rgb(var(--colors-gray));
}
.ir-node .led::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid currentColor; opacity: .55; animation: ir-ring 2s ease-out infinite;
}
.ir-node.up   .led { background: rgb(var(--colors-green)); color: rgb(var(--colors-green)); }
.ir-node.down .led { background: rgb(var(--colors-red));   color: rgb(var(--colors-red)); }
.ir-node.down .led::after { animation-duration: 1s; }
.ir-node.down { border-color: rgb(var(--colors-red) / .3); background: rgb(var(--colors-red) / .05); }
.ir-node.up .ms { color: rgb(var(--colors-green)); }
.ir-node.down .ms { color: rgb(var(--colors-red)); }
/* ستون سرعت: نوار نسبی */
.ir-node .speed { height: 4px; border-radius: 100px; background: rgb(var(--colors-cold-gray) / .12); margin-top: 9px; overflow: hidden; }
.ir-node .speed > i { display: block; height: 100%; border-radius: 100px;
  background: linear-gradient(90deg, rgb(var(--colors-green)), rgb(var(--colors-sea-green)));
  transition: width .8s cubic-bezier(.2,.7,.3,1); }
.ir-node.down .speed > i { background: rgb(var(--colors-red)); }

/* ── ۴) بنر «قطعی — چطور برمی‌گردی» ─────────────────────────────────── */
.ir-rescue {
  margin-top: 14px; border-radius: 14px; padding: 16px 18px;
  background: rgb(var(--colors-red) / .07);
  border: 1px solid rgb(var(--colors-red) / .28);
  animation: ir-alarm 2.2s ease-in-out infinite;
}
@keyframes ir-alarm {
  0%,100% { box-shadow: 0 0 0 0 rgb(var(--colors-red) / 0); }
  50%     { box-shadow: 0 0 0 5px rgb(var(--colors-red) / .09); }
}
.ir-rescue h4 { margin: 0 0 9px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.ir-rescue ol { margin: 0; padding-inline-start: 18px; font-size: 12.5px; line-height: 2; color: rgb(var(--colors-cold-gray)); }
.ir-rescue code {
  background: rgb(var(--colors-body)); padding: 2px 7px; border-radius: 6px;
  font-size: 11.5px; direction: ltr; display: inline-block;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.ir-rescue .acts { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 13px; }

/* ── ۵) نمودار سلامت (ستونی متحرک) ─────────────────────────────────── */
.ir-bars { display: flex; align-items: flex-end; gap: 3px; height: 74px; margin-top: 4px; }
.ir-bars > i {
  flex: 1; min-width: 2px; border-radius: 2px 2px 0 0; display: block;
  background: rgb(var(--colors-green) / .55);
  transform-origin: bottom;
  animation: ir-grow .5s cubic-bezier(.2,.7,.3,1) backwards;
  transition: height .5s cubic-bezier(.2,.7,.3,1), background .3s ease;
}
@keyframes ir-grow { from { transform: scaleY(.05); opacity: .3; } }
.ir-bars > i.warn { background: rgb(var(--colors-orange) / .7); }
.ir-bars > i.crit { background: rgb(var(--colors-red) / .8); }
.ir-bars > i:hover { filter: brightness(1.35); }

/* ── ۶) انیمیشن‌های عمومی که به همهٔ بخش‌ها اضافه می‌شوند ───────────── */
/* کارت‌ها هنگام ورود یکی‌یکی بالا می‌آیند */
.grid > .ps-card, .grid > div > .ps-card {
  animation: cv-rise .44s cubic-bezier(.2,.7,.3,1) backwards;
}
.grid > :nth-child(1) { animation-delay: .02s; }
.grid > :nth-child(2) { animation-delay: .07s; }
.grid > :nth-child(3) { animation-delay: .12s; }
.grid > :nth-child(4) { animation-delay: .17s; }
.grid > :nth-child(5) { animation-delay: .22s; }
.grid > :nth-child(6) { animation-delay: .27s; }
@keyframes cv-rise { from { opacity: 0; transform: translateY(11px); } }

/* ستون‌های جدول با تأخیر پله‌ای */
.tbl tbody tr { animation: cv-fade .34s ease backwards; }
.tbl tbody tr:nth-child(1) { animation-delay: .02s; }
.tbl tbody tr:nth-child(2) { animation-delay: .05s; }
.tbl tbody tr:nth-child(3) { animation-delay: .08s; }
.tbl tbody tr:nth-child(4) { animation-delay: .11s; }
.tbl tbody tr:nth-child(5) { animation-delay: .14s; }
.tbl tbody tr:nth-child(6) { animation-delay: .17s; }
@keyframes cv-fade { from { opacity: 0; transform: translateX(6px); } }

/* نوار پیشرفت: درخشش عبوری */
.bar { position: relative; }
.bar > i { position: relative; overflow: hidden; }
.bar > i::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / .38) 50%, transparent 80%);
  transform: translateX(-100%); animation: cv-gloss 2.6s ease-in-out infinite;
}
@keyframes cv-gloss { 0% { transform: translateX(-100%); } 55%,100% { transform: translateX(200%); } }

/* کاشی آمار: هالهٔ رنگی که با هاور می‌آید */
.stat-tile { transition: transform .24s cubic-bezier(.2,.7,.3,1), box-shadow .24s ease; }
.stat-tile:hover { transform: translateY(-4px); box-shadow: 0 16px 34px -20px rgb(0 0 0 / .75); }
.stat-tile::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; opacity: 0;
  background: radial-gradient(260px 130px at var(--mx, 50%) var(--my, 0%),
              rgb(var(--colors-ghost-blue) / .13), transparent 70%);
  transition: opacity .3s ease; pointer-events: none;
}
.stat-tile:hover::after { opacity: 1; }
/* عدد کاشی هنگام تغییر، یک تپش کوتاه */
.stat-tile .val.bump { animation: cv-bump .42s cubic-bezier(.2,.9,.3,1.2); }
@keyframes cv-bump { 0% { transform: scale(1); } 45% { transform: scale(1.075); } 100% { transform: scale(1); } }

/* آیکون‌ها: چرخش ملایم روی هاور منو */
.main-menu--item:hover .menu-item svg { transform: translateY(-1px) scale(1.1); }
.main-menu--item .menu-item svg { transition: transform .2s cubic-bezier(.2,.7,.3,1), color .15s ease; }

/* دکمه: براقی عبوری */
.ps-button { position: relative; overflow: hidden; }
.ps-button::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 45%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / .3), transparent);
  transform: translateX(-140%); transition: transform .55s cubic-bezier(.2,.7,.3,1);
}
.ps-button:hover::after { transform: translateX(220%); }

/* اسکلت بارگذاری با درخشش */
.sk { border-radius: 8px; background: linear-gradient(90deg,
      rgb(var(--colors-cold-gray) / .07) 25%,
      rgb(var(--colors-cold-gray) / .16) 37%,
      rgb(var(--colors-cold-gray) / .07) 63%);
      background-size: 400% 100%; animation: cv-shimmer 1.35s ease-in-out infinite; }
@keyframes cv-shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* نشان «تازه» برای داده‌های زنده */
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  color: rgb(var(--colors-green)); }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: cv-blink 1.5s ease-in-out infinite; }
@keyframes cv-blink { 0%,100% { opacity: 1 } 50% { opacity: .28 } }

/* ── ۷) احترام به کاربرانی که انیمیشن نمی‌خواهند ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ir-hero::before,
  .ir-hero .ir-orb::before, .ir-hero .ir-orb::after,
  .ir-node .led::after, .ir-bars > i, .bar > i::after,
  .ps-button::after, .sk, .live-pill i, .ir-rescue {
    animation: none !important;
  }
  .grid > .ps-card, .grid > div > .ps-card, .tbl tbody tr { animation: none !important; }
}

/* موبایل: نقشه یک‌ستونه و اعداد کوچک‌تر */
@media (max-width: 640px) {
  .ir-hero { padding: 17px 16px; }
  .ir-hero .ir-verdict { margin-inline-start: 0; width: 100%; justify-content: center; }
  .ir-map { grid-template-columns: 1fr 1fr; }
  .ir-stats { grid-template-columns: 1fr 1fr; }
  .ir-stat .v { font-size: 19px; }
}

/* ── ۸) نشانگر «نت ملی» در هدر ─────────────────────────────────────── */
#ir-pill { cursor: pointer; }
#ir-pill .ir-pill-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: rgb(var(--colors-gray)); position: relative;
  transition: background .3s ease;
}
#ir-pill .ir-pill-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid currentColor; opacity: .5;
  animation: ir-ring 2.2s ease-out infinite;
}
#ir-pill[data-level="ok"]       .ir-pill-dot { background: rgb(var(--colors-green));  color: rgb(var(--colors-green)); }
#ir-pill[data-level="ok"]       { color: rgb(var(--colors-green)); }
#ir-pill[data-level="degraded"] .ir-pill-dot { background: rgb(var(--colors-orange)); color: rgb(var(--colors-orange)); }
#ir-pill[data-level="degraded"] { color: rgb(var(--colors-orange)); }
#ir-pill[data-level="down"]     .ir-pill-dot { background: rgb(var(--colors-red));    color: rgb(var(--colors-red)); }
#ir-pill[data-level="down"]     { color: rgb(var(--colors-red)); border-color: rgb(var(--colors-red) / .4); }
#ir-pill[data-level="down"]     .ir-pill-dot::after { animation-duration: .9s; }
#ir-pill[data-level="unknown"]  .ir-pill-dot::after { animation: none; opacity: 0; }
/* در موبایل متنش جا نمی‌شود؛ فقط چراغ بماند */
@media (max-width: 900px) { #ir-pill .ir-pill-text { display: none; } }
