/* ============================================================
   GPSHUB Control Panel  (rediseño de la botonera del mapa /routes)
   Todo lo del panel vive bajo .ghc-* (GpsHub Controls)
   para no chocar con estilos de Leaflet ni de Blazor.
   Copia 1:1 de la referencia Documents/gpshub-control-panel.html
   (se omiten las reglas de demo html/body/#map).
   ============================================================ */

:root {
  --ghc-bg: #ffffff;
  --ghc-text: #1f2937;
  --ghc-text-muted: #6b7280;
  --ghc-border: #d1d5db;
  --ghc-primary: #185fa5;        /* azul = activo / encendido */
  --ghc-primary-soft: #e6f1fb;
  --ghc-primary-text: #0c447c;
  --ghc-danger: #b91c1c;
  --ghc-danger-soft: #fdecec;
  --ghc-ok: #3b6d11;             /* verde = "En línea" (panel Flota) */
  --ghc-radius: 10px;
  --ghc-shadow: 0 2px 8px rgba(0,0,0,.18);
  --ghc-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------- contenedor general (esquina superior derecha) ---------- */
.ghc-anchor {
  position: absolute;
  top: 12px;
  right: 64px;               /* la esquina (right:12px) queda para el botón de usuario (44px + gap) */
  z-index: 1000;              /* sobre los panes de Leaflet */
  font-family: var(--ghc-font);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* ---------- boton engranaje (siempre visible) ---------- */
.ghc-gear {
  width: 44px;                /* mismo tamaño que el botón de usuario .usermenu-btn */
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ghc-border);
  background: var(--ghc-bg);
  color: var(--ghc-text);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--ghc-shadow);
  transition: transform .25s ease, background .15s ease;
}
.ghc-gear:hover { background: #f3f4f6; }
.ghc-gear[aria-expanded="true"] {
  background: var(--ghc-primary);
  border-color: var(--ghc-primary);
  color: #fff;
  transform: rotate(90deg);
}

/* ---------- botones lanzadores de paneles (Flota/Historial/Búsquedas/Zonas) ----------
   Fila de botones redondos a la izquierda del engranaje, misma altura (top:12px).
   right:116 = .ghc-anchor right:64 + 44 (ancho del engranaje) + 8 de gap → pegados al engranaje.
   La fila es shrink-to-fit anclada por su borde derecho: si algún botón se oculta por gating
   (CanShow*), la fila se acorta hacia la izquierda y sigue pegada al engranaje sin huecos. */
.ghc-launch-bar {
  position: absolute;
  top: 12px;
  right: 116px;
  z-index: 1000;              /* sobre los panes de Leaflet, igual que .ghc-anchor */
  font-family: var(--ghc-font);
  display: flex;
  gap: 8px;
}
.ghc-launch-btn {
  width: 44px;                /* mismo tamaño/estilo que .ghc-gear y .usermenu-btn */
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--ghc-border);
  background: var(--ghc-bg);
  color: var(--ghc-text);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--ghc-shadow);
  transition: background .15s ease;
}
.ghc-launch-btn:hover { background: #f3f4f6; }
.ghc-launch-btn[aria-pressed="true"] {   /* panel abierto: azul, igual que el engranaje expandido */
  background: var(--ghc-primary);
  border-color: var(--ghc-primary);
  color: #fff;
}
.ghc-launch-btn:focus-visible {
  outline: 3px solid var(--ghc-primary);
  outline-offset: 2px;
}

/* ---------- panel ---------- */
.ghc-panel {
  width: 256px;
  margin-right: -52px;        /* corre el panel a la derecha hasta el borde del boton de usuario
                                 (.ghc-anchor right:64px - .usermenu right:12px = 52px) */
  background: var(--ghc-bg);
  border: 1px solid var(--ghc-border);
  border-radius: var(--ghc-radius);
  box-shadow: var(--ghc-shadow);
  overflow: hidden;
  transform-origin: top right;
  transition: transform .2s ease, opacity .2s ease;
}
.ghc-panel.ghc-hidden {
  transform: scale(.92) translateY(-8px);
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .ghc-panel, .ghc-gear { transition: none; }
}

.ghc-section-title {
  padding: 12px 16px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--ghc-text-muted);
}
.ghc-section + .ghc-section { border-top: 1px solid var(--ghc-border); }

/* ---------- switches ---------- */
.ghc-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  cursor: pointer;
  user-select: none;
}
.ghc-switch-row:hover { background: #f9fafb; }
.ghc-switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ghc-text);
}
.ghc-switch-label i { font-size: 19px; color: var(--ghc-text-muted); }

/* checkbox nativo oculto, switch visual al lado */
.ghc-switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.ghc-switch {
  position: relative;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 14px;
  background: #c4c9d0;
  transition: background .15s ease;
}
.ghc-switch::after {            /* perilla */
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .15s ease;
}
.ghc-switch::before {           /* tilde visible cuando esta activo */
  content: "\2713";
  position: absolute;
  left: 9px; top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  opacity: 0;
  transition: opacity .15s ease;
}
.ghc-switch-row input:checked + .ghc-switch { background: var(--ghc-primary); }
.ghc-switch-row input:checked + .ghc-switch::after { transform: translateX(22px); }
.ghc-switch-row input:checked + .ghc-switch::before { opacity: 1; }
.ghc-switch-row input:focus-visible + .ghc-switch {
  outline: 3px solid var(--ghc-primary-soft);
  outline-offset: 2px;
}

/* ---------- acciones ---------- */
.ghc-actions { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ghc-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  color: var(--ghc-text);
  background: var(--ghc-bg);
  border: 1px solid var(--ghc-border);
  border-radius: var(--ghc-radius);
  cursor: pointer;
}
.ghc-action-btn i { font-size: 19px; }
.ghc-action-btn:hover { background: #f3f4f6; }

.ghc-action-btn.ghc-danger { color: var(--ghc-danger); }
.ghc-action-btn.ghc-danger:hover { background: var(--ghc-danger-soft); }
.ghc-action-btn.ghc-danger.ghc-confirming {
  background: var(--ghc-danger);
  border-color: var(--ghc-danger);
  color: #fff;
}

/* foco visible para teclado en todos los botones */
.ghc-gear:focus-visible,
.ghc-action-btn:focus-visible {
  outline: 3px solid var(--ghc-primary);
  outline-offset: 2px;
}

/* ---------- fila de switch con botón de acción (Ver Zonas) ----------
   La fila es un <div> (no <label>): el texto ocupa el espacio sobrante y empuja el botón de ícono
   y el switch a la derecha. El <input>+.ghc-switch viven en un <label> interno (.ghc-switch-toggle),
   por lo que las reglas existentes .ghc-switch-row input{...} y input:checked + .ghc-switch{...}
   siguen aplicando (combinador descendiente + adyacencia). .ghc-switch-toggle:position:relative
   contiene al input absoluto para que no se posicione respecto de toda la fila. */
.ghc-switch-row--action { cursor: default; }
.ghc-switch-row--action .ghc-switch-label { flex: 1 1 auto; }
.ghc-switch-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}
.ghc-row-icon-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ghc-border);
  border-radius: 8px;
  background: var(--ghc-bg);
  color: var(--ghc-text-muted);
  font-size: 15px;
  cursor: pointer;
}
.ghc-row-icon-btn:hover { background: #f3f4f6; color: var(--ghc-text); }
.ghc-row-icon-btn:focus-visible { outline: 3px solid var(--ghc-primary); outline-offset: 2px; }
