/* ===== BARRA DE HERRAMIENTAS ===== */
.mapa-toolbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 20px;
  background: white;
  border-bottom: 1px solid #dde3ea;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  flex-wrap: wrap;
  z-index: 10;
  position: relative;
}

.toolbar-grupo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #607d8b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.toolbar-btns {
  display: flex;
  gap: 4px;
}

.toolbar-btn {
  background: #f0f4f8;
  border: 1px solid #dde3ea;
  color: #455a64;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.toolbar-btn:hover {
  background: #e3f2fd;
  border-color: #90caf9;
  color: #1565c0;
}
.toolbar-btn.activo {
  background: #1a6fa0;
  border-color: #1a6fa0;
  color: white;
}
/* Colores de sistemas van inline desde JS (PALETA_SISTEMAS) */

.toolbar-resumen {
  margin-left: auto;
  display: flex;
  gap: 14px;
}
.toolbar-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: #607d8b;
}
.toolbar-stat strong {
  color: #1c2b3a;
  font-size: 0.85rem;
}

/* ===== MAPA LAYOUT ===== */
.mapa-layout {
  display: flex;
  height: calc(100vh - 62px - 42px); /* descontar header + toolbar */
  overflow: hidden;
}

#mapa {
  flex: 1;
  z-index: 1;
}

/* ===== NAV TABS ===== */
.nav-tabs { display: flex; gap: 8px; }
.nav-tab {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  transition: all 0.2s;
}
.nav-tab:hover, .nav-tab.activo {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* ===== PANEL LATERAL ===== */
.panel-lateral {
  width: 300px;
  background: white;
  box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  overflow-y: auto;
  z-index: 2;
  display: flex;
  flex-direction: column;
}

.panel-vacio {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #90a4ae;
  gap: 12px;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.6;
}
.panel-vacio-icono { font-size: 3rem; }

.panel-detalle { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.detalle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid #eceff1;
}
.detalle-header h2 { font-size: 1.1rem; color: #1c2b3a; }
.detalle-fase {
  font-size: 0.72rem;
  font-weight: 700;
  background: #e3f2fd;
  color: #1565c0;
  padding: 3px 10px;
  border-radius: 12px;
}

/* Tanque visual grande en panel */
.detalle-tanque-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tanque-visual.grande {
  width: 70px;
  height: 110px;
  border: 3px solid #b0bec5;
  border-radius: 6px 6px 8px 8px;
  background: #eceff1;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.detalle-pct {
  font-size: 2.4rem;
  font-weight: 800;
  color: #1a6fa0;
}

/* Datos */
.detalle-datos { display: flex; flex-direction: column; gap: 8px; }
.dato-fila {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
}
.dato-label { color: #607d8b; }
.dato-valor { font-weight: 600; color: #1c2b3a; }

/* Mini gráfica */
.detalle-grafica-wrap { margin-top: 4px; }
.detalle-grafica-titulo {
  font-size: 0.72rem;
  font-weight: 600;
  color: #90a4ae;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* ===== PANEL TRAMO ===== */
.panel-tramo {
  padding: 16px;
  flex-direction: column;
  gap: 14px;
}

.vel-barra-wrap { display: flex; flex-direction: column; gap: 4px; position: relative; }
.vel-barra-titulo { font-size: 0.72rem; font-weight: 600; color: #90a4ae; text-transform: uppercase; }
.vel-barra-bg {
  height: 14px;
  background: #eceff1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.vel-barra-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease, background 0.3s;
}
.vel-barra-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #90a4ae;
}
.vel-ref {
  position: absolute;
  top: 20px;
  font-size: 0.6rem;
  color: #b0bec5;
  transform: translateX(-50%);
}

.norma-box {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.norma-titulo { font-size: 0.72rem; font-weight: 700; color: #607d8b; margin-bottom: 4px; }
.norma-fila { font-size: 0.75rem; color: #455a64; display: flex; align-items: center; gap: 6px; }
.dot-color { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* ===== MARCADOR ALERTA DE VELOCIDAD ===== */
.alerta-red {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: transform 0.15s;
  animation: alerta-pulso 2s ease-in-out infinite;
}
.alerta-red:hover { transform: scale(1.3); }

@keyframes alerta-pulso {
  0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
  50%       { box-shadow: 0 0 0 5px rgba(245,127,23,0.2); }
}

/* ===== TOOLTIP DE TRAMO ===== */
.tooltip-tramo {
  background: white !important;
  border: none !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18) !important;
  padding: 10px 14px !important;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
  max-width: 240px;
}
.tooltip-tramo::before { display: none !important; }

/* ===== LEYENDA MAPA ===== */
.leyenda-mapa {
  background: white;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 0.75rem;
  line-height: 1.8;
}
.leyenda-mapa b { display: block; margin-bottom: 4px; color: #1c2b3a; }

/* ===== MARCADORES MAPA ===== */
.marker-tanque {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.marker-circulo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: white;
  transition: all 0.3s;
}
.marker-label {
  background: rgba(255,255,255,0.95);
  color: #1c2b3a;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  margin-top: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  white-space: nowrap;
}

.marker-planta .marker-circulo {
  width: 42px;
  height: 42px;
  font-size: 1rem;
  background: #1a3a5c !important;
}

.marker-fase-tag {
  font-size: 0.58rem;
  font-weight: 700;
  color: white;
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 2px;
  white-space: nowrap;
}

/* ===== ANC POR RAMAL ===== */
.anc-ramal-box {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.anc-ramal-titulo {
  font-size: 0.72rem;
  font-weight: 700;
  color: #607d8b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.anc-ramal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.anc-dato {
  background: white;
  border-radius: 6px;
  padding: 6px 8px;
  border: 1px solid #eceff1;
  text-align: center;
}
.anc-dato-total {
  border-width: 2px;
  grid-column: 1 / -1;
}
.anc-dato-label {
  font-size: 0.67rem;
  color: #90a4ae;
  margin-bottom: 2px;
}
.anc-dato-valor {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1c2b3a;
}
.anc-barra-wrap { display: flex; flex-direction: column; gap: 3px; }
.anc-barra-bg {
  height: 10px;
  background: #eceff1;
  border-radius: 6px;
  overflow: hidden;
}
.anc-barra-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease, background 0.3s;
}
.anc-barra-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: #90a4ae;
}

/* ===== USUARIOS POR RAMAL ===== */
.ramal-usuarios-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ramal-usuarios-titulo {
  font-size: 0.72rem;
  font-weight: 700;
  color: #607d8b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ramal-usuarios-cnt {
  background: #e3f2fd;
  color: #1565c0;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
}
.ramal-usuarios-lista {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ramal-usuario-fila {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 6px;
  border-radius: 5px;
  background: #f8f9fa;
}
.ramal-usuario-fila:hover { background: #e3f2fd; }
.ramal-usuario-cod { font-weight: 700; color: #1a6fa0; font-family: monospace; }
.ramal-usuario-nom { color: #455a64; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ramal-usuario-consumo { text-align: right; white-space: nowrap; }
.ramal-sin-usuarios { font-size: 0.75rem; color: #90a4ae; text-align: center; padding: 10px; }

/* ===== BUSCADOR DEL MAPA ===== */
.toolbar-buscador {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}

.buscador-input {
  width: 100%;
  padding: 5px 32px 5px 12px;
  border: 1px solid #dde3ea;
  border-radius: 20px;
  font-size: 0.78rem;
  color: #1c2b3a;
  background: #f0f4f8;
  outline: none;
  box-sizing: border-box;
  transition: all 0.18s;
}
.buscador-input:focus {
  background: white;
  border-color: #1a6fa0;
  box-shadow: 0 0 0 3px rgba(26,111,160,0.12);
}
.buscador-input::placeholder { color: #90a4ae; }

.buscador-icono {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: #90a4ae;
  pointer-events: none;
}

.buscador-resultados {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #dde3ea;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 9999;
  max-height: 340px;
  overflow-y: auto;
  display: none;
}
.buscador-resultados.visible { display: block; }

.buscador-grupo-titulo {
  font-size: 0.65rem;
  font-weight: 700;
  color: #90a4ae;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px 4px;
  border-top: 1px solid #f0f4f8;
}
.buscador-grupo-titulo:first-child { border-top: none; }

.buscador-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.12s;
}
.buscador-item:hover { background: #f0f4f8; }

.buscador-item-ico {
  font-size: 0.9rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.buscador-item-info { flex: 1; min-width: 0; }
.buscador-item-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1c2b3a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.buscador-item-sub {
  font-size: 0.7rem;
  color: #90a4ae;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.buscador-vacio {
  padding: 16px 12px;
  font-size: 0.8rem;
  color: #90a4ae;
  text-align: center;
}
