/* ═══════════════════════════════════════════════════════════════
   iot.css — Módulo IoT Monitor (Fase IoT-2).
   KPIs/paneles/tablas reusan .seg-kpis, .mon-panel y .explorer-table
   (ya cargados por seguridad.css/monitor.css) para ser coherente con
   esos módulos, sin duplicar esa estructura acá. Solo lo específico
   de IoT (tarjetas de nodo, badge de prueba, empty-state) vive acá.
   Cero hex hardcodeado propio de tema: todo sale de las variables de
   base.css/themes.css.
   ═══════════════════════════════════════════════════════════════ */

/* ── Mapa de ubicación (Paso 2B) — Leaflet local, sin CDN.
   Altura fija: Leaflet no renderiza en un contenedor de alto 0/auto. */
.iot-map {
  height: 360px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--bsub);
}
.iot-map-placeholder {
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--t2);
  background: var(--bg3);
  border-radius: 12px;
  border: 1px dashed var(--bsub);
  padding: 20px;
}
/* leaflet.css le pone fondo blanco + borde gris a .leaflet-div-icon por
   defecto (pensado para íconos custom "cuadrados") — sin esto, el
   punto esmeralda del marcador queda tapado por ese fondo blanco. */
.woli-map-marker {
  background: transparent !important;
  border: none !important;
}

/* ── Telemetría Ambiental (Paso 2A) — tarjetas GRANDES, estilo
   distinto al compacto de .seg-kpi: ícono en badge arriba, valor
   grande centrado, unidad al lado, subtexto de estado por color. ── */
.iot-env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.iot-env-card {
  background: var(--bg3);
  border: 1px solid var(--bsub);
  border-radius: 14px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transition: border-color .2s, box-shadow .2s;
}
.iot-env-card:hover {
  border-color: var(--bacc);
  box-shadow: 0 6px 18px rgba(0,0,0,.3), 0 0 0 1px rgba(16,185,129,.2);
}
.iot-env-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--g);
  background: color-mix(in srgb, var(--g) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--g) 30%, transparent);
  margin-bottom: 4px;
}
.iot-env-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--t1);
  line-height: 1.1;
  font-family: ui-monospace, 'SF Mono', 'Consolas', monospace;
}
.iot-env-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--t2);
  margin-left: 3px;
}
.iot-env-label {
  font-size: 12px;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.iot-env-sub {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}
.iot-env-ok      { color: var(--g); }
.iot-env-alert   { color: var(--amber); }
.iot-env-neutral { color: var(--t3); }
.iot-env-muted   { color: var(--t2); font-weight: 400; font-style: italic; }

/* ── Grilla de tarjetas de nodo ─────────────────────────────────── */
.iot-nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.iot-node-card {
  background: var(--bg3);
  border: 1px solid var(--bsub);
  border-left: 3px solid var(--gm);
  border-radius: 10px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s, box-shadow .2s;
}
.iot-node-card:hover {
  border-color: var(--bacc);
  box-shadow: 0 6px 18px rgba(0,0,0,.3), 0 0 0 1px rgba(16,185,129,.2);
}

.iot-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.iot-node-id {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--t1);
}
.iot-node-status {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
}
.iot-status-on  { color: var(--g); }
.iot-status-off { color: var(--t2); }

/* Punto de estado — verde late si está online, gris fijo si no */
.iot-node-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.iot-dot-on {
  background: var(--g);
  animation: iotLatido 1.6s ease-in-out infinite;
}
.iot-dot-off {
  background: var(--t2);
}
@keyframes iotLatido {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .45; transform: scale(1.4); }
}

.iot-node-meta {
  font-size: 13px;
  color: var(--t2);
}

/* Badge "PRUEBA" — transparencia de que el nodo es de test, no dato real */
.iot-badge-prueba {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
}

/* ── Sensores dentro de la tarjeta de nodo ──────────────────────── */
.iot-node-sensors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.iot-sensor-chip {
  background: var(--bg2);
  border: 1px solid var(--bsub);
  border-radius: 7px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.iot-sensor-type {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--t1);
}
.iot-sensor-metrics {
  font-size: 12.5px;
  color: var(--t2);
}
.iot-sensor-hw {
  font-size: 12px;
  color: var(--t3);
}
.iot-node-sin-sensores {
  font-size: 13px;
  color: var(--t2);
  font-style: italic;
}

/* ── Empty-state honesto (sin nodos conectados) ─────────────────── */
.iot-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 20px;
  color: var(--t2);
}
.iot-empty i {
  font-size: 30px;
  color: var(--bacc);
  margin-bottom: 10px;
  display: block;
}
.iot-empty-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 4px;
}
.iot-empty-sub {
  font-size: 13.5px;
  color: var(--t2);
}
