/* HYPDB.ONE — JARVIS Live-Widget (Aktivität · Ressourcen · Topologie)
   Nutzt ausschliesslich die vorhandenen CSS-Variablen aus jarvis-os-shared.css. */

/* ---------- Kopfzeilen-Block (oben rechts, auf jeder Seite) ---------- */
.jw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.jw-head-mini {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border-panel);
  background: rgba(0, 0, 0, .38);
  padding: 3px 8px;
  font-size: 9px;
  letter-spacing: .6px;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
}
.jw-head-mini b {
  color: var(--neon-green);
  font-weight: 700;
}
.jw-head-mini .jw-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
  flex-shrink: 0;
}
.jw-head-mini.jw-offline .jw-dot { background: var(--alert-red); box-shadow: 0 0 6px var(--alert-red); }
.jw-head-mini.jw-offline b { color: var(--alert-red); }

/* ---------- Panel-Bausteine ---------- */
.jw-panel {
  border: 1px solid var(--border-panel);
  background: var(--bg-panel);
  margin-bottom: 16px;
}
.jw-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border-panel);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--neon-green);
  text-shadow: var(--glow);
}
.jw-panel-head .jw-src {
  font-size: 8px;
  letter-spacing: .5px;
  color: var(--text-muted);
  text-transform: none;
  text-shadow: none;
}
.jw-panel-body { padding: 12px 13px; }

.jw-badge {
  font-size: 8px;
  letter-spacing: 1px;
  padding: 2px 7px;
  border: 1px solid var(--border-panel);
  text-transform: uppercase;
}
.jw-badge.jw-ok { color: var(--neon-green); border-color: var(--neon-dark); }
.jw-badge.jw-warnb { color: var(--alert-orange); border-color: rgba(255, 170, 0, .45); }
.jw-badge.jw-off { color: var(--alert-red); border-color: rgba(255, 51, 51, .45); }

/* ---------- Aktivität ---------- */
.jw-activity {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.7;
  max-height: 168px;
  overflow-y: auto;
}
.jw-log { display: flex; gap: 7px; align-items: baseline; padding: 2px 0; }
.jw-time { color: var(--text-muted); min-width: 52px; flex-shrink: 0; }
.jw-lv { flex-shrink: 0; }
.jw-lv.jw-info { color: var(--neon-green); }
.jw-lv.jw-warn { color: var(--alert-orange); }
.jw-lv.jw-err { color: var(--alert-red); }
.jw-msg { color: var(--text-dim); word-break: break-word; }

/* ---------- Ressourcen ---------- */
.jw-res {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}
.jw-res-item { text-align: center; }
.jw-gauge { width: 58px; height: 58px; display: block; margin: 0 auto 3px; }
.jw-ring-track { fill: none; stroke: rgba(0, 255, 65, .12); stroke-width: 5; }
.jw-ring-fill {
  fill: none; stroke: var(--neon-green); stroke-width: 5;
  stroke-linecap: round; stroke-dasharray: 157;
  /* stroke-dashoffset wird ausschliesslich von JS gesetzt (gauge()).
     Eine statische CSS-Regel hier blockiert das Attribut/Inline-Style
     in Chromium bei SVG dauerhaft (Ring bliebe leer). */
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset .6s ease;
}
/* Basis-Styles auch fuer die Dashboard-Panel-Klassen (ring-track/ring-fill ohne jw-Prefix,
   genutzt z. B. in jarvis-os-screen2-dashboard.html). Ohne diese Regeln rendern die
   Kreise als leere Umrisse. */
.ring-track { fill: none; stroke: rgba(0, 255, 65, .12); stroke-width: 5; }
.ring-fill {
  fill: none; stroke: var(--neon-green, #00FF41); stroke-width: 5;
  stroke-linecap: round; stroke-dasharray: 157;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset .6s ease;
}
.jw-res-val { font-size: 12px; color: var(--neon-green); font-family: var(--font-mono); }
.jw-res-label { font-size: 8px; letter-spacing: 1px; color: var(--text-dim); text-transform: uppercase; }

.jw-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 12px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border-panel);
  font-size: 9px;
  color: var(--text-dim);
}
.jw-meta span b { color: var(--neon-green); font-weight: 700; }

/* ---------- Topologie (modernisiert) ---------- */
.jw-topo-wrap { position: relative; height: 130px; }
.jw-topo { width: 100%; height: 130px; display: block; }
.jw-topo-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 7px; font-size: 8px; color: var(--text-muted); letter-spacing: .6px;
}
/* Knoten: sanftes Atmen + Hover-Highlight */
.jw-node { transition: opacity .3s ease; cursor: pointer; }
.jw-node-off { opacity: .75; }
.jw-node:hover { opacity: 1; }
.jw-node:hover > circle:nth-child(2) { filter: drop-shadow(0 0 4px #00FF41); }
.jw-node-on > circle:first-child {
  animation: jwNodeBreathe 3s ease-in-out infinite;
  transform-origin: center;
}
.jw-node-on > circle:first-child { transform-box: fill-box; }
@keyframes jwNodeBreathe {
  0%, 100% { opacity: .10; }
  50% { opacity: .28; }
}
/* Linien: Datenfluss-Puls */
.jw-line-pulse {
  stroke-dasharray: 4 3;
  animation: jwLineFlow 1.6s linear infinite;
}
@keyframes jwLineFlow {
  from { stroke-dashoffset: 14; }
  to { stroke-dashoffset: 0; }
}
/* Zentrum: Puls-Ring */
.jw-center-pulse {
  transform-origin: center;
  transform-box: fill-box;
  animation: jwCenterPulse 2.4s ease-out infinite;
}
@keyframes jwCenterPulse {
  0% { transform: scale(.6); opacity: .7; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .jw-node-on > circle:first-child,
  .jw-line-pulse,
  .jw-center-pulse { animation: none; }
}

@media (max-width: 1100px) {
  .jw-res { grid-template-columns: repeat(2, 1fr); }
  .jw-head-mini { display: none; }
  .jw-head-mini.jw-always { display: flex; }
}
@media (max-width: 700px) {
  .jw-head-mini { display: none; }
  .jw-head-mini.jw-always { display: flex; }
  .jw-meta { grid-template-columns: 1fr; }
}
