/* ==========================================================================================
   SYSTEM MONITOR — Deckard HUD aligned version
   Fits the new HUD grid cell (bottom-right). No absolute positioning.
========================================================================================== */

#system-monitor {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: "Share Tech Mono", monospace;
  color: #8b9bb0;
  text-shadow: none;
  background: linear-gradient(180deg, rgba(16, 23, 32, 0.94) 0%, rgba(11, 17, 23, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 16px 18px;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

#system-monitor::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015), transparent 45%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.012) 0,
      rgba(255, 255, 255, 0.012) 1px,
      transparent 2px,
      transparent 4px
    );
  opacity: 0.3;
}

#system-monitor > * {
  position: relative;
  z-index: 1;
}

#system-monitor.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==== HEAD ==== */
#system-monitor .sm-head {
  font-size: 14px;
  font-weight: 600;
  color: #5f6b7a;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 1;
  margin-bottom: 4px;
}

/* ==== BODY ==== */
#system-monitor .sm-body {
  flex: 1;                       /* IMPORTANT: allows proper scaling */
  min-height: 0;                 /* allows scrollable/flexible feed */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==== METER BARS ==== */
.deckard-bar {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.deckard-bar .label {
  font-size: 0.9rem;
  opacity: 0.86;
  color: #8b9bb0;
}

.bar-bg {
  position: relative;
  height: 18px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border-radius: 6px;
}

.bar-fill {
  height: 100%;
  width: 0%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  transition: width 1.2s ease;
  background: linear-gradient(90deg, #0a6a8a, #00e0ff);
}

.bar-fill .value {
  font-size: 0.85rem;
  margin-right: 6px;
  color: #e6edf3;
}

/* ==== Network / SYS stats ==== */
.deckard-net,
.deckard-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-top: 6px;
  opacity: 0.9;
}

.deckard-meta {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 6px;
}

/* ==== VIDEO FEED ==== */
#server-feed {
  flex: 1;                  /* instead of flex-grow */
  min-height: 0;            /* allow card to determine final height */
  max-height: none;         /* remove the 180px choke */

  margin-top: 6px;
  width: 100%;

  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #070b10 0%, #06090d 100%);
  position: relative;
}

#server-feed video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7) contrast(1.25) saturate(0.9);
}

.feed-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
}

.feed-label {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 0.78rem;
  color: #5f6b7a;
  letter-spacing: 1px;
}

@keyframes flicker {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.7; }
}

/* ==== LOAD-BASED VIDEO FILTERS ==== */
#server-feed.high-load video {
  filter: brightness(0.55) contrast(1.3) saturate(0.8) hue-rotate(-10deg);
}

#server-feed.medium-load video {
  filter: brightness(0.7) contrast(1.2) saturate(0.9);
}

#server-feed.low-load video {
  filter: brightness(0.85) contrast(1.05);
}

/* ==== GLITCH EFFECT ==== */
.feed-overlay.glitch {
  animation: glitchPulse 0.2s steps(2, start) infinite;
}

@keyframes glitchPulse {
  0% { opacity: 0.9; transform: translate(0); }
  25% { opacity: 0.6; transform: translate(-2px, 1px); }
  50% { opacity: 0.3; transform: translate(2px, -2px); }
  75% { opacity: 0.8; transform: translate(-1px, 2px); }
  100% { opacity: 0.9; transform: translate(0); }
}


/* ==========================================================================================
   EVENT TICKER (bottom scroll text)
========================================================================================== */

#deckard-ticker {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 28px;
  overflow: hidden;
  background: #080c10;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-family: "Share Tech Mono", monospace;
  font-size: 0.92rem;
  color: #8b9bb0;
  white-space: nowrap;
  z-index: 50;
}

#ticker-track {
  position: absolute;
  top: 0; left: 0;
  width: 200%;
  display: flex;
  animation: tickerScroll 25s linear infinite;
}

#ticker-content {
  flex: 0 0 50%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 40px;
  padding-left: 100%;
}

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.ticker-system   { color: #8b9bb0; }
.ticker-asterisk { color: #00e0ff; }
.ticker-vicidial { color: #8b9bb0; }
.ticker-fail2ban { color: #e07078; }
.ticker-neutral  { color: #5f6b7a; }

.hud-controls {
  position: fixed;
  bottom: 10px;
  right: 20px;
  z-index: 10;
}
