/* ============================================================
   PERUN — jednotný vzhľad sieťových stránok: InfiniBand, Ethernet, Sieť uzlov, Sieťový plán.
   Platí pre stránky s triedou .nu-page (dashboard.html). Vzor: Sieťový plán.
   Poradie na stránke: záložky VM → hlavička → dlaždice → vysvetlivky → karty sekcií → detail.
   Načítava sa po perun-ib.css, preto stačí rovnaká špecifickosť.
   ============================================================ */

/* ---------- hlavička a dlaždice ---------- */
.nu-page .sl-page-sub { max-width: 980px; line-height: 1.5; }
.nu-page .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important; gap: 12px !important; margin-bottom: 14px; }
.nu-page .stat { padding: 14px 16px; border-radius: 12px; min-width: 0; }
.nu-page .stat .stat-label { font-size: 12.5px; margin-bottom: 6px; }
.nu-page .stat .stat-value { font-size: 24px !important; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nu-page .stat .nu-sub, .nu-page .stat > div[style*="font-size:11px"] { margin-top: 4px !important; font-size: 11.5px !important; color: var(--text-muted); line-height: 1.4; }
.nu-page .stat .stat-sub { font-size: 11.5px; }

/* ---------- vysvetlivky (rozbaľovacie, stav sa pamätá) ---------- */
.nu-legend, .prio-legend { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; font-size: 12.5px; }
.nu-legend summary, .prio-legend summary { cursor: pointer; font-weight: 600; color: var(--accent-hover); list-style: none; display: flex; align-items: center; gap: 8px; }
.nu-legend summary::-webkit-details-marker, .prio-legend summary::-webkit-details-marker { display: none; }
.nu-legend summary::before, .prio-legend summary::before { content: "ⓘ"; font-size: 14px; }
.nu-legend[open] summary, .prio-legend[open] summary { margin-bottom: 4px; }
.nu-legend-box { margin-bottom: 14px; }
.nu-legend .prio-legend-body p, .prio-legend .prio-legend-body p { margin: 6px 0; }

/* ---------- karty sekcií ---------- */
.nu-page > .card, .nu-page > details.card, .nu-page > div > .card { margin-bottom: 16px; }
.nu-page .card-header { flex-wrap: wrap; gap: 8px 12px; }
.nu-page .card-title { font-size: 15px; }
.nu-count, .nu-page .card-title > span[id] { font-weight: 400 !important; color: var(--text-muted) !important; font-size: 12px !important; margin-left: 4px; }
.nu-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nu-keys { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--text-muted); }
.nu-key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.nu-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 10px; }
.nu-warnline { font-size: 12px; color: var(--warn); margin-bottom: 10px; }
.nu-page .filter-input, .nu-page input[type="search"] { min-width: 200px; }

/* ---------- skupiny (CPU / GPU / VIZ …) ---------- */
.nu-page .ib-grp { grid-column: 1 / -1; font-size: 13px; font-weight: 700; padding: 12px 2px 6px; margin-bottom: 2px; border-bottom: 1px solid var(--border); }
.nu-page .ib-grp:first-child { padding-top: 0; }

/* ---------- panely: switche, karty sietí a závislostí ---------- */
.nu-page .ibp:not(.node), .nu-page .eth-sw, .nu-page .ibf-sw, .np-net, .np-dep {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px;
}
.nu-page .eth-sw { padding: 12px 14px; }

/* ---------- dlaždice uzlov (InfiniBand aj Sieť uzlov) ---------- */
.nu-page .ibp.node, .nu-page .nn-node {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s; position: relative; overflow: hidden;
}
.nu-page .ibp.node:hover, .nu-page .nn-node:hover { border-color: var(--border-strong); }
.nu-page .ibp.node.sel, .nu-page .nn-node.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
/* problém = farebný pásik vľavo, nie celý červený rám (prehľadnejšie pri mnohých uzloch) */
.nu-page .ibp.node.ib-has-problem, .nu-page .nn-node.nn-warn-node { border-color: var(--border) !important; box-shadow: inset 3px 0 0 var(--warn); }
.nu-page .nn-node.nn-bad { border-color: var(--border); box-shadow: inset 3px 0 0 var(--crit); }
.nu-page .ibp.node.sel.ib-has-problem, .nu-page .nn-node.sel.nn-bad { box-shadow: inset 3px 0 0 var(--warn), 0 0 0 1px var(--accent); border-color: var(--accent) !important; }
.nu-node-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.nu-node-head b { font-size: 13px; }
.nu-node-head .nu-badge { margin-left: auto; }
.nu-kv { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 4px; font-size: 11.5px; line-height: 1.55; font-variant-numeric: tabular-nums; }
.nu-kv > span { color: var(--text-muted); }
.nu-kv > b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nu-kv > b.dim { color: var(--text-muted); }
.nu-node-warn { font-size: 11px; color: var(--warn); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nu-node-warn.crit { color: var(--crit); }
.nu-kv .nu-dot { margin-right: 2px; }
.nu-page #vmib-faceplates { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important; }
.nu-node-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }

/* ---------- detailový panel (klik na uzol / port / switch) ---------- */
.nu-page #ib-node-detail, .nu-page #nn-detail, .nu-page #np-detail, .nu-page #vmibsw-detail-card, .nu-page .eth-detail, .nu-page #ibf-detail {
  border: 1px solid var(--accent) !important; border-radius: 12px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.nu-page .eth-detail { background: var(--bg-card); padding: 12px 14px; }

/* ---------- stavové bodky, štítky, čipy ---------- */
.nu-dot, .np-dot, .vmib-led {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle;
  background: var(--text-muted); opacity: .55;
}
.nu-dot.ok, .np-dot.ok, .vmib-led.ok { background: var(--ok); opacity: 1; }
.nu-dot.warn, .vmib-led.warn { background: var(--warn); opacity: 1; }
.nu-dot.bad, .nu-dot.crit, .np-dot.bad, .vmib-led.bad { background: var(--crit); opacity: 1; }
.nu-badge, .np-badge, .ibp-top {
  display: inline-block; font-size: 10.5px; font-weight: 600; line-height: 16px; border: 1px solid var(--accent);
  color: var(--accent-hover); border-radius: 6px; padding: 0 6px; white-space: nowrap;
}
.nu-badge.muted, .np-badge.muted { border-color: var(--border); color: var(--text-muted); font-weight: 500; }
.nu-badge.ok { border-color: var(--ok); color: var(--ok); }
.nu-badge.warn { border-color: var(--warn); color: var(--warn); }
.nu-badge.crit { border-color: var(--crit); color: var(--crit); }
.nu-page .dn-chip { border-radius: 6px; }

/* ---------- tabuľky ---------- */
.nu-page .alerts-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.nu-page .alerts-table td { font-variant-numeric: tabular-nums; }
.nu-page .alerts-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* ---------- InfiniBand: záložky sekcií v rovnakom štýle ---------- */
.nu-page .ib-sectabs { margin-bottom: 14px; }
.nu-page .ib-overview > .card { margin-bottom: 16px; }

/* ---------- mobil ---------- */
@media (max-width: 640px) {
  .nu-page .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .nu-page .stat { padding: 10px 12px; }
  .nu-page .stat .stat-value { font-size: 19px !important; }
  .nu-tools { margin-left: 0; width: 100%; }
  .nu-page .filter-input, .nu-page input[type="search"] { min-width: 0; width: 100%; }
  .nu-node-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- InfiniBand switche: bunky portov ako na stránke Ethernet ---------- */
.ibs-panel { padding: 12px 14px !important; }
.ibs-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ibs-head > b { font-size: 15px; }
.ibs-scroll { overflow-x: auto; padding-bottom: 4px; }
.ibs-row { display: flex; gap: 14px 16px; flex-wrap: wrap; align-items: flex-start; }
.ibs-peers { display: flex; gap: 8px; flex-wrap: wrap; }
.ibs-peer { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--bg-card); }
.ibs-peer.warn { border-color: var(--warn); }
.ibs-peer-h { display: flex; gap: 6px; align-items: baseline; font-size: 12px; margin-bottom: 5px; white-space: nowrap; }
.ibs-peer-e { font-size: 10.5px; font-weight: 700; color: var(--warn); }
.ibs-mini { display: grid; grid-template-rows: repeat(2, auto); grid-auto-flow: column; gap: 3px; }
.ibs-cell.mini { width: 30px; height: 24px; padding: 4px 1px 1px; }
.ibs-cell.mini b, .ibs-cell.mini em { display: none; }
.ibs-cell.mini .ibs-n { position: static; display: block; font-size: 9.5px; color: var(--text); text-align: center; }
.ibs-cell.mini .ibs-e { top: -1px; right: 1px; font-size: 8px; }
.ibs-up { padding-left: 14px; border-left: 2px dashed var(--border-strong); }
.ibs-glabel { font-size: 10.5px; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.ibs-grid { display: grid; grid-template-rows: repeat(2, auto); grid-auto-flow: column; gap: 4px; }
.ibs-cell {
  position: relative; width: 56px; height: 40px; box-sizing: border-box; padding: 13px 3px 3px; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border); text-align: center; font-size: 10.5px; line-height: 1.15;
  cursor: pointer; overflow: hidden; transition: border-color .12s;
}
.ibs-cell:hover { border-color: var(--border-strong); }
.ibs-cell.sw { background: color-mix(in srgb, var(--accent) 13%, var(--bg-card)); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.ibs-cell b { display: block; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ibs-cell em { display: block; font-style: normal; font-size: 8.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.ibs-n { position: absolute; top: 2px; left: 4px; font-size: 8.5px; color: var(--text-muted); }
.ibs-e { position: absolute; top: 1px; right: 3px; font-size: 9px; font-weight: 700; color: var(--warn); }
.ibs-cell.warn { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.ibs-cell.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.ibs-util { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); border-radius: 0 2px 0 0; }
.ibs-sw-key { display: inline-block; width: 14px; height: 10px; border-radius: 3px; border: 1px solid var(--border-strong); background: var(--bg-card); }
.ibs-sw-key.sw { background: color-mix(in srgb, var(--accent) 25%, var(--bg-card)); border-color: var(--accent); }
.ibs-sw-key.warn { border: 2px solid var(--warn); }

/* ---------- všetky tabuľky: triedenie a vysvetlenie stĺpca (perun-tables.js), vysvetlivky stránok (perun-legends.js) ---------- */
th.pt-sortable { cursor: pointer; user-select: none; }
th.pt-sortable:hover { color: var(--accent-hover) !important; }
th.pt-help { text-decoration: underline dotted color-mix(in srgb, var(--text-muted) 60%, transparent); text-underline-offset: 3px; }
.pt-arrow { font-size: 10px; color: var(--accent-hover); }
[data-auto-legend] { margin-bottom: 14px; }
.pl-tip { color: var(--text-muted); font-size: 11.5px; margin-top: 8px !important; }

/* ---------- grafy v riadku 1 / 2 / 3 na každej stránke (perun-layout.js) ---------- */
.nu-colsbar { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin: 0 0 12px; }
.nu-colsbar-l { font-size: 12px; color: var(--text-muted); margin-right: 4px; cursor: help; }
.nu-chartgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.nu-chartgrid > .card, .nu-chartgrid > .sl-card { margin: 0 !important; min-width: 0; }
.nu-cg[data-cols="1"] { grid-template-columns: minmax(0, 1fr) !important; }
.nu-cg[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.nu-cg[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.nu-cg > * { min-width: 0; }
@media (max-width: 820px) { .nu-cg[data-cols] { grid-template-columns: minmax(0, 1fr) !important; } }

/* ===== Jednotný výber obdobia (perun-period.js → .pp-bar) — rovnaký na každej stránke ===== */
.pp-host { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vm-rangebar.pp-host { justify-content: flex-start !important; }
.period-toggle.pp-host { background: none !important; border: none !important; padding: 0 !important; box-shadow: none !important; }
.pp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pp-bar > button,
.pp-bar > button.fbtn,
.pp-bar > button.period-btn,
.pp-bar > button.period-btn-sm {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  padding: 6px 14px; border-radius: 10px; border: 1px solid var(--border-strong, var(--border));
  background: var(--bg-card); color: var(--text-muted); box-shadow: none;
  font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.4; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s, box-shadow .15s;
}
.pp-bar > button:hover { color: var(--text); background: var(--bg-hover); border-color: var(--border-strong, var(--border)); }
.pp-bar > button.active,
.pp-bar > button.active:hover {
  color: var(--text); background: var(--bg-elevated, var(--bg-card));
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
.pp-bar > .vm-custom-box { gap: 6px; align-items: center; }
@media (max-width: 700px) { .pp-bar > button { padding: 5px 10px; font-size: 12px; } }

/* ===== Správa po prihlásení (MOTD) — perun-motd.js ===== */
.motd-help { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.motd-help code { font-family: var(--font-mono, monospace); background: var(--bg-input); padding: 0 4px; border-radius: 4px; }
.motd-editors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .motd-editors { grid-template-columns: 1fr; } }
.motd-ed { display: flex; flex-direction: column; gap: 6px; }
.motd-ed-h { font-size: 12.5px; font-weight: 600; display: flex; justify-content: space-between; }
.motd-ed textarea { width: 100%; box-sizing: border-box; min-height: 190px; resize: vertical; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong, var(--border)); background: var(--bg-input); color: var(--text);
  font-family: var(--font-mono, monospace); font-size: 13px; line-height: 1.5; }
.motd-ed textarea:focus { outline: none; border-color: var(--accent); }
.motd-count { font-size: 11.5px; font-weight: 400; color: var(--text-muted); }
.motd-count.motd-over { color: var(--crit, #e5484d); font-weight: 600; }
.motd-status { font-size: 12px; color: var(--text-muted); }
.motd-status.motd-ok { color: var(--ok, #30a46c); }
.motd-status.motd-bad { color: var(--crit, #e5484d); }
.motd-status.motd-warn { color: var(--warn, #f5a524); }
.motd-term, .motd-code { margin: 0; padding: 14px 16px; border-radius: 10px; background: #0b0d10; color: #d6dae0; border: 1px solid var(--border);
  font-family: var(--font-mono, monospace); font-size: 12.5px; line-height: 1.45; overflow-x: auto; white-space: pre; max-height: 640px; }
.motd-term .motd-muted { color: #6b7280; font-style: italic; }
.motd-term .motd-ann { color: #fff; }
.motd-term b { color: #fff; }

/* ===== Rezervácie Slurmu v mape nodov (Bežiace a čakajúce joby, Nody) ===== */
.node-resv-tag {
  position: absolute; top: 3px; right: 3px; min-width: 14px; height: 14px; padding: 0 3px; box-sizing: border-box;
  border-radius: 4px; font: 700 9.5px/14px var(--font-mono, monospace); text-align: center;
  background: #a855f7; color: #fff; border: 1px solid #a855f7; z-index: 1;
}
.node-resv-tag.node-resv-future { background: transparent; color: #c084fc; border-color: #c084fc; }
.node-resv-tag.node-resv-legend { position: relative; top: auto; right: auto; display: inline-block; vertical-align: middle; }
.node-cell.node-resv { box-shadow: inset 0 0 0 1px #a855f7; }
