/* SysMon v4 — Estilos principales · IT Services 268 */

:root {
  --bg-base:    #000000;
  --bg-card:    #0A0A0A;
  --bg-card2:   #111111;
  --bg-hover:   #1A1A1A;
  --border:     #2A2A2A;
  --border-dim: #181818;
  --text:       #FFFFFF;
  --text-dim:   #AAAAAA;
  --text-muted: #555555;
  --ok:         #50FA7B;
  --ok-dim:     #0A2014;
  --cyan:       #50FA7B;
  --cyan-dim:   #0A2014;
  --red:        #FF5555;
  --red-dim:    #2A0A0A;
  --yellow:     #F1FA8C;
  --yellow-dim: #2A2A0A;
  --purple:     #BD93F9;
  --orange:     #FFB86C;
  --pink:       #FF79C6;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --sans: 'Inter', system-ui, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ── */
header {
  background: #050505;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.logo-text {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ok);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hostname {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  background: #0A0A0A;
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
}

.header-right { display: flex; align-items: center; gap: 16px; }

#ts { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

.client-ip {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  background: #0A0A0A;
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
}
.client-ip span { color: var(--ok); }

.ws-indicator {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
}

.ws-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}
.ws-dot.connected { background: var(--ok); box-shadow: 0 0 7px var(--ok); animation: pulse-ok 2s infinite; }
.ws-dot.error     { background: var(--red); }

@keyframes pulse-ok {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

#refresh-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ok);
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}
#refresh-btn:hover { background: var(--ok-dim); border-color: var(--ok); }

/* ── Layout ── */
main { padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 20px; }

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-dim);
}

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }

/* ── Metric cards ── */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.metric-card:hover { border-color: #3A3A3A; }
.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--border));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.card-value {
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--ok);
  transition: color 0.3s;
}

.card-sub  { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }

.card-status {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ok);
  margin-top: 2px;
  font-weight: 500;
}

.bar-track { height: 4px; background: var(--bg-hover); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 2px; background: var(--ok); transition: width 0.8s ease, background 0.3s; }

.security-card { --accent: var(--red); }
.security-card .card-value { color: var(--red); }

.uptime-card { --accent: var(--purple); }
.uptime-card .card-value { font-size: 22px; color: var(--purple); }

/* ── Services ── */
.service-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: default;
}

.svc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.svc-dot.active   { background: var(--ok);     box-shadow: 0 0 6px var(--ok); }
.svc-dot.inactive { background: var(--red); }
.svc-dot.unknown  { background: var(--yellow); }

.svc-name {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--text); text-align: center; text-transform: uppercase; letter-spacing: 0.06em;
}
.svc-status-text { font-family: var(--sans); font-size: 11px; color: var(--text-muted); }
.svc-status-text.active   { color: var(--ok); }
.svc-status-text.inactive { color: var(--red); }

/* ── Panel ── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  min-height: 220px;
}

.panel-title {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; color: var(--text-dim); text-transform: uppercase;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-dim);
}

/* ── Process list ── */
.proc-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px solid var(--border-dim);
}
.proc-row:last-child { border-bottom: none; }
.proc-name {
  font-family: var(--mono); font-size: 13px; color: var(--ok);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 12px;
}
.proc-cpu  { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text); min-width: 54px; text-align: right; }
.proc-bar-wrap { width: 80px; height: 3px; background: var(--bg-hover); border-radius: 2px; margin-left: 12px; overflow: hidden; }
.proc-bar-inner { height: 100%; border-radius: 2px; background: var(--ok); }

/* ── Disk ── */
.disk-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border-dim);
}
.disk-row:last-child { border-bottom: none; }
.disk-mount  { font-family: var(--mono); font-size: 13px; color: var(--ok); min-width: 80px; }
.disk-usage-bar { flex: 1; height: 5px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.disk-usage-fill { height: 100%; border-radius: 3px; background: var(--ok); transition: width 0.8s ease, background 0.3s; }
.disk-pct  { font-family: var(--mono); font-size: 13px; font-weight: 700; min-width: 38px; text-align: right; }
.disk-size { font-family: var(--mono); font-size: 12px; color: var(--text-dim); min-width: 90px; text-align: right; }

/* ── Services grid (dentro del panel eventos) ── */
.svc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

/* ── Network ── */
.net-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.net-card {
  background: var(--bg-card2);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.net-card-name {
  font-family: var(--mono); font-size: 13px; color: var(--ok);
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border-dim);
}
.net-card-stat {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0;
}
.net-card-stat .label { font-family: var(--mono); font-size: 10px; color: var(--text-muted); letter-spacing: 0.08em; }
.net-card-stat .val   { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--text); }

/* ── Charts ── */
.chart-wrap { position: relative; height: 160px; width: 100%; margin-top: 8px; }

/* ── Per-core ── */
.core-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px; margin-top: 10px;
}
.core-cell {
  background: #050505; border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 6px; text-align: center;
}
.core-idx { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.core-val { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--ok); margin-top: 2px; }

/* ── Load avg ── */
.load-row { display: flex; gap: 20px; margin-top: 8px; flex-wrap: wrap; }
.load-item { display: flex; flex-direction: column; align-items: center; }
.load-period { font-family: var(--mono); font-size: 10px; color: var(--text-muted); letter-spacing: 0.1em; }
.load-val    { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--ok); }

/* ── Events ── */
.event-entry {
  font-family: var(--mono); font-size: 12px; color: #FFFFFF;
  padding: 5px 0; border-bottom: 1px solid var(--border-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-entry:last-child { border-bottom: none; }
.event-entry .ev-type {
  color: var(--red); font-weight: 700; margin-right: 8px;
  background: var(--red-dim); padding: 1px 6px; border-radius: 3px; font-size: 11px;
}

/* ── Alert banner ── */
#alert-banner {
  display: none;
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: var(--mono); font-size: 13px; color: var(--red);
  margin-bottom: 4px;
  animation: blink-border 1.5s infinite;
}
@keyframes blink-border {
  0%, 100% { border-color: var(--red); }
  50%       { border-color: transparent; }
}

/* ── IPs Baneadas — Geo ── */
.geo-panel { min-height: auto; }

.ip-geo-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ip-geo-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.ip-geo-tab-btn:hover    { color: var(--text); }
.ip-geo-tab-btn.active   { color: var(--ok); border-bottom-color: var(--ok); }

/* Dominio */
.domain-item {
  border-bottom: 1px solid var(--border-dim);
  padding: 9px 0;
}
.domain-item:last-child { border-bottom: none; }

.domain-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px;
}
.domain-name  { font-family: var(--mono); font-size: 13px; color: var(--ok); font-weight: 500; }
.domain-count {
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  background: var(--bg-hover); padding: 2px 8px; border-radius: 4px;
}
.domain-countries { display: flex; flex-wrap: wrap; gap: 5px; }
.domain-ctag {
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  background: var(--bg-card2); border: 1px solid var(--border-dim);
  padding: 2px 7px; border-radius: 4px;
}

/* País */
.country-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--border-dim);
}
.country-row:last-child { border-bottom: none; }
.country-rank  { font-family: var(--mono); font-size: 11px; color: var(--text-muted); min-width: 22px; text-align: right; }
.country-flag  { font-size: 16px; min-width: 22px; line-height: 1; }
.country-name  { font-family: var(--sans); font-size: 13px; color: var(--text); flex: 1; }
.country-bar-wrap { width: 80px; height: 4px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; }
.country-bar-fill { height: 100%; border-radius: 2px; background: var(--red); transition: width 0.6s ease; }
.country-count { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--red); min-width: 30px; text-align: right; }
.country-pct   { font-family: var(--mono); font-size: 11px; color: var(--text-muted); min-width: 46px; text-align: right; }

.geo-summary {
  font-family: var(--mono); font-size: 11px; color: var(--text-muted);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: var(--bg-card2);
  border-radius: 6px;
  border: 1px solid var(--border-dim);
}

/* ── Responsive ── */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) {
  .grid-4, .grid-3, .grid-2, .grid-5 { grid-template-columns: 1fr 1fr; }
  main { padding: 16px; }
}
@media (max-width: 500px) {
  .grid-4, .grid-3, .grid-2, .grid-5 { grid-template-columns: 1fr; }
}
