/* ============================================================
   GPSHUB Panels — design system común de los drawers laterales
   (Historial / Búsquedas / Zonas; rediseño Fase 3). Mismo lenguaje
   visual que el panel de Flota (fleet-panel.css): borde azul grueso,
   header azul sólido con título/ícono blancos, tipografía Segoe,
   azul = activo, verde = "en línea".

   Las variables :root (--ghc-*) viven en map-control-panel.css y NO
   se redefinen acá. Se reutilizan primitivos ya globales del sistema
   (definidos en fleet-panel.css): .ghc-iconbtn, .ghc-search* y
   .ghc-empty. Lo de acá son las piezas que esos paneles no tenían:
   shell de drawer genérico, campos de formulario, botones, grupos
   colapsables, sub-filas y toggles on/off.
   ============================================================ */

/* ---------- drawer (tarjeta flotante anclada a la izquierda del mapa) ----------
   Separada 12px de los bordes (top/left/bottom), borde completo + radius + sombra,
   replicando la referencia gpshub-panel-flota.html. Mismo shell que .ghc-fleet. */
.ghc-drawer {
  position: fixed;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 320px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  background: var(--ghc-bg);
  /* borde azul grueso + sombra azulada, idéntico a Flota (.ghc-fleet) */
  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);
  font-size: 14px;
  z-index: 1100;
  transform: translateX(calc(-100% - 24px));
  transition: transform .3s ease;
}
.ghc-drawer.ghc-drawer-open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  .ghc-drawer { transition: none; }
}

/* ---------- header (azul sólido, igual que Flota: resalta contra el mapa) ---------- */
.ghc-drawer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--ghc-primary);
  border-bottom: none;
  flex-shrink: 0;
}
.ghc-drawer-header > i { font-size: 20px; color: #fff; }
.ghc-drawer-title { font-size: 16px; font-weight: 600; flex: 1; color: #fff; }

/* botón de cerrar (.ghc-iconbtn, primitivo global) claro sobre el header azul */
.ghc-drawer-header .ghc-iconbtn { color: #cfe0f0; }
.ghc-drawer-header .ghc-iconbtn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.ghc-drawer-header .ghc-iconbtn:focus-visible { outline-color: #fff; }

/* ---------- regiones ---------- */
.ghc-drawer-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ghc-border);
  flex-shrink: 0;
}
.ghc-drawer-body { flex: 1; overflow-y: auto; }
.ghc-drawer-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--ghc-border);
  flex-shrink: 0;
}

/* ---------- campos de formulario ---------- */
.ghc-field-row { display: flex; gap: 8px; }
.ghc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.ghc-field > label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--ghc-text-muted);
}
.ghc-input {
  width: 100%;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--ghc-text);
  background: var(--ghc-bg);
  border: 1px solid var(--ghc-border);
  border-radius: var(--ghc-radius);
  padding: 9px 10px;
}
.ghc-input:focus { outline: none; border-color: var(--ghc-primary); }
.ghc-input:focus-visible { outline: 3px solid var(--ghc-primary-soft); outline-offset: 0; }
.ghc-input:disabled { background: #f3f4f6; color: var(--ghc-text-muted); cursor: not-allowed; }

/* ---------- botones ---------- */
.ghc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ghc-text);
  background: var(--ghc-bg);
  border: 1px solid var(--ghc-border);
  border-radius: var(--ghc-radius);
  cursor: pointer;
}
.ghc-btn i { font-size: 16px; }
.ghc-btn:hover { background: #f3f4f6; }
.ghc-btn:disabled { opacity: .55; cursor: not-allowed; }
.ghc-btn-block { width: 100%; }
.ghc-btn-row { display: flex; gap: 8px; }
.ghc-btn-row .ghc-btn { flex: 1; }
.ghc-btn-primary {
  color: #fff;
  background: var(--ghc-primary);
  border-color: var(--ghc-primary);
}
.ghc-btn-primary:hover { background: var(--ghc-primary-text); }
.ghc-btn-primary:disabled { background: var(--ghc-primary); }

/* link discreto (reintentar, etc.) */
.ghc-linkbtn {
  padding: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ghc-primary);
  background: none;
  border: none;
  cursor: pointer;
}
.ghc-linkbtn:hover { text-decoration: underline; }

/* ---------- toolbar (acciones sobre la lista) ---------- */
.ghc-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ghc-border);
  flex-shrink: 0;
}
.ghc-toolbar-count {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ghc-text-muted);
}
.ghc-toolbar-count i { color: var(--ghc-ok); }
.ghc-toolbar-actions { margin-left: auto; display: flex; gap: 2px; }

/* ---------- fila simple de lista (con check de inclusión) ---------- */
.ghc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-top: 1px solid #eceef1;
  cursor: pointer;
}
.ghc-row:first-child { border-top: none; }
.ghc-row:hover { background: #f9fafb; }
.ghc-row-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* check de inclusión (mismo tamaño/forma que .ghc-eye de Flota) */
.ghc-check {
  width: 34px;
  height: 34px;
  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-check:hover { background: #eef2f6; }
.ghc-check[aria-pressed="false"] { color: #c2c7d0; }
.ghc-check:disabled { cursor: not-allowed; opacity: .6; }

/* ---------- grupo colapsable (Búsquedas / Zonas) ---------- */
.ghc-group { border-top: 1px solid var(--ghc-border); }
.ghc-group:first-child { border-top: none; }

.ghc-group-row {
  display: flex;
  align-items: center;
  background: #f7f8fa;
}
/* zona clickeable (chevron + rótulo + contador) que expande/colapsa */
.ghc-group-expand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 8px 9px 10px;
  font-family: inherit;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}
.ghc-group-expand:hover { background: #eef1f4; }
.ghc-group-expand .fa-chevron-down {
  font-size: 12px;
  color: var(--ghc-text-muted);
  transition: transform .15s ease;
}
.ghc-group-expand[aria-expanded="false"] .fa-chevron-down { transform: rotate(-90deg); }
.ghc-group-label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ghc-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ghc-group-num { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--ghc-text-muted); }
.ghc-group-tools { flex-shrink: 0; display: flex; gap: 1px; padding-right: 6px; }

/* ---------- sub-fila (unidad / zona dentro de un grupo) ---------- */
.ghc-subrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 16px;
  border-top: 1px solid #f1f2f4;
}
.ghc-subrow:hover { background: #f9fafb; }
.ghc-subrow-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ghc-subrow-tools { flex-shrink: 0; display: flex; gap: 1px; }

/* barra de color (capa por unidad en Búsquedas) */
.ghc-swatch {
  flex-shrink: 0;
  width: 4px;
  height: 22px;
  border-radius: 2px;
}

/* ---------- toggle de ícono on/off (ojo / flechas / puntos / paradas) ---------- */
.ghc-toggle {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #c2c7d0;                       /* off (apagado) */
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.ghc-toggle:hover { background: #eceef1; }
.ghc-toggle[aria-pressed="true"] { color: var(--ghc-primary); }   /* on */
.ghc-toggle.ghc-toggle-danger { color: var(--ghc-danger); }
.ghc-toggle.ghc-toggle-danger:hover { background: var(--ghc-danger-soft); }

/* ---------- estados ---------- */
.ghc-error {
  margin: 0;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ghc-danger);
  background: var(--ghc-danger-soft);
  border-top: 1px solid var(--ghc-border);
  flex-shrink: 0;
}

/* ---------- foco teclado ---------- */
.ghc-btn:focus-visible,
.ghc-linkbtn:focus-visible,
.ghc-check:focus-visible,
.ghc-toggle:focus-visible,
.ghc-group-expand:focus-visible {
  outline: 3px solid var(--ghc-primary);
  outline-offset: 1px;
}
