/* Novera Map — MapLibre brand style + fade + pin/popup */

.novera-map-wrap {
  position: relative;
  z-index: 1;
  isolation: isolate;
  width: 100%;
  overflow: hidden;
}

.novera-map {
  width: 100%;
  height: 560px;
  background: #f0ede9;
  /* MapLibre owns canvas pixel sizing — do not force width/height on canvas */
}

/* Top → bottom fade (above tiles, below markers) */
.novera-map-fade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    #ffffff 0%,
    rgba(255, 255, 255, 0.55) 18%,
    rgba(255, 255, 255, 0.15) 42%,
    rgba(255, 255, 255, 0) 65%
  );
}

/* Atamisa/Elementor global `transition: all` makes HTML markers/popups lag during pan */
.novera-map .maplibregl-marker,
.novera-map .maplibregl-marker *,
.novera-map .maplibregl-popup,
.novera-map .maplibregl-popup-anchor,
.novera-map .maplibregl-canvas-container,
.novera-map .maplibregl-canvas {
  transition: none !important;
  animation: none !important;
}

.novera-map .maplibregl-canvas-container.maplibregl-interactive,
.novera-map .maplibregl-canvas {
  /* Allow MapLibre touch handlers to own gestures inside the map */
  touch-action: manipulation;
}

.novera-map .maplibregl-popup {
  z-index: 3 !important;
}

.novera-map .maplibregl-popup-close-button {
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #8a919e !important;
  font-size: 18px !important;
  line-height: 20px !important;
}

.novera-map .maplibregl-popup-close-button:hover,
.novera-map .maplibregl-popup-close-button:focus {
  background: transparent !important;
  background-image: none !important;
  color: #242f46 !important;
}

.novera-map .maplibregl-ctrl-bottom-right {
  z-index: 4;
}

.novera-map .maplibregl-ctrl-group {
  border: none !important;
  box-shadow: 0 8px 24px rgba(22, 29, 43, 0.12);
  overflow: hidden;
  border-radius: 10px;
}

.novera-map .maplibregl-ctrl-group button {
  width: 34px;
  height: 34px;
}

.novera-map .maplibregl-ctrl-attrib {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #5a6478;
}

/* Collapsed: icon only. MapLibre adds compact-show by default on wide maps. */
.novera-map details.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-inner {
  display: none !important;
}

.novera-map details.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) {
  min-height: 20px;
  padding: 0 22px 0 0;
}

.novera-map .maplibregl-ctrl-attrib.maplibregl-compact {
  margin: 0 8px 8px 0;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(22, 29, 43, 0.1);
}

.novera-map .maplibregl-ctrl-attrib.maplibregl-compact-show {
  max-width: min(280px, calc(100vw - 32px));
  padding: 4px 28px 4px 8px;
}

/* Pins: MapLibre symbol layers (WebGL) — locked to coordinates.
   Place labels: HTML badges under pins (transition disabled above). */
.novera-map .maplibregl-marker.novera-map-pin-label,
.novera-map .novera-map-pin-label.maplibregl-marker {
  z-index: 2 !important;
  pointer-events: none !important;
}

.novera-map-pin-label {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: max-content;
  max-width: 11em;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(22, 29, 43, 0.1);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: #242f46;
  text-align: center;
  overflow: visible;
}

.novera-map-pin-label__name {
  display: block;
  font-weight: 600;
  color: #242f46;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.novera-map-pin-label__km {
  display: block;
  color: #82442f;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .novera-map-pin-label {
    font-size: 9px;
    padding: 2px 5px;
    max-width: 10em;
  }
}

/* Always-on branded popup */
.novera-map-gl-popup .maplibregl-popup-content {
  background: #ffffff;
  color: #242f46;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(22, 29, 43, 0.16);
  border: 1px solid rgba(36, 47, 70, 0.06);
  padding: 18px 20px 16px;
  min-width: 220px;
  text-align: center;
  position: relative;
}

.novera-map-gl-popup .maplibregl-popup-close-button {
  position: absolute !important;
  top: 8px !important;
  right: 10px !important;
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #8a919e !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  line-height: 20px !important;
  text-align: center !important;
  cursor: pointer !important;
  z-index: 2;
}

.novera-map-gl-popup .maplibregl-popup-close-button:hover,
.novera-map-gl-popup .maplibregl-popup-close-button:focus {
  background: transparent !important;
  background-image: none !important;
  color: #242f46 !important;
}

.novera-map-gl-popup .maplibregl-popup-tip {
  border-top-color: #ffffff;
}

.novera-map-popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.novera-map-popup__logo {
  display: block;
  height: 30px;
  width: auto;
  max-width: 168px;
  object-fit: contain;
  margin-inline: auto;
}

.novera-map-popup__name {
  font-size: 16px;
  color: #242f46;
}

.novera-map-popup__address {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6478;
  font-weight: 500;
}

.novera-map-popup--place {
  gap: 8px;
  text-align: center;
}

.novera-map-popup--place .novera-map-popup__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #242f46;
}

.novera-map-popup--place .novera-map-popup__address {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 400;
  color: #5a6478;
  line-height: 1.4;
}

.novera-map-popup__distance {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #82442f;
}

.novera-map-gl-popup--place .maplibregl-popup-content {
  padding: 14px 28px 12px 16px;
  min-width: 160px;
  border-radius: 12px;
  position: relative;
}

/* Reset MapLibre close control — Elementor button styles were bleeding in */
.novera-map-gl-popup--place .maplibregl-popup-close-button {
  position: absolute !important;
  top: 4px !important;
  right: 6px !important;
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #8a919e !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  line-height: 20px !important;
  text-align: center !important;
  cursor: pointer !important;
  z-index: 2;
}

.novera-map-gl-popup--place .maplibregl-popup-close-button:hover,
.novera-map-gl-popup--place .maplibregl-popup-close-button:focus {
  background: transparent !important;
  background-image: none !important;
  color: #242f46 !important;
}

.novera-map-popup__btn-wrap {
  margin-top: 4px;
}

/* Match slider / Atamisa brand gradient button */
.novera-map-popup__btn.elementor-button {
  --icon-normal: var(--novera-btn-text, #161d2b);
  --icon-hover: var(--novera-btn-text-hover, #ffffff);
  display: inline-grid;
  padding: 15px 26px;
  border-radius: 30px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.43;
  text-transform: none;
  text-decoration: none !important;
  color: var(--icon-normal) !important;
  fill: var(--icon-normal);
  background-color: transparent;
  background-image:
    var(--novera-btn-gradient, linear-gradient(to right, #82442f 0%, #e9d1a3 100%)),
    var(--novera-btn-gradient-hover, linear-gradient(to right, #e9d1a3 0%, #82442f 100%));
  background-size: 100% 100%, 100% 100%;
  background-position: 0 0, 0 100%;
  background-repeat: no-repeat;
  transition: background-position 0.5s ease, color 0.5s ease, fill 0.5s ease;
}

.novera-map-popup__btn.elementor-button:hover,
.novera-map-popup__btn.elementor-button:focus {
  color: var(--icon-hover) !important;
  fill: var(--icon-hover);
  background-color: transparent;
  background-image:
    var(--novera-btn-gradient, linear-gradient(to right, #82442f 0%, #e9d1a3 100%)),
    var(--novera-btn-gradient-hover, linear-gradient(to right, #e9d1a3 0%, #82442f 100%));
  background-size: 100% 100%, 100% 100%;
  background-position: 0 -100%, 0 0;
}

.novera-map-popup__btn .elementor-button-content-wrapper {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 10px;
}

.novera-map-popup__btn .elementor-button-icon {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  width: 1em;
  height: 1em;
}

.novera-map-popup__btn .elementor-button-icon i {
  font-size: 10px;
}

.novera-map-popup__btn .icon-default,
.novera-map-popup__btn .icon-hover {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.45s ease, opacity 0.45s ease;
}

.novera-map-popup__btn .icon-default {
  color: var(--icon-normal);
  fill: var(--icon-normal);
}

.novera-map-popup__btn .icon-hover {
  position: absolute;
  inset: 0;
  color: var(--icon-hover);
  fill: var(--icon-hover);
  transform: translate(-110%, 110%);
  opacity: 0;
}

.novera-map-popup__btn:hover .icon-default {
  transform: translate(110%, -110%);
  opacity: 0;
}

.novera-map-popup__btn:hover .icon-hover {
  transform: translate(0, 0);
  opacity: 1;
}

@media (max-width: 767px) {
  .novera-map-popup__logo {
    height: 24px;
  }
}
