.mfg-leaflet-map {
  width: 100%;
  min-height: 240px;
}

.mfg-leaflet-map:fullscreen {
  width: 100vw;
  height: 100vh;
}

.mfg-leaflet-map .mfg-map-controls {
  border: 0;
  box-shadow: none;
}

.mfg-leaflet-map .mfg-map-locate-btn,
.mfg-leaflet-map .mfg-map-fullscreen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: #fff;
  color: #111;
  cursor: pointer;
  line-height: 1;
}

.mfg-leaflet-map .mfg-map-locate-btn:hover,
.mfg-leaflet-map .mfg-map-locate-btn:focus-visible,
.mfg-leaflet-map .mfg-map-fullscreen-btn:hover,
.mfg-leaflet-map .mfg-map-fullscreen-btn:focus-visible {
  background: #f3f3f3;
}

.mfg-leaflet-map .mfg-map-locate-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.mfg-leaflet-map .mfg-map-locate-btn.is-active,
.mfg-leaflet-map .mfg-map-fullscreen-btn.is-active {
  background: #e8eef7;
}

.mfg-leaflet-map .mfg-map-status {
  position: absolute;
  z-index: 500;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(17, 17, 17, 0.88);
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}

.mfg-leaflet-map .mfg-map-status.is-error {
  background: rgba(153, 27, 27, 0.92);
}

.mfg-leaflet-map .leaflet-tooltip.mfg-user-tooltip {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.mfg-leaflet-map .leaflet-tooltip.mfg-user-tooltip::before {
  border-top-color: #2563eb;
}

.mfg-object-list__distance {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.9em;
  opacity: 0.85;
}

.mfg-object-list__distance::before {
  content: "";
}

/* Empty object list (no search/filter hits) */
.mfg-object-list .mfg-object-list__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2rem 1rem;
  text-align: center;
}

/* Custom marker pin (black with white icon) */
.mfg-leaflet-map .mfg-pin {
  background: transparent;
  border: 0;
}

.mfg-leaflet-map .mfg-pin__wrap {
  display: block;
  width: 28px;
  height: 36px;
}

.mfg-leaflet-map .mfg-pin__svg {
  display: block;
  width: 28px;
  height: 36px;
}

.mfg-leaflet-map .mfg-pin__img {
  display: block;
  width: 28px;
  height: 36px;
}

/* Leaflet popup styling (black background, white text) */
.mfg-leaflet-map .leaflet-popup-content-wrapper,
.mfg-leaflet-map .leaflet-popup-tip {
  background: #000;
  color: #fff;
}

/* Theme-card popup (opened on marker click) */
.mfg-leaflet-map .leaflet-popup.mfg-popup .leaflet-popup-content-wrapper,
.mfg-leaflet-map .leaflet-popup.mfg-popup .leaflet-popup-tip {
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.mfg-leaflet-map .leaflet-popup.mfg-popup .leaflet-popup-content {
  margin: 0;
}

.mfg-leaflet-map .leaflet-popup.mfg-popup .leaflet-popup-close-button {
  color: inherit;
}

/* Ensure popup card is readable even without theme background */
.mfg-leaflet-map .leaflet-popup.mfg-popup .mfg-tooltip-card {
  background: #fff;
  color: #111;
}

.mfg-leaflet-map .leaflet-popup.mfg-popup .mfg-tooltip-card a {
  color: inherit;
}

/* Default Leaflet tooltip (keep simple); our custom tooltip uses theme card classes */
.mfg-leaflet-map .leaflet-tooltip {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.mfg-leaflet-map .leaflet-tooltip::before {
  border-top-color: #000;
}

.mfg-leaflet-map .leaflet-tooltip a {
  color: #fff;
  text-decoration: underline;
}

/* Custom map tooltip uses theme "grid item" look */
.mfg-leaflet-map .leaflet-tooltip.mfg-tooltip {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  color: inherit;
}

.mfg-leaflet-map .leaflet-tooltip.mfg-tooltip::before {
  display: none;
}

.mfg-leaflet-map .leaflet-tooltip.mfg-tooltip .post-img img {
  display: block;
  width: 100%;
  height: auto;
}

.mfg-leaflet-map .leaflet-popup-content {
  margin: 10px 12px;
  color: #fff;
}

.mfg-leaflet-map .leaflet-popup-content a {
  color: #fff;
  text-decoration: underline;
}

.mfg-leaflet-map .leaflet-popup-close-button {
  color: #fff;
}

.mfg-leaflet-map .leaflet-popup-close-button:hover {
  color: #fff;
}

.mfg-object-list {
  margin-top: 16px;
}

.mfg-object-list__items {
  /* Theme provides layout via .grid-item-wrapper (flex + gap) */
}

.mfg-object-list__item {
  /* Wrapper now carries theme grid/card classes */
}

.mfg-object-list__item.is-active {
  outline: 3px solid rgba(0, 120, 255, 0.15);
  box-shadow: 0 0 0 1px rgba(0, 120, 255, 0.55);
}

.mfg-object-list.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.mfg-object-list__title {
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
}

.mfg-object-list__title:hover,
.mfg-object-list__title:focus {
  text-decoration: underline;
}

.mfg-object-list__address {
  margin-top: 4px;
  font-size: 0.95em;
  opacity: 0.85;
}

/* Filter: search-above multi-select */
.mfg-filter__input--select-search {
  margin-bottom: 6px;
}

.mfg-filter__dropdown {
  position: relative;
}

.mfg-filter .mfg-filter__dropdown {
  /* Some themes override positioning; ensure panel is taken out of flow */
  position: relative !important;
}

.mfg-filter__dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mfg-filter__dropdown-toggle-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.mfg-filter__dropdown-caret::before {
  content: "▾";
  display: inline-block;
  line-height: 1;
  opacity: 0.8;
}

.mfg-filter__dropdown-toggle[aria-expanded="true"] .mfg-filter__dropdown-caret::before {
  transform: rotate(180deg);
}

.mfg-filter__dropdown-panel {
  position: absolute;
  z-index: 200;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  margin-top: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0;
  padding: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  /* Avoid scroll chaining to page when dropdown is open */
  overscroll-behavior: contain;
}

.mfg-filter .mfg-filter__dropdown-panel {
  /* Force absolute positioning even under aggressive theme CSS */
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
}

.mfg-filter__row--cols {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
}

.mfg-filter__row--cols>.mfg-filter__label {
  flex: 1 1 220px;
  min-width: 200px;
}

.mfg-filter__actions-inline {
  flex: 0 0 auto;
  align-self: flex-end;
  display: inline-flex;
  gap: 10px;
}

.mfg-filter__actions-inline .mfg-filter__submit {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .mfg-filter__actions-inline {
    flex: 1 1 100%;
    display: flex;
  }

  .mfg-filter__actions-inline .mfg-filter__submit {
    width: 100%;
    text-align: center;
  }

  .mfg-filter__actions-inline .mfg-filter__reset {
    width: 100%;
    text-align: center;
  }
}

.mfg-filter__checklist {
  max-height: 240px;
  overflow: auto;
  background: #fff;
  /* Prevent "scroll past footer" on trackpad/touch when reaching ends */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.mfg-filter__check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 0;
  cursor: pointer;
  font-size: 1rem !important;
  color: #111 !important;
}

.mfg-filter__check:hover {
  background: rgba(0, 0, 0, 0.05);
}

.mfg-filter__check.is-hidden {
  display: none !important;
}

.mfg-filter__check input[type="checkbox"] {
  /* Themes often set input { width:100% }; force checkbox to stay small */
  width: 1.25rem !important;
  height: 1.25rem !important;
  flex: 0 1 1.25rem;
  min-width: 1.25rem;
}

.mfg-filter__check-label {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: inherit !important;
  line-height: 1.25 !important;
  font-size: inherit !important;
}

/* Extra specificity in case theme targets label/span heavily */
.mfg-filter .mfg-filter__check .mfg-filter__check-label {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: inherit !important;
  color: inherit !important;
}