/**
 * GeoSV - Panel compacto de límites políticos
 * Departamentos / Provincias / Distritos: listado, resaltado y etiqueta forzada.
 */

#political-feature-panel {
  position: absolute;
  top: 58px;
  right: 46px;
  width: min(350px, calc(100vw - 64px));
  height: min(430px, calc(100vh - 118px));
  min-width: 300px;
  min-height: 230px;
  transform: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  z-index: 760;
  resize: both;
}

#political-feature-panel.hidden { display: none !important; }

#political-feature-panel .political-feature-panel-header {
  min-height: 48px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  cursor: move;
  user-select: none;
}

.political-feature-panel-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.political-feature-panel-heading > i {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(250, 92, 0, .12);
  color: var(--primary);
  font-size: 12px;
}

.political-feature-panel-title-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.political-feature-panel-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.political-feature-panel-subtitle {
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.political-feature-panel-close {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.political-feature-panel-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.political-feature-tabs {
  min-height: 34px;
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 1px;
  padding: 4px 6px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
}
.political-feature-tabs::-webkit-scrollbar { display: none; }

.political-feature-tab {
  min-width: 0;
  height: 29px;
  flex: 1 1 0;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.political-feature-tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,.025);
}

.political-feature-tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.political-feature-tab-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.political-feature-tab-count {
  min-width: 17px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(250,92,0,.13);
  color: var(--primary);
  font-size: 8.5px;
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
}

.political-feature-search-wrap {
  height: 36px;
  flex: 0 0 36px;
  margin: 6px 7px 5px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  background: var(--bg-input);
  color: var(--text-muted);
}

.political-feature-search-wrap:focus-within {
  border-color: rgba(250,92,0,.58);
  box-shadow: 0 0 0 2px rgba(250,92,0,.08);
}

.political-feature-search-wrap > i {
  flex: 0 0 auto;
  font-size: 10px;
}

.political-feature-search {
  min-width: 0;
  flex: 1 1 auto;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 10.5px;
}

.political-feature-search::placeholder { color: var(--text-muted); }
.political-feature-search::-webkit-search-cancel-button { display: none; }

.political-feature-search-clear {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: 9px;
  cursor: pointer;
}

.political-feature-search-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.political-feature-search-clear.hidden { display: none !important; }

.political-feature-list-head {
  height: 27px;
  flex: 0 0 27px;
  padding: 0 8px 0 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,.04);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.political-feature-list-head span:last-child { text-align: center; }

.political-feature-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #53616d transparent;
}

.political-feature-list::-webkit-scrollbar { width: 6px; }
.political-feature-list::-webkit-scrollbar-thumb { background: #53616d; border-radius: 6px; }

.political-feature-row {
  min-height: 34px;
  padding: 3px 8px 3px 11px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(69,90,100,.30);
  background: transparent;
  cursor: pointer;
  outline: none;
}

.political-feature-row:hover { background: rgba(255,255,255,.035); }
.political-feature-row:focus-visible {
  background: rgba(24,184,255,.07);
  box-shadow: inset 2px 0 0 #18b8ff;
}

.political-feature-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 10.8px;
  font-weight: 500;
}

.political-feature-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.political-feature-action {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.political-feature-action:hover {
  border-color: #52616d;
  color: var(--text-primary);
  background: var(--bg-hover);
}

.political-feature-action[data-action="highlight"].is-active {
  color: #18b8ff;
  border-color: rgba(24,184,255,.58);
  background: rgba(24,184,255,.12);
}

.political-feature-action[data-action="label"].is-active {
  color: var(--primary);
  border-color: rgba(250,92,0,.50);
  background: rgba(250,92,0,.11);
}

.political-feature-panel-footer {
  min-height: 30px;
  flex: 0 0 30px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-dark);
  color: var(--text-muted);
  font-size: 9.5px;
}

.political-feature-panel-empty {
  height: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

/* Etiqueta permanente solicitada desde el panel político.
   No usa .element-label, por lo tanto permanece visible aunque el mapa tenga .labels-hidden. */
.political-forced-label {
  display: block !important;
  opacity: 1 !important;
  background: rgba(24, 31, 37, .94) !important;
  border: 1px solid rgba(24,184,255,.72) !important;
  color: #fff !important;
  padding: 3px 7px !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 7px rgba(0,0,0,.34) !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  pointer-events: none !important;
  z-index: 9999 !important;
}

.political-forced-label::before {
  border-top-color: rgba(24,184,255,.72) !important;
}

.labels-hidden .political-forced-label { display: block !important; }

@media (max-width: 620px) {
  #political-feature-panel {
    top: 48px;
    right: 44px;
    width: min(340px, calc(100vw - 56px));
    height: min(400px, calc(100vh - 86px));
    min-width: 0;
    min-height: 210px;
    resize: none;
  }
}
