/* ============================================================
   GPSHUB Panel de Flota  (rediseño /routes — Fase 2)
   Mismo design system ghc-* que el panel de controles. Las
   variables :root (--ghc-*) viven en map-control-panel.css y NO
   se redefinen acá. Adaptado de la referencia visual aprobada
   MDDocuments/gpshub-panel-flota.html (íconos Tabler → Font
   Awesome Pro 5.2; contenedor convertido a drawer deslizante).
   ============================================================ */

/* ---------- contenedor (tarjeta flotante anclada a la izquierda del mapa) ----------
   Mismo shell flotante que .ghc-drawer (panel-common.css): separada 12px de los bordes,
   borde completo + radius + sombra. Ancho pensado para que los 3 chips de filtro
   (Todos / En línea / Sin reporte) entren en una sola línea sin envolver. */
.ghc-fleet {
  position: fixed;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 380px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  background: var(--ghc-bg);
  /* borde azul grueso + sombra azulada: despega el panel del mapa claro (mismo acento --ghc-primary) */
  border: 2.5px solid var(--ghc-primary);
  border-radius: var(--ghc-radius);
  box-shadow: 0 4px 16px rgba(24, 95, 165, .25);
  overflow: hidden;
  color: var(--ghc-text);
  font-family: var(--ghc-font);
  z-index: 1100;
  transform: translateX(calc(-100% - 24px));
  transition: transform .3s ease;
}
.ghc-fleet.ghc-fleet-open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .ghc-fleet { transition: none; }
}

/* ---------- header (azul sólido, resalta contra el mapa) ---------- */
.ghc-fleet-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--ghc-primary);
  border-bottom: none;
  flex-shrink: 0;
}
.ghc-fleet-header > i { font-size: 20px; color: #fff; }
.ghc-fleet-title { font-size: 16px; font-weight: 600; flex: 1; color: #fff; }
.ghc-iconbtn {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--ghc-text-muted);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.ghc-iconbtn:hover { background: #f3f4f6; color: var(--ghc-text); }
.ghc-iconbtn[aria-pressed="true"] { color: var(--ghc-primary); }

/* botones del header sobre fondo azul (scopeados: .ghc-iconbtn/.ghc-eye son primitivos
   globales reutilizados en listas/drawers; acá solo dentro del header de Flota).
   Botones: admin-grupos, tres-puntos y cerrar (.ghc-iconbtn) + mostrar/ocultar todas (.ghc-eye). */
.ghc-fleet-header .ghc-iconbtn { color: #cfe0f0; }
.ghc-fleet-header .ghc-iconbtn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.ghc-fleet-header .ghc-eye { color: #fff; }
.ghc-fleet-header .ghc-eye:hover { background: rgba(255, 255, 255, .15); }
.ghc-fleet-header .ghc-eye[aria-pressed="false"] { color: rgba(255, 255, 255, .55); }
.ghc-fleet-header .ghc-iconbtn:focus-visible,
.ghc-fleet-header .ghc-eye:focus-visible { outline-color: #fff; }

/* ---------- menú de tres puntos ---------- */
.ghc-menu-wrap { position: relative; display: flex; }
.ghc-menu-backdrop { position: fixed; inset: 0; z-index: 9; }
.ghc-menu {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 10;
  min-width: 190px;
  padding: 4px;
  background: var(--ghc-bg);
  border: 1px solid var(--ghc-border);
  border-radius: var(--ghc-radius);
  box-shadow: var(--ghc-shadow);
}
.ghc-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  color: var(--ghc-text);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.ghc-menu-item:hover { background: #f3f4f6; }
.ghc-menu-item i { font-size: 16px; width: 18px; color: var(--ghc-text-muted); }

/* ---------- buscador + chips ---------- */
.ghc-fleet-filters { padding: 10px 12px; border-bottom: 1px solid var(--ghc-border); flex-shrink: 0; }
.ghc-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ghc-border);
  border-radius: var(--ghc-radius);
  padding: 0 10px;
}
.ghc-search i { font-size: 17px; color: var(--ghc-text-muted); }
.ghc-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 0;
  background: transparent;
}
/* "X" para limpiar la caja de búsqueda (aparece solo cuando hay texto). */
.ghc-search-clear {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ghc-text-muted);
}
.ghc-search-clear:hover { background: #eef2f6; color: var(--ghc-text); }
.ghc-search-clear i { font-size: 14px; color: inherit; }
/* Una sola línea: con el panel a 380px los 3 chips entran sin envolver. */
.ghc-chips { display: flex; gap: 5px; margin-top: 9px; flex-wrap: nowrap; }
.ghc-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--ghc-bg);
  border: 1px solid var(--ghc-border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ghc-text-muted);
}
.ghc-chip i { font-size: 14px; }
.ghc-chip.ghc-chip-ok i { color: var(--ghc-ok); }
.ghc-chip.ghc-chip-bad i { color: var(--ghc-danger); }
.ghc-chip[aria-pressed="true"] {
  background: var(--ghc-primary-soft);
  border-color: var(--ghc-primary);
  color: var(--ghc-primary-text);
}

/* ---------- lista ---------- */
.ghc-fleet-list { flex: 1; overflow-y: auto; }

.ghc-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px 6px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ghc-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.ghc-group-header .fa-chevron-down { transition: transform .15s ease; }
.ghc-group-header[aria-expanded="false"] .fa-chevron-down { transform: rotate(-90deg); }
.ghc-group-count { margin-left: auto; font-weight: 600; }

.ghc-unit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid #eceef1;
  cursor: pointer;
}
.ghc-unit:hover { background: #f9fafb; }
.ghc-unit.ghc-selected { background: var(--ghc-primary-soft); }
.ghc-unit.ghc-selected .ghc-unit-name { color: var(--ghc-primary-text); }

/* toggle de visibilidad (reemplaza al checkbox; mismo estado y mismo handler) */
.ghc-eye {
  width: 38px; height: 38px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  color: var(--ghc-primary);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.ghc-eye:hover { background: #eef2f6; }
.ghc-eye[aria-pressed="false"] { color: #b6bcc6; }

.ghc-unit-body { flex: 1; min-width: 0; }
.ghc-unit-name {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ghc-unit-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  margin-top: 1px;
}
.ghc-unit-status i { font-size: 14px; }
.ghc-unit-status.ghc-ok  { color: var(--ghc-ok); }
.ghc-unit-status.ghc-bad { color: var(--ghc-danger); font-weight: 600; }

.ghc-unit-actions { display: flex; flex-shrink: 0; }
.ghc-unit-actions .ghc-iconbtn { width: 34px; height: 34px; font-size: 17px; }
.ghc-unit .ghc-center-btn { display: none; color: var(--ghc-primary); }
.ghc-unit.ghc-selected .ghc-center-btn,
.ghc-unit:hover .ghc-center-btn { display: flex; }

.ghc-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ghc-text-muted);
  font-size: 13.5px;
}

/* foco teclado */
.ghc-chip:focus-visible, .ghc-eye:focus-visible,
.ghc-iconbtn:focus-visible, .ghc-group-header:focus-visible,
.ghc-menu-item:focus-visible, .ghc-search input:focus-visible {
  outline: 3px solid var(--ghc-primary);
  outline-offset: 1px;
}
