/**
 * pm-active-bar — fonte única (layout + chrome + filhos + temas mapa).
 *
 * Tokens: --pm-hud-bar-max / --pm-active-bar-max / --pm-active-bar-radius (:root em styles.css).
 * Carregar por último no index.html. Não redefinir a barra em outros CSS.
 */

/* ── HUD grid: coluna central para a barra ── */
html body.pm-liquid-v2 .pm-map-bottom-hud.pm-map-corner-bottom,
html body .pm-map-bottom-hud.pm-map-corner-bottom {
  grid-template-columns: minmax(0, 1fr)
    minmax(var(--pm-hud-bar-min, 280px), var(--pm-hud-bar-max, 840px))
    minmax(0, 1fr) !important;
}

/* ── Shell ── */
html body .pm-map-bottom-hud .pm-active-bar,
html body .pm-map-layout .pm-map-bottom-hud .pm-active-bar,
html body .pm-map-area .pm-map-bottom-hud .pm-active-bar,
html body .pm-map-corner-bottom .pm-active-bar,
html body #pmActiveBar,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-bar,
html body.pm-liquid-v2 .pm-map-corner-bottom .pm-active-bar,
html body.pm-liquid-v2 #pmActiveBar,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-map-bottom-hud .pm-active-bar,
html body.pm-liquid-v2.map-source-active .pm-map-area #pmActiveBar,
html
  body.pm-liquid-v2
  .censo-integrated[data-active-source="mapa"]
  .pm-map-area
  .pm-map-bottom-hud
  .pm-active-bar,
html
  body.pm-liquid-v2
  .censo-integrated[data-active-source="mapa"]
  .pm-map-area
  #pmActiveBar,
html body.pm-liquid-v2.pm-apple-shell .pm-map-bottom-hud .pm-active-bar,
html
  body.pm-liquid-v2.map-source-active
  .pm-map-layout.pm-map-sidebar-rail-collapsed
  .pm-map-area
  .pm-map-bottom-hud
  .pm-active-bar {
  grid-column: 2 !important;
  justify-self: center !important;
  align-self: end !important;
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  flex: 0 0 auto !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 2px !important;
  width: max-content !important;
  max-width: var(--pm-active-bar-max, min(840px, 90%)) !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 auto !important;
  padding: 4px 5px 4px 10px !important;
  box-sizing: border-box !important;
  border-radius: var(--pm-active-bar-radius, 999px) !important;
  overflow: hidden !important;
  pointer-events: auto !important;
  border: 1.5px solid rgba(154, 165, 184, 0.38) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  background-image: none !important;
  box-shadow:
    0 4px 18px rgba(32, 55, 95, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  color: #9aa5b8 !important;
  transition: width 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Head / label / count ── */
html body .pm-map-bottom-hud .pm-active-bar-head,
html body #pmActiveBar .pm-active-bar-head {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  flex: 0 0 auto !important;
  min-width: 0 !important;
}

html body .pm-map-bottom-hud .pm-active-bar-label,
html body #pmActiveBar .pm-active-bar-label,
html body .pm-active-bar-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  flex-shrink: 0 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: #474d57 !important;
  white-space: nowrap !important;
}

html body .pm-map-bottom-hud .pm-active-bar-label svg,
html body #pmActiveBar .pm-active-bar-label svg {
  display: none !important;
}

html body .pm-map-bottom-hud .pm-active-bar-count,
html body #pmActiveBar .pm-active-bar-count,
html body .pm-active-bar-count,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-bar-count,
html body.pm-liquid-v2 #pmActiveCount {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  height: 22px !important;
  padding: 0 8px !important;
  margin-right: 2px !important;
  border-radius: 999px !important;
  background: rgba(154, 165, 184, 0.12) !important;
  border: 1px solid rgba(154, 165, 184, 0.28) !important;
  color: #9aa5b8 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

html body .pm-active-bar-chevron,
html body.pm-liquid-v2 .pm-active-bar-chevron {
  display: none !important;
}

/* ── Chips rail ── */
html body .pm-map-bottom-hud .pm-active-chips-rail,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-chips-rail {
  display: flex !important;
  flex: 0 1 auto !important;
  align-items: center !important;
  gap: 4px !important;
  min-width: 0 !important;
}

html body .pm-map-bottom-hud .pm-active-chips,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-chips,
html body.pm-liquid-v2 #pmActiveChips {
  display: flex !important;
  flex: 0 1 auto !important;
  align-items: center !important;
  gap: 4px !important;
  min-width: 0 !important;
  width: auto !important;
  height: auto !important;
  max-height: 32px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  scroll-behavior: smooth !important;
  -webkit-overflow-scrolling: touch !important;
  opacity: 1 !important;
  position: static !important;
  pointer-events: auto !important;
}

html body .pm-map-bottom-hud .pm-active-chips::-webkit-scrollbar {
  display: none !important;
}

html body .pm-map-bottom-hud .pm-active-chips-nav,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-chips-nav {
  width: 16px !important;
  max-width: 16px !important;
  height: 30px !important;
  flex: 0 0 22px !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0 !important;
  border: 1px solid rgba(126, 138, 163, 0.22) !important;
  background: #eef1f5 !important;
  color: #7c8aa3 !important;
  padding: 0 !important;
  cursor: pointer !important;
  opacity: 1 !important;
  position: static !important;
  pointer-events: auto !important;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    opacity 0.18s ease !important;
}

html body .pm-map-bottom-hud .pm-active-chips-rail.is-scrollable .pm-active-chips-nav,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-chips-rail.is-scrollable .pm-active-chips-nav {
  display: inline-flex !important;
}

html body .pm-map-bottom-hud .pm-active-chips-nav:hover:not(:disabled):not(.is-disabled) {
  background: #dde2e9 !important;
  color: #4a6fa5 !important;
}

html body .pm-map-bottom-hud .pm-active-chips-nav:disabled,
html body .pm-map-bottom-hud .pm-active-chips-nav.is-disabled,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-chips-nav:disabled,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-chips-nav.is-disabled {
  opacity: 0.35 !important;
  cursor: default !important;
  pointer-events: none !important;
  transform: none !important;
}

html body .pm-map-bottom-hud .pm-active-chips-nav[hidden],
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-chips-nav[hidden] {
  display: none !important;
}

/* ── Empty / chip ── */
html body .pm-map-bottom-hud .pm-active-empty,
html body #pmActiveBar .pm-active-empty {
  font-size: 12px !important;
  font-weight: 400 !important;
  color: #9aa5b8 !important;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  line-height: 1.16 !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

html body .pm-map-bottom-hud .pm-active-chip,
html body #pmActiveBar .pm-active-chip {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 30px !important;
  max-height: 30px !important;
  max-width: none !important;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  padding: 4px !important;
  border-radius: 10px !important;
  color: #6e7b93 !important;
  gap: 4px !important;
  overflow: visible !important;
}

html body .pm-map-bottom-hud .pm-active-chip-dot {
  width: 8px !important;
  height: 8px !important;
  border-radius: 999px !important;
  flex: 0 0 auto !important;
}

html body .pm-map-bottom-hud .pm-active-chip-text,
html body #pmActiveBar .pm-active-chip-text {
  font-size: 11px !important;
  font-weight: 500 !important;
  color: #697995 !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  flex: 0 0 auto !important;
  max-width: none !important;
}

/* ── Clear / chip-x / action ── */
html body .pm-map-bottom-hud .pm-active-chip-x,
html body .pm-map-bottom-hud .pm-active-bar-action,
html body #pmActiveBar .pm-active-bar-action,
html body.pm-liquid-v2 .pm-map-bottom-hud .pm-active-bar-action,
html body.pm-liquid-v2 #pmActiveClear {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(126, 138, 163, 0.22) !important;
  background: #eef1f5 !important;
  color: #7c8aa3 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  flex: 0 0 auto !important;
  cursor: pointer !important;
  opacity: 1 !important;
  position: static !important;
  pointer-events: auto !important;
  box-sizing: border-box !important;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease !important;
}

html body .pm-map-bottom-hud .pm-active-chip-x:hover,
html body .pm-map-bottom-hud .pm-active-bar-action:hover {
  background: #dde2e9 !important;
  color: #4a6fa5 !important;
}

html body .pm-map-bottom-hud .pm-active-bar-action {
  margin-left: 2px !important;
}

html body .pm-map-bottom-hud .pm-active-chip-x svg,
html body .pm-map-bottom-hud .pm-active-bar-action svg,
html body #pmActiveClear svg {
  width: 12px !important;
  height: 12px !important;
  max-width: 12px !important;
  max-height: 12px !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/* ── Responsive ── */
@media (max-width: 980px) {
  html body .pm-map-bottom-hud .pm-active-bar,
  html body #pmActiveBar {
    gap: 6px !important;
    padding: 6px 8px !important;
  }

  html body .pm-active-bar-count,
  html body .pm-map-bottom-hud .pm-active-bar-count,
  html body #pmActiveCount {
    display: none !important;
  }

  html body .pm-map-bottom-hud .pm-active-chip,
  html body #pmActiveBar .pm-active-chip {
    min-height: 22px !important;
    max-width: 190px !important;
  }
}

@media (max-width: 1100px) {
  html body .pm-map-bottom-hud .pm-active-bar,
  html body #pmActiveBar {
    order: 1 !important;
    position: relative !important;
    left: auto !important;
    margin: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .pm-map-bottom-hud .pm-active-bar,
  html body #pmActiveBar,
  html body.pm-liquid-v2 #pmActiveBar {
    transition: none !important;
  }
}

/* ── Tema: mapa liquid (vidro HUD) ── */
html body.pm-liquid-v2.map-source-active .pm-map-area #pmActiveBar,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-bar,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-map-bottom-hud .pm-active-bar,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-map-corner-bottom .pm-active-bar {
  background: var(--pm-map-hud-glass-fill, rgba(255, 255, 255, 0.94)) !important;
  background-color: var(--pm-map-hud-glass-fill, rgba(255, 255, 255, 0.94)) !important;
  background-image: none !important;
  border: 1px solid var(--pm-map-hud-glass-border, rgba(154, 165, 184, 0.38)) !important;
  box-shadow: var(--pm-map-hud-glass-shadow) !important;
  backdrop-filter: var(--pm-map-hud-glass-blur, blur(10px)) !important;
  -webkit-backdrop-filter: var(--pm-map-hud-glass-blur, blur(10px)) !important;
  color: #1a2b3c !important;
}

html body.pm-liquid-v2.map-source-active .pm-map-area #pmActiveBar:hover,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-bar:hover {
  background: var(--pm-map-hud-glass-fill-hover, var(--pm-map-hud-glass-fill, rgba(255, 255, 255, 0.98))) !important;
  background-color: var(--pm-map-hud-glass-fill-hover, var(--pm-map-hud-glass-fill, rgba(255, 255, 255, 0.98))) !important;
}

/* Apple + liquid no mapa: surface glass unificada */
html body.pm-liquid-v2.pm-apple-shell.map-source-active .pm-map-area #pmActiveBar,
html body.pm-liquid-v2.pm-apple-shell.map-source-active .pm-map-area .pm-active-bar {
  background: var(--pm-glass-surface-fill, rgba(255, 255, 255, 0.94)) !important;
  background-color: var(--pm-glass-surface-fill, rgba(255, 255, 255, 0.94)) !important;
  background-image: none !important;
  border: 1px solid var(--pm-glass-surface-border, rgba(154, 165, 184, 0.38)) !important;
  box-shadow: var(--pm-glass-surface-shadow, 0 4px 18px rgba(32, 55, 95, 0.08)) !important;
  backdrop-filter: var(--pm-glass-surface-blur, blur(10px)) !important;
  -webkit-backdrop-filter: var(--pm-glass-surface-blur, blur(10px)) !important;
  filter: none !important;
}

html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-bar-label,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-bar-count,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-empty {
  color: var(--pm-map-hud-icon, #1a2b3c) !important;
}

html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-chip-text {
  color: var(--pm-map-hud-text-muted, #5f7691) !important;
}

html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-bar-action,
html body.pm-liquid-v2.map-source-active .pm-map-bottom-hud .pm-active-bar-action,
html body.pm-liquid-v2 #pmActiveClear {
  border: var(--pm-glass-small-button-border, 1px solid rgba(126, 138, 163, 0.22)) !important;
  background: var(--pm-glass-small-button-fill, #eef1f5) !important;
  background-color: var(--pm-glass-small-button-fill, #eef1f5) !important;
  color: var(--pm-glass-small-button-content, #7c8aa3) !important;
  -webkit-text-fill-color: var(--pm-glass-small-button-content, #7c8aa3) !important;
  border-radius: 50% !important;
  box-shadow: none !important;
}

html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-bar-action svg,
html body.pm-liquid-v2.map-source-active .pm-map-area .pm-active-bar-action svg *,
html body.pm-liquid-v2 #pmActiveClear svg,
html body.pm-liquid-v2 #pmActiveClear svg * {
  color: var(--pm-glass-small-button-content, #7c8aa3) !important;
  stroke: currentColor !important;
}
