/**
 * GeaIQ Layer Navigation Panel
 * Basado en el diseño de geaiq_ux/Mapa/mapa-1.html
 * Prefijo CSS: glp- (Gea Layer Panel)
 */

/* ─── Variables ─────────────────────────────── */
:root {
  --glp-primary:      #0d7ff2;
  --glp-bg:           #030712;
  --glp-surface:      #111827;
  --glp-border:       #1f2937;
  --glp-text:         #f3f4f6;
  --glp-text-muted:   #9ca3af;
  --glp-panel-w:      320px;
  --glp-panel-offset: 0px;

  /* Niveles concéntricos */
  --c1: 30, 168, 168;
  --c2: 136, 176, 90;
  --c3: 207, 195, 0;
  --c4: 223, 49, 49;
}

/* ─── Panel izquierdo ───────────────────────── */
#geaiq-left-panel {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: var(--glp-panel-w);
  background: var(--glp-bg);
  border-right: 1px solid var(--glp-border);
  display: flex;
  flex-direction: column;
  z-index: 1500;
  transition: width 0.3s ease;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--glp-text);
}

#geaiq-left-panel.collapsed {
  width: 0;
  overflow: hidden;
}

/* Botón colapsar */
#glp-collapse-btn {
  position: absolute;
  top: 16px;
  left: var(--glp-panel-w);
  z-index: 1501;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 28px;
  height: 36px;
  background: var(--glp-surface);
  border: 1px solid var(--glp-border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--glp-text-muted);
  cursor: pointer;
  transition: all 0.3s;
}

#glp-collapse-btn:hover {
  background: #1f2937;
  color: var(--glp-text);
}

#geaiq-left-panel.collapsed + #glp-collapse-btn {
  left: 0;
  border-left: 1px solid var(--glp-border);
  border-radius: 0 8px 8px 0;
}

/* ─── Nav tabs ──────────────────────────────── */
.glp-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glp-border);
  flex-shrink: 0;
}

.glp-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--glp-text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 56px;
  aspect-ratio: 1;
  transition: all 0.15s;
}

.glp-nav-btn .material-symbols-outlined {
  font-size: 20px;
}

.glp-nav-btn:hover {
  background: rgba(13, 127, 242, 0.12);
  color: var(--glp-text);
}

.glp-nav-btn.active {
  background: rgba(13, 127, 242, 0.15);
  color: var(--glp-primary);
}

.glp-nav-btn.glp-nav-add {
  background: var(--glp-primary);
  color: rgba(255, 255, 255, 0.85);
}

.glp-nav-btn.glp-nav-add:hover {
  background: #2b90f5;
  color: white;
}

/* ─── Tab contents ──────────────────────────── */
.glp-tab {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.glp-tab.active {
  display: flex;
}

/* ─── Capas activas ─────────────────────────── */
.glp-tab-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.glp-tab-body::-webkit-scrollbar { width: 5px; }
.glp-tab-body::-webkit-scrollbar-track { background: transparent; }
.glp-tab-body::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

.glp-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--glp-text);
}

.glp-layers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ─── Layer item (details/summary) ─────────── */
.glp-layer-item {
  border: 1px solid var(--glp-border);
  border-radius: 8px;
  background: var(--glp-surface);
  overflow: hidden;
}

.glp-layer-item summary {
  list-style: none;
}

.glp-layer-item summary::-webkit-details-marker {
  display: none;
}

.glp-layer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
}

.glp-layer-header:hover {
  background: #1f2937;
}

.glp-layer-drag {
  color: var(--glp-text-muted);
  cursor: grab;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.glp-layer-item:hover .glp-layer-drag {
  opacity: 1;
}

.glp-layer-checkbox {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 2px solid #555;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.glp-layer-checkbox:checked {
  background-color: var(--glp-primary);
  border-color: var(--glp-primary);
}

.glp-layer-checkbox:checked::after {
  content: "";
  position: absolute;
  top: 0px;
  left: 3px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.glp-layer-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.glp-layer-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  color: var(--glp-text);
}

/* ── Inline legend segments (inside summary header) ── */
.glp-legend-segments {
  display: flex;
  gap: 2px;
  height: 4px;
  width: 100%;
}

.glp-legend-segments:empty { display: none; }

.glp-legend-segment {
  flex: 1;
  height: 4px;
  border-radius: 2px;
}

.glp-legend-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.glp-legend-labels:empty { display: none; }

.glp-legend-labels span {
  font-size: 10px;
  color: var(--glp-text-muted);
}

.glp-layer-expand {
  color: var(--glp-text-muted);
  font-size: 20px;
  transition: transform 0.2s;
  flex-shrink: 0;
  display: none;
}

.glp-layer-item:hover .glp-layer-expand {
  display: block;
}

.glp-layer-item[open] .glp-layer-expand {
  transform: rotate(180deg);
}

.glp-layer-more {
  color: var(--glp-text-muted);
  font-size: 20px;
  opacity: 0.4;
  cursor: pointer;
  flex-shrink: 0;
}

.glp-layer-more:hover {
  opacity: 1;
}

/* Layer details (expandable) */
.glp-layer-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease-out;
  border-top: 1px solid var(--glp-border);
  background: #1f2937;
}

.glp-layer-details > * { overflow: hidden; }

.glp-layer-details-inner {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glp-layer-item[open] .glp-layer-details {
  grid-template-rows: 1fr;
}

.glp-layer-item[open] .glp-layer-details-inner {
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Opacity control */
.glp-opacity-ctrl {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.glp-opacity-hdr {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
}

.glp-opacity-lbl { color: var(--glp-text-muted); }
.glp-opacity-val { color: var(--glp-text); font-family: monospace; }

.glp-opacity-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: #374151;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.glp-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--glp-primary);
  border-radius: 50%;
  cursor: pointer;
}

/* Context menu */
.glp-layer-menu {
  position: fixed;
  background: var(--glp-surface);
  border: 1px solid var(--glp-border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  z-index: 9999;
  min-width: 150px;
  padding: 4px;
  display: none;
}

.glp-layer-menu.show { display: block; }

.glp-layer-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--glp-text);
  transition: background 0.15s;
}

.glp-layer-menu-item:hover {
  background: rgba(13, 127, 242, 0.15);
}

.glp-layer-menu-item .material-symbols-outlined {
  font-size: 17px;
  color: var(--glp-text-muted);
}

.glp-layer-menu-item:hover .material-symbols-outlined {
  color: var(--glp-primary);
}

.glp-layer-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.12);
}

.glp-layer-menu-item.danger .material-symbols-outlined,
.glp-layer-menu-item.danger:hover .material-symbols-outlined {
  color: #ef4444;
}

/* ─── Multi-step nav (+ Nueva Capa) ────────── */
.glp-step-breadcrumbs {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--glp-border);
  font-size: 11px;
  color: var(--glp-text-muted);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.glp-step-breadcrumbs.show { display: flex; }

.glp-step-crumb {
  cursor: pointer;
  white-space: nowrap;
}

.glp-step-crumb:hover {
  color: var(--glp-primary);
  text-decoration: underline;
}

.glp-step-crumb.active {
  color: var(--glp-text);
  font-weight: 600;
  pointer-events: none;
  text-decoration: none;
}

.glp-step-sep {
  color: var(--glp-text-muted);
  font-size: 11px;
}

.glp-nav-wrapper {
  display: flex;
  height: 100%;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.glp-step {
  flex: 0 0 auto;  /* JS sets width/flexBasis explicitly per step */
  width: 100%;     /* fallback before JS runs */
  height: 100%;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.glp-step::-webkit-scrollbar { width: 5px; }
.glp-step::-webkit-scrollbar-track { background: transparent; }
.glp-step::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

.glp-btn-step {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  transition: all 0.15s;
}

.glp-btn-step:hover {
  background: rgba(13, 127, 242, 0.1);
  border-color: rgba(13, 127, 242, 0.3);
}

/* ── Análisis de Capa button ─────────────────────────────────────────────── */
.glp-btn-analysis {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s;
}

.glp-btn-analysis:hover {
  background: rgba(13, 127, 242, 0.08);
  border-color: rgba(13, 127, 242, 0.25);
}

.glp-analysis-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgb(var(--c4));
  background: rgba(var(--c4), 0.15);
  box-shadow: 0 0 10px rgba(var(--c4), 0.35);
}

.glp-analysis-icon .material-symbols-outlined {
  font-size: 20px;
}

.glp-analysis-label {
  flex: 1;
  text-align: left;
  font-size: 13px;
}

.glp-analysis-expand {
  color: var(--glp-text-muted);
  font-size: 18px;
  transition: transform 0.2s;
}

.glp-layer-analysis-filters:not(:empty) ~ .glp-analysis-expand,
.glp-btn-analysis.is-open .glp-analysis-expand {
  transform: rotate(180deg);
}

.glp-layer-analysis-filters { margin-top: 0; }

.glp-filter-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--glp-border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--glp-surface);
  color: var(--glp-text);
  font-family: inherit;
  outline: none;
}

.glp-filter-input:focus {
  border-color: var(--glp-primary);
}

.glp-filter-input::placeholder {
  color: var(--glp-text-muted);
}

/* ─── Concentric circles ────────────────────── */
.glp-concentric {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.glp-concentric.sm {
  width: 1.5rem;
  height: 1.5rem;
}

.glp-cc {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px solid rgba(81, 93, 109, 0.6);
  background: transparent;
  transition: all 0.3s ease;
}

.glp-cc.lv1 { width: 100%;  height: 100%;  }
.glp-cc.lv2 { width: 62%;   height: 62%;   }
.glp-cc.lv3 { width: 30%;   height: 30%;   }

.glp-cc.lv1.active { border-color: rgb(var(--c1)); background: rgba(var(--c1), 0.25); box-shadow: 0 0 6px rgba(var(--c1), 0.4); }
.glp-cc.lv2.active { border-color: rgb(var(--c2)); background: rgba(var(--c2), 0.25); box-shadow: 0 0 6px rgba(var(--c2), 0.4); }
.glp-cc.lv3.active { border-color: rgb(var(--c3)); background: rgba(var(--c3), 0.25); box-shadow: 0 0 6px rgba(var(--c3), 0.4); }

/* ── Config sheet (basemap — slides up from bottom) ─────────────────────── */
.glp-config-sheet {
  position: absolute;
  bottom: 52px; /* height of user footer */
  left: 0;
  right: 0;
  max-height: calc(100% - 120px); /* don't cover the whole panel */
  overflow-y: auto;
  background: var(--glp-surface);
  border-top: 1px solid var(--glp-border);
  border-radius: 12px 12px 0 0;
  padding: 0;
  transform: translateY(calc(100% + 56px));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.4);
}
.glp-config-sheet::-webkit-scrollbar { width: 4px; }
.glp-config-sheet::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

.glp-config-sheet.open { transform: translateY(0); }

.glp-config-sheet-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--glp-border);
}

.glp-config-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--glp-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.glp-config-sheet-close:hover {
  background: rgba(255,255,255,0.08);
  color: var(--glp-text);
}

.glp-settings-btn.active {
  background: rgba(13, 127, 242, 0.15);
  color: var(--glp-primary);
  border-color: rgba(13, 127, 242, 0.3);
}

/* Basemap list (inside .glp-config-section) */
.glp-basemap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.glp-basemap-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--glp-border);
  background: var(--glp-border);
  color: var(--glp-text);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.glp-basemap-btn:hover { background: #374151; border-color: #4b5563; }

.glp-basemap-btn.active {
  border-color: var(--glp-primary);
  background: rgba(13, 127, 242, 0.15);
}

.glp-basemap-preview {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

.glp-bm-dark      { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); }
.glp-bm-light     { background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); border-color: #dee2e6; }
.glp-bm-osm       { background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%); border-color: #bdbdbd; }
.glp-bm-satellite { background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 50%, #52b788 100%); }

.glp-basemap-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.glp-basemap-name { font-size: 13px; font-weight: 600; color: var(--glp-text); }
.glp-basemap-desc { font-size: 11px; color: var(--glp-text-muted); }

.glp-basemap-check {
  font-size: 20px;
  color: var(--glp-primary);
  opacity: 0;
  transition: opacity 0.2s;
}

.glp-basemap-btn.active .glp-basemap-check { opacity: 1; }

/* ── Config sheet sections ───────────────────────────────────────────────── */
.glp-config-section {
  padding: 12px 16px;
  border-top: 1px solid var(--glp-border);
}
.glp-config-section:first-of-type { border-top: none; }

.glp-config-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--glp-text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Agent status badge */
.glp-agent-status-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 7px;
  border-radius: 20px;
}
.glp-badge-on  { background: rgba(34,197,94,0.15);  color: #22c55e; }
.glp-badge-off { background: rgba(156,163,175,0.15); color: #9ca3af; }

/* Agent info row (when active) */
.glp-agent-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--glp-text);
  margin-bottom: 4px;
}
.glp-agent-model {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--glp-text-muted);
  margin-bottom: 10px;
}
.glp-agent-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

/* Agent form (when inactive, admin only) */
.glp-agent-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.glp-agent-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.glp-agent-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--glp-text-muted);
}
.glp-agent-input,
.glp-agent-select {
  width: 100%;
  padding: 7px 10px;
  background: var(--glp-bg);
  border: 1px solid var(--glp-border);
  border-radius: 6px;
  color: var(--glp-text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.glp-agent-input:focus,
.glp-agent-select:focus { border-color: var(--glp-primary); }
.glp-agent-select option { background: var(--glp-surface); }

/* Agent buttons */
.glp-agent-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.glp-agent-btn-activate {
  background: var(--glp-primary);
  color: #fff;
}
.glp-agent-btn-activate:hover { background: #2b90f5; }
.glp-agent-btn-activate:disabled { opacity: 0.6; cursor: not-allowed; }
.glp-agent-btn-test {
  background: rgba(13,127,242,0.12);
  color: var(--glp-primary);
}
.glp-agent-btn-test:hover { background: rgba(13,127,242,0.22); }
.glp-agent-btn-off {
  background: rgba(239,68,68,0.08);
  color: #f87171;
}
.glp-agent-btn-off:hover { background: rgba(239,68,68,0.16); }

/* Agent feedback messages */
.glp-config-hint   { font-size: 11px; color: var(--glp-text-muted); margin: 0 0 8px; line-height: 1.5; }
.glp-config-ok     { font-size: 12px; color: #22c55e; margin: 4px 0 0; }
.glp-config-error  { font-size: 12px; color: #f87171; margin: 4px 0 0; }
.glp-config-loading { font-size: 12px; color: var(--glp-text-muted); font-style: italic; }

/* ── User dropdown (slides up above user footer) ─────────────────────────── */
.glp-user-dropdown {
  position: absolute;
  bottom: 52px;
  left: 0;
  right: 0;
  background: var(--glp-surface);
  border-top: 1px solid var(--glp-border);
  border-radius: 12px 12px 0 0;
  transform: translateY(calc(100% + 56px));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 201;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.4);
  overflow: hidden;
}

.glp-user-dropdown.open { transform: translateY(0); }

.glp-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--glp-text-muted);
  cursor: pointer;
  transition: background 0.15s;
}

.glp-user-dropdown-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--glp-text);
}

.glp-user-dropdown-item .material-symbols-outlined { font-size: 18px; }

.glp-user-dropdown-divider {
  border-top: 1px solid var(--glp-border);
  margin: 0;
}

/* ─── Legacy footer removed ─────────────────── */
/* ── Nav dropdown (⋮ more_vert) ─────────────────────────────────────────── */
.glp-nav-dropdown-wrapper { position: relative; }

.glp-btn-nav-more,
.glp-btn-zoom-all {
  width: 36px !important;
  aspect-ratio: 1;
  padding: 6px !important;
  min-width: unset;
}

.glp-nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--glp-surface);
  border: 1px solid var(--glp-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 2000;
  min-width: 190px;
  overflow: hidden;
}

.glp-nav-dropdown.open { display: block; }

.glp-nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--glp-text-muted);
  cursor: pointer;
  transition: background 0.15s;
}

.glp-nav-dropdown-item:hover {
  background: rgba(255,255,255,0.07);
  color: var(--glp-text);
}

.glp-nav-dropdown-item .material-symbols-outlined { font-size: 18px; }

.glp-nav-dropdown-item.danger { color: #f87171; }
.glp-nav-dropdown-item.danger:hover { background: rgba(248,113,113,0.08); }
.glp-nav-dropdown-item.danger .material-symbols-outlined { color: #f87171; }

.glp-nav-dropdown-divider {
  border-top: 1px solid var(--glp-border);
  margin: 4px 0;
}

/* ── User footer ─────────────────────────────────────────────────────────── */
.glp-user-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--glp-border);
  background: var(--glp-bg);
  flex-shrink: 0;
}

.glp-user-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  max-width: 180px;
  overflow: hidden;
}

.glp-user-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--glp-text);
}

.glp-user-btn .material-symbols-outlined { font-size: 18px; flex-shrink: 0; }

.glp-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.glp-settings-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.glp-settings-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--glp-text);
}

.glp-settings-btn .material-symbols-outlined { font-size: 18px; }

/* ─── DATA TERRITORIAL breadcrumb ───────────── */
#glp-breadcrumb {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(3, 7, 18, 0.85);
  border: 1px solid var(--glp-border);
  border-radius: 10px;
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--glp-text);
  min-width: 260px;
}

.glp-bc-left {
  flex: 1;
}

.glp-bc-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--glp-text-muted);
  display: block;
  margin-bottom: 4px;
}

.glp-bc-items {
  display: flex;
  align-items: center;
  gap: 4px;
}

.glp-bc-item {
  font-size: 13px;
  font-weight: 500;
  color: var(--glp-text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.glp-bc-item:hover { color: var(--glp-primary); }

.glp-bc-item.active {
  color: var(--glp-text);
  font-weight: 700;
  cursor: default;
}

.glp-bc-sep {
  font-size: 11px;
  color: var(--glp-text-muted);
  opacity: 0.5;
}

.glp-bc-right {
  flex-shrink: 0;
}

/* Concentric circles in breadcrumb (bigger) */
#glp-breadcrumb .glp-concentric {
  width: 36px;
  height: 36px;
}

/* ─── Map container offset ──────────────────── */
#gea-map-container {
  left: var(--glp-panel-offset, 0px) !important;
  transition: left 0.3s ease;
}

/* ─── Right-side info panel (wizard assistant) ─ */
#glp-right-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 420px;
  max-width: 38%;
  background: rgba(3, 7, 18, 0.90);
  border-left: 1px solid var(--glp-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  z-index: 400;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--glp-text);
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1),
              opacity   0.35s cubic-bezier(0.4,0,0.2,1);
}

#glp-right-panel.visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.glp-rp-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--glp-border);
  flex-shrink: 0;
}

.glp-rp-help-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--glp-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--glp-text-muted);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 3px;
}

.glp-rp-header-text {
  flex: 1;
  min-width: 0;
}

.glp-rp-step-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--glp-text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.glp-rp-step-sub {
  font-size: 11px;
  color: var(--glp-text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.glp-rp-nav {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.glp-rp-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.glp-rp-nav-btn:hover {
  background: var(--glp-primary);
  border-color: var(--glp-primary);
  color: white;
}

/* ── Chat messages area ─────────────────────── */
.glp-rp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.glp-rp-messages::-webkit-scrollbar { width: 5px; }
.glp-rp-messages::-webkit-scrollbar-track { background: transparent; }
.glp-rp-messages::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

/* Bot message */
.glp-rp-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  animation: glp-msg-in 0.25s ease forwards;
}

@keyframes glp-msg-in {
  to { opacity: 1; transform: translateY(0); }
}

.glp-rp-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(13,127,242,0.15);
  border: 1px solid rgba(13,127,242,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--glp-primary);
}

.glp-rp-msg-avatar .material-symbols-outlined { font-size: 17px; }

.glp-rp-msg-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.7;
  color: var(--glp-text);
  min-width: 0;
}

/* Markdown styles inside messages */
.glp-rp-msg-content p { margin: 0 0 8px; }
.glp-rp-msg-content p:last-child { margin-bottom: 0; }
.glp-rp-msg-content h1,.glp-rp-msg-content h2 { font-size: 15px; font-weight: 700; margin: 12px 0 6px; color: var(--glp-text); }
.glp-rp-msg-content h3 { font-size: 13px; font-weight: 700; margin: 10px 0 4px; color: var(--glp-primary); text-transform: uppercase; letter-spacing: 0.5px; }
.glp-rp-msg-content ul,.glp-rp-msg-content ol { margin: 4px 0 8px 18px; padding: 0; }
.glp-rp-msg-content li { margin-bottom: 3px; }
.glp-rp-msg-content a { color: var(--glp-primary); text-decoration: underline; }
.glp-rp-msg-content strong { color: var(--glp-text); }
.glp-rp-msg-content img { max-width: 100%; border-radius: 6px; margin: 6px 0; }

/* User message */
.glp-rp-msg-user {
  flex-direction: row-reverse;
}

.glp-rp-msg-user .glp-rp-msg-content {
  background: rgba(13,127,242,0.12);
  border: 1px solid rgba(13,127,242,0.2);
  border-radius: 12px 2px 12px 12px;
  padding: 10px 14px;
  flex: unset;
  max-width: 85%;
}

/* ── Input area ──────────────────────────────── */
.glp-rp-input-area {
  border-top: 1px solid var(--glp-border);
  padding: 12px 14px;
  flex-shrink: 0;
  background: rgba(17,24,39,0.6);
}

.glp-rp-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--glp-surface);
  border: 1px solid var(--glp-border);
  border-radius: 12px;
  padding: 8px 10px;
  transition: border-color 0.2s;
}

.glp-rp-input-row:focus-within {
  border-color: rgba(13,127,242,0.5);
}

.glp-rp-attach {
  color: var(--glp-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 0.15s;
}

.glp-rp-attach:hover { color: var(--glp-primary); }
.glp-rp-attach .material-symbols-outlined { font-size: 20px; }

.glp-rp-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--glp-text);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}

.glp-rp-textarea::placeholder { color: var(--glp-text-muted); }

.glp-rp-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--glp-primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.glp-rp-send-btn:hover { background: #2b90f5; }
.glp-rp-send-btn .material-symbols-outlined { font-size: 18px; }

/* ── Filter-step message (applied filters + clickable options) ─── */

/* Applied-filters summary list */
.glp-rp-filter-summary {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.glp-rp-filter-summary li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
}
.glp-rp-filter-label {
  color: var(--glp-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.glp-rp-filter-label::after { content: ':'; }
.glp-rp-filter-val {
  font-weight: 600;
  color: var(--glp-text);
  word-break: break-word;
}

/* Prompt line */
.glp-rp-filter-prompt {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--glp-text-muted);
  line-height: 1.4;
}
.glp-rp-filter-prompt strong { color: var(--glp-text); }

/* Options container */
.glp-rp-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Individual option button */
.glp-rp-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--glp-primary);
  border-radius: 8px;
  background: transparent;
  color: var(--glp-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}
.glp-rp-option:hover {
  background: var(--glp-primary);
  color: #fff;
}
.glp-rp-option-label { flex: 1; }
.glp-rp-option-icon {
  font-size: 16px;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.glp-rp-option:hover .glp-rp-option-icon { transform: translateX(3px); }

/* ─── Context chips (level / country / scale / period confirmations) ── */
.glp-rp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--glp-text-muted);
  margin: 2px 0;
}
.glp-rp-chip strong { color: var(--glp-text); font-weight: 600; }

/* ─── Error message in chat ─────────────────── */
.glp-rp-error {
  color: #f87171;
  font-size: 12px;
}

/* ─── Typing indicator (three animated dots) ─ */
.glp-rp-typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}
.glp-rp-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--glp-text-muted);
  animation: glpTypingBounce 1.2s infinite ease-in-out;
}
.glp-rp-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.glp-rp-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes glpTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ─── Empty state ───────────────────────────── */
.glp-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--glp-text-muted);
  font-size: 12px;
  font-style: italic;
}

/* ── Province / Municipality search overlay (Step 10) ──────── */
.glp-province-search {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow-y: auto;
  background: var(--glp-bg);
  z-index: 2;
}
.glp-province-search.visible {
  display: flex;
}

/* ── Province / Municipality search results (Step 10) ──────── */
.glp-area-results {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 52vh;
  overflow-y: auto;
}

.glp-area-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--glp-border);
  border-radius: 8px;
  background: var(--glp-surface);
  color: var(--glp-text);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}
.glp-area-result:hover {
  background: rgba(13,127,242,.12);
  border-color: var(--glp-primary);
}
.glp-area-result-meta {
  display: flex;
  gap: 6px;
  color: var(--glp-text-muted);
  font-size: 11px;
  flex-wrap: wrap;
}
.glp-area-census { opacity: .7; }
.glp-area-result-name {
  font-size: 13px;
  line-height: 1.3;
}
.glp-area-result-name strong { color: var(--glp-text); }
.glp-area-year {
  margin-left: 6px;
  font-size: 10px;
  color: var(--glp-text-muted);
  font-weight: 400;
  opacity: .75;
}

/* ── Hide ol-ext EditBar (replaced by our pill toolbar) ───── */
.ol-control.ol-bar { display: none !important; }

/* ── Floating pill map toolbar ───────────────────────────── */
#glp-map-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--glp-bg, #030712);
  border: 1px solid #2d2d2d;
  border-radius: 10px;
  padding: 4px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
  pointer-events: all;
}

.glp-maptb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 6px;
  color: #a0a0a0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.glp-maptb-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.glp-maptb-btn.glp-maptb-active {
  background: var(--glp-primary, #0d7ff2);
  color: #fff;
}
.glp-maptb-btn .material-symbols-outlined { font-size: 18px; }

.glp-maptb-sep {
  width: 1px;
  height: 20px;
  background: #2d2d2d;
  margin: 0 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   A2Wiz — Panel inline de análisis de accesibilidad urbana
   Prefijo: a2-
   ═══════════════════════════════════════════════════════════════════════════ */

.a2-panel {
  padding: 12px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.a2-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.a2-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--glp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── POI chips ── */
.a2-poi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.a2-poi-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.a2-poi-chip .material-symbols-outlined {
  font-size: 15px;
}

.a2-poi-chip:hover {
  border-color: rgba(13, 127, 242, 0.4);
  color: var(--glp-text);
}

.a2-poi-chip.a2-chip--active {
  border-color: var(--glp-primary);
  background: rgba(13, 127, 242, 0.15);
  color: var(--glp-primary);
}

/* ── Modo de transporte ── */
.a2-mode-row {
  display: flex;
  gap: 6px;
}

.a2-mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text-muted);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.a2-mode-btn .material-symbols-outlined {
  font-size: 20px;
}

.a2-mode-btn:hover {
  border-color: rgba(13, 127, 242, 0.35);
  color: var(--glp-text);
}

.a2-mode-btn.a2-mode--active {
  border-color: var(--glp-primary);
  background: rgba(13, 127, 242, 0.15);
  color: var(--glp-primary);
}

/* ── Slider tiempo ── */
.a2-slider-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.a2-slider-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--glp-primary);
}

.a2-slider {
  width: 100%;
  accent-color: var(--glp-primary);
  cursor: pointer;
}

/* ── Ciudad ── */
.a2-city-input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--glp-border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--glp-surface);
  color: var(--glp-text);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.a2-city-input:focus {
  border-color: var(--glp-primary);
}

.a2-city-input::placeholder {
  color: var(--glp-text-muted);
}

/* ── Botón Analizar ── */
.a2-run-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: var(--glp-primary);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.a2-run-btn:hover:not(:disabled) {
  opacity: 0.88;
}

.a2-run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.a2-run-btn .material-symbols-outlined {
  font-size: 18px;
}

/* ── Resultados y métricas ── */
.a2-results {
  font-size: 12px;
}

.a2-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}

.a2-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 8px 4px;
  border: 1px solid var(--glp-border);
}

.a2-metric-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--glp-text);
  line-height: 1;
}

.a2-metric-lbl {
  font-size: 10px;
  color: var(--glp-text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.a2-elapsed {
  color: var(--glp-text-muted);
  font-size: 11px;
  text-align: center;
  margin: 4px 0 0;
}

/* ── Results view ─────────────────────────────────────────────────────────── */
.a2-results-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0 2px;
}

.a2-rv-params {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--glp-bg-hover, rgba(255,255,255,0.05));
  border-radius: 6px;
}

.a2-rv-param {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--glp-text-main, #e0e0e0);
}

.a2-rv-param .material-symbols-outlined {
  font-size: 15px;
  color: var(--glp-text-muted);
}

/* ── Legend ───────────────────────────────────────────────────────────────── */
.a2-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--glp-bg-hover, rgba(255,255,255,0.05));
  border-radius: 6px;
}

.a2-legend-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--glp-text-muted);
  margin-bottom: 4px;
}

.a2-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--glp-text-main, #e0e0e0);
}

.a2-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid transparent;
  flex-shrink: 0;
}

.a2-legend-label {
  line-height: 1;
}

/* ── POI toggle ───────────────────────────────────────────────────────────── */
.a2-rv-toggles {
  display: flex;
  gap: 6px;
}

.a2-poi-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--glp-border, rgba(255,255,255,0.15));
  background: transparent;
  color: var(--glp-text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.a2-poi-toggle .material-symbols-outlined {
  font-size: 15px;
}

.a2-poi-toggle--on {
  background: rgba(30, 100, 200, 0.15);
  border-color: #1e64c8;
  color: #6fa8f5;
}

.a2-poi-toggle:hover {
  background: rgba(255,255,255,0.07);
}

/* ── Results view actions ─────────────────────────────────────────────────── */
.a2-rv-actions {
  display: flex;
  gap: 6px;
  padding-top: 2px;
}

.a2-rv-btn-change {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--glp-border, rgba(255,255,255,0.15));
  background: transparent;
  color: var(--glp-text-main, #e0e0e0);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
  justify-content: center;
}

.a2-rv-btn-change:hover {
  background: var(--glp-bg-hover, rgba(255,255,255,0.08));
}

.a2-rv-btn-change .material-symbols-outlined {
  font-size: 15px;
}

.a2-rv-btn-refresh {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(251,191,36,0.35);
  background: rgba(251,191,36,0.07);
  color: #fbbf24;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.a2-rv-btn-refresh:hover {
  background: rgba(251,191,36,0.15);
}
.a2-rv-btn-refresh .material-symbols-outlined { font-size: 15px; }

.a2-rv-btn-reprepare {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: inherit;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 6px;
  color: #f87171;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.a2-rv-btn-reprepare:hover {
  background: rgba(239,68,68,0.18);
}
.a2-rv-btn-reprepare .material-symbols-outlined { font-size: 15px; }

/* ── Results view: timing row ─────────────────────────────────────────────── */
.a2-rv-timing {
  margin-top: 2px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 4px;
}

.a2-rv-timing-val {
  color: var(--glp-text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ── Benchmark chip (panel derecho) ───────────────────────────────────────── */
.a2-bench-chip {
  border-left: 3px solid #60a5fa !important;
}

.a2-bench-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
}

.a2-bench-header .material-symbols-outlined {
  font-size: 15px;
  color: #60a5fa;
}

.a2-bench-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 3px;
}

.a2-bench-total {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
}

.a2-bench-label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--glp-text-muted);
}

.a2-bench-label .material-symbols-outlined {
  font-size: 13px;
}

.a2-bench-val {
  font-variant-numeric: tabular-nums;
  color: var(--glp-text-main, #e0e0e0);
  min-width: 36px;
  text-align: right;
}

.a2-bench-bar-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-bottom: 6px;
  overflow: hidden;
}

.a2-bench-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #34d399);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.a2-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--glp-text-muted);
  font-size: 12px;
  padding: 4px 0;
}

.a2-error {
  color: #f87171;
  font-size: 12px;
  margin: 4px 0;
}

.a2-hint {
  color: var(--glp-text-muted);
  font-size: 11px;
  margin: 2px 0;
}

.a2-ok {
  color: #4ade80;
  font-size: 12px;
  margin: 4px 0;
}

.a2-cmd {
  display: block;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--glp-border);
  border-radius: 5px;
  padding: 6px 9px;
  font-family: monospace;
  font-size: 11px;
  color: #86efac;
  word-break: break-all;
  margin-top: 4px;
  user-select: all;
}

/* ── Prepare confirm card ── */
.a2-prepare-confirm {
  border: 1px solid rgba(251,146,60,0.35);
  border-radius: 8px;
  padding: 12px;
  background: rgba(251,146,60,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.a2-prep-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fb923c;
  font-size: 13px;
}
.a2-prep-header .material-symbols-outlined { font-size: 17px; }
.a2-prep-msg { font-size: 12px; color: var(--glp-text); margin: 0; line-height: 1.5; }
.a2-prep-estimate {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--glp-text-muted);
  background: rgba(0,0,0,0.2);
  border-radius: 5px;
  padding: 5px 8px;
}
.a2-prep-estimate .material-symbols-outlined { font-size: 14px; }
.a2-prep-actions {
  display: flex;
  gap: 7px;
  margin-top: 2px;
}
.a2-prep-cancel {
  flex: 0 0 auto;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--glp-border);
  border-radius: 6px;
  color: var(--glp-text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.a2-prep-cancel:hover { border-color: var(--glp-text-muted); }
.a2-prep-ok {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  background: #fb923c;
  border: none;
  border-radius: 6px;
  color: #000;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.a2-prep-ok:hover { opacity: 0.88; }
.a2-prep-ok .material-symbols-outlined { font-size: 15px; }

/* ── Cancel analysis button ── */
.a2-cancel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  margin-top: 10px;
  padding: 7px 14px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #f87171;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.a2-cancel-btn:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.5);
}
.a2-cancel-btn .material-symbols-outlined { font-size: 15px; }
.a2-warn {
  color: #fb923c;
  font-size: 12px;
  margin: 6px 0 0;
}

/* ── Prepare progress ── */
.a2-prep-progress {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.a2-prep-prog-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--glp-text);
}
.a2-prep-prog-header .material-symbols-outlined { font-size: 15px; color: #60a5fa; }
.a2-prep-bar-wrap {
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  height: 5px;
  overflow: hidden;
}
.a2-prep-bar {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #818cf8);
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 4px;
}
.a2-prep-step-info {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--glp-text-muted);
}
.a2-prep-step-msg {
  text-align: right;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Barra indeterminada (cuando WebSocket no está disponible) */
.a2-prep-bar--indeterminate {
  width: 40% !important;
  animation: a2-bar-slide 1.6s ease-in-out infinite;
}
@keyframes a2-bar-slide {
  0%   { margin-left: -40%; }
  100% { margin-left: 140%; }
}

/* Spin animation para el ícono de carga */
@keyframes a2-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.a2-spin {
  display: inline-block;
  animation: a2-spin 1.2s linear infinite;
}

/* ── Chip de métricas en el panel chat derecho ── */
.a2-rp-chip {
  background: rgba(13, 127, 242, 0.08);
  border-left: 3px solid var(--glp-primary);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.6;
}

/* ── Badge de área dibujada (toggle opcional) ── */
.a2-poly-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 10px;
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s;
}
/* Estado ON: clip activo */
.a2-poly-badge--on {
  background: rgba(251, 146, 60, 0.12);
  border: 1px solid rgba(251, 146, 60, 0.4);
  color: #fb923c;
}
/* Estado OFF: clip disponible pero no activo */
.a2-poly-badge--off {
  background: rgba(100, 116, 139, 0.08);
  border: 1px dashed rgba(100, 116, 139, 0.35);
  color: var(--glp-text-muted, #94a3b8);
}
.a2-poly-badge--off:hover {
  background: rgba(251, 146, 60, 0.07);
  border-color: rgba(251, 146, 60, 0.3);
  color: #fb923c;
}
.a2-poly-badge .material-symbols-outlined {
  font-size: 16px;
}
.a2-poly-badge span:nth-child(2) {
  flex: 1;
  font-weight: 500;
}
.a2-poly-clear {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: rgba(251, 146, 60, 0.7);
  display: flex;
  align-items: center;
}
.a2-poly-clear:hover { color: #fb923c; }
.a2-poly-clear .material-symbols-outlined { font-size: 14px; }

/* ── City free-text autocomplete ── */
.a2-city-ac-wrap {
  position: relative;
}
.a2-ac-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--glp-surface);
  border: 1px solid var(--glp-border);
  border-radius: 6px;
  z-index: 3000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  max-height: 220px;
  overflow-y: auto;
}
.a2-ac-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--glp-border);
  transition: background 0.1s;
}
.a2-ac-item:last-child { border-bottom: none; }
.a2-ac-item:hover { background: rgba(255,255,255,0.07); }
.a2-ac-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--glp-text);
}
.a2-ac-meta {
  font-size: 10px;
  color: var(--glp-text-muted);
}
.a2-ac-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  color: var(--glp-text-muted);
  margin-bottom: 2px;
  width: fit-content;
}
.a2-ac-tag--partido {
  background: rgba(96,165,250,0.18);
  color: #60a5fa;
}
.a2-ac-loading,
.a2-ac-empty {
  padding: 10px 12px;
  font-size: 11px;
  color: var(--glp-text-muted);
  text-align: center;
}

/* ── City picker (modo polígono) ── */
.a2-city-count {
  font-weight: 400;
  font-size: 10px;
  color: var(--glp-text-muted);
  margin-left: 4px;
}

.a2-city-picker {
  border: 1px solid var(--glp-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--glp-bg);
}

.a2-city-filter-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--glp-border);
  background: var(--glp-surface);
}
.a2-city-filter-wrap .material-symbols-outlined {
  font-size: 15px;
  color: var(--glp-text-muted);
  flex-shrink: 0;
}

.a2-city-filter-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--glp-text);
}
.a2-city-filter-input::placeholder { color: var(--glp-text-muted); }

.a2-city-list {
  max-height: 168px;
  overflow-y: auto;
}

.a2-city-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--glp-border);
  gap: 8px;
}
.a2-city-row:last-child { border-bottom: none; }
.a2-city-row:hover { background: rgba(255,255,255,0.05); }

.a2-city-row--active {
  background: rgba(251, 146, 60, 0.12);
  border-left: 3px solid #fb923c;
}
.a2-city-row--active .a2-city-name { color: #fb923c; }

/* Left column: name + province/country stacked */
.a2-city-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.a2-city-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--glp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.a2-city-meta {
  font-size: 10px;
  color: var(--glp-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right column: coordinates */
.a2-city-coords {
  font-size: 10px;
  color: var(--glp-text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Legacy aliases kept for safety */
.a2-city-country,
.a2-city-location {
  font-size: 10px;
  color: var(--glp-text-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.a2-city-other {
  border-top: 1px solid var(--glp-border);
  display: flex;
  flex-direction: column;
}

.a2-city-other-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--glp-text-muted);
  width: 100%;
  text-align: left;
  transition: color 0.15s;
}
.a2-city-other-btn:hover { color: var(--glp-primary, #60a5fa); }
.a2-city-other-btn .material-symbols-outlined { font-size: 14px; }

.a2-city-other .a2-city-input {
  margin: 0 10px 8px;
  width: calc(100% - 20px);
  box-sizing: border-box;
}

/* ── Context chip: área dibujada (panel derecho) ── */
.a2-ctx-chip {
  border-left: 3px solid #fb923c !important;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 10px 12px;
  background: rgba(251, 146, 60, 0.06);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}
.a2-ctx-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #fb923c;
}
.a2-ctx-header .material-symbols-outlined { font-size: 15px; }
.a2-ctx-header strong { font-size: 13px; }

.a2-ctx-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}
.a2-ctx-lbl {
  color: var(--glp-text-muted);
  flex-shrink: 0;
  padding-top: 1px;
}
.a2-ctx-munis {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.a2-ctx-muni {
  background: rgba(251,146,60,0.12);
  color: #fb923c;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 500;
}
.a2-ctx-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--glp-text-muted);
  font-style: italic;
}

/* ─── Drawing overlay pill (positioned via JS below toolbar) ── */
.glp-drawing-overlay {
  position: fixed;
  /* top/left set dynamically by JS after getBoundingClientRect */
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(234, 179, 8, 0.96);
  color: #1c1917;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 50px;
  box-shadow: 0 3px 18px rgba(0,0,0,0.45);
  pointer-events: none;
  letter-spacing: 0.02em;
  animation: glp-overlay-fadein 0.25s ease;
}
.glp-drawing-overlay .material-symbols-outlined {
  font-size: 20px;
}
@keyframes glp-overlay-fadein {
  from { opacity: 0; margin-top: -8px; }
  to   { opacity: 1; margin-top: 0; }
}

/* ─── Yellow crosshair cursor in drawing mode ─────────────── */
/* SVG data URI: yellow crosshair with dark outline, 32×32, hotspot 16,16 */
.glp-drawing-cursor,
.glp-drawing-cursor .ol-viewport {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cline x1='16' y1='2' x2='16' y2='13' stroke='%231c1917' stroke-width='4' stroke-linecap='round'/%3E%3Cline x1='16' y1='19' x2='16' y2='30' stroke='%231c1917' stroke-width='4' stroke-linecap='round'/%3E%3Cline x1='2' y1='16' x2='13' y2='16' stroke='%231c1917' stroke-width='4' stroke-linecap='round'/%3E%3Cline x1='19' y1='16' x2='30' y2='16' stroke='%231c1917' stroke-width='4' stroke-linecap='round'/%3E%3Cline x1='16' y1='2' x2='16' y2='13' stroke='%23facc15' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='16' y1='19' x2='16' y2='30' stroke='%23facc15' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='2' y1='16' x2='13' y2='16' stroke='%23facc15' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='19' y1='16' x2='30' y2='16' stroke='%23facc15' stroke-width='2.5' stroke-linecap='round'/%3E%3Ccircle cx='16' cy='16' r='3' fill='%23facc15' stroke='%231c1917' stroke-width='1.5'/%3E%3C/svg%3E") 16 16, crosshair !important;
}

/* Area guidance chip in right panel */
.a2-area-guidance {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(250,204,21,0.08);
  border: 1px solid rgba(250,204,21,0.2);
  border-radius: 6px;
  padding: 10px 12px;
}
.a2-area-guidance .material-symbols-outlined {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.a2-area-guidance p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--glp-text);
}

/* ── A2 analysis layer item in Capas Activas ─────────────────────────── */
/* A2 layer items now reuse the standard .glp-layer-item / <details> styles.
   Only the meta line (coverage/avg-time) needs its own rule. */
.glp-a2-layer-meta {
  font-size: 11px;
  color: var(--glp-text-muted, #9ca3af);
}

/* Inline reconfig panel that expands below the layer item */
.glp-a2-reconfig-panel {
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 10px;
}
/* When the reconfig form is open, rotate the chevron smoothly */
#glp-a2-reconfig-chevron-por_area {
  transition: transform 0.2s;
}
.glp-a2-reconfig-panel:not([style*="none"]) ~ * { /* unused, handled via JS */ }

/* ── Wizard step 11: sub-option hint & step sub-label ────────────────── */
.glp-step-hint {
  font-size: 12px;
  color: var(--glp-text-muted, #9ca3af);
  margin: 0 0 10px;
  line-height: 1.5;
  padding: 0 4px;
}
.glp-btn-step-sub {
  display: block;
  font-size: 10px;
  color: var(--glp-text-muted, #9ca3af);
  margin-top: 2px;
  font-weight: 400;
}

/* ── A2Wiz: H3 resolution selector ───────────────────────────────────────── */
.a2-section--inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.a2-advanced-opts {
  padding-top: 4px;
  padding-bottom: 0;
}

.a2-toggle-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--glp-text-muted, #94a3b8);
  cursor: pointer;
  user-select: none;
}
.a2-toggle-label input[type="checkbox"] {
  accent-color: #fb923c;
  width: 13px;
  height: 13px;
  cursor: pointer;
}

.a2-h3res-row {
  display: flex;
  gap: 4px;
}

.a2-h3res-btn {
  width: 32px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.a2-h3res-btn:hover {
  border-color: rgba(13, 127, 242, 0.4);
  color: var(--glp-text);
}
.a2-h3res-btn.a2-h3res--active {
  border-color: var(--glp-primary);
  background: rgba(13, 127, 242, 0.15);
  color: var(--glp-primary);
}

/* ── A2Wiz: field/layer selector (results view) ───────────────────────────── */
.a2-field-row {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.a2-field-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 16px;
  border: 1px solid var(--glp-border);
  background: var(--glp-surface);
  color: var(--glp-text-muted);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.a2-field-btn .material-symbols-outlined {
  font-size: 14px;
}
.a2-field-btn:hover {
  border-color: rgba(13, 127, 242, 0.4);
  color: var(--glp-text);
}
.a2-field-btn.a2-field-btn--active {
  border-color: var(--glp-primary);
  background: rgba(13, 127, 242, 0.18);
  color: var(--glp-primary);
}

/* ── A2Wiz: elapsed time en header de preparación ────────────────────────── */
.a2-prep-prog-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.a2-prep-elapsed {
  margin-left: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--glp-text-muted);
  letter-spacing: 0.03em;
}
