/* Pagina ricerca su mappa — full screen WOW Immovare */

body.map-page-body {
  margin: 0;
  overflow: hidden;
}

.map-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #f4fafb;
  font-family: Montserrat, sans-serif;
}

.map-page__filters {
  position: relative;
  flex-shrink: 0;
  z-index: 1100;
  isolation: isolate;
}

.map-page .property-search-bar {
  z-index: 1100;
  padding: 10px 16px 12px;
  box-shadow: 0 8px 28px rgba(13, 115, 119, 0.1);
}

.map-page .property-search-mobile-wrap {
  position: relative;
  z-index: 1100;
}

.map-page__body {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.map-page .map-canvas-wrap {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

/* Leaflet: contenitore mappa sotto la barra filtri */
.map-page .leaflet-container {
  z-index: 1 !important;
}

.map-page .suggestions-box {
  z-index: 1200;
}

.map-page .portal-user-dropdown {
  z-index: 1300;
}

.map-page .property-search-flyout {
  z-index: 3000;
}

.map-page .property-search-drawer {
  z-index: 2500;
}

.map-page .property-search-quicklinks {
  display: none;
}

/* Sidebar risultati */
.map-sidebar {
  width: min(420px, 42vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid rgba(46, 93, 99, 0.1);
  box-shadow: 8px 0 32px rgba(13, 115, 119, 0.06);
  position: relative;
  z-index: 100;
}

.map-sidebar__head {
  position: relative;
  padding: 10px 14px;
  background: linear-gradient(135deg, #2e5d63 0%, #3cb4b8 60%, #66d2df 100%);
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.map-sidebar__head:not(.is-collapsed) {
  padding: 14px 16px 16px;
}

.map-sidebar__close-btn {
  display: none;
}
/*
.map-sidebar__head::after {
  content: '';
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(247, 231, 51, 0.22);
}*/

.map-sidebar__head-toggle {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.map-sidebar__head-toggle:hover .map-sidebar__head-chevron,
.map-sidebar__head-toggle:focus-visible .map-sidebar__head-chevron {
  background: rgba(255, 255, 255, 0.3);
}

.map-sidebar__head-chevron {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  position: relative;
  transition: transform 0.2s ease, background 0.15s ease;
}

.map-sidebar__head-chevron::before {
  content: '';
  position: absolute;
  top: 45%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-50%, -60%) rotate(45deg);
}

.map-sidebar__head:not(.is-collapsed) .map-sidebar__head-chevron {
  transform: rotate(180deg);
}

.map-sidebar__head-details {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.map-sidebar__head.is-collapsed .map-sidebar__head-details {
  display: none;
}

.map-sidebar__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.map-sidebar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

.map-sidebar__head:not(.is-collapsed) .map-sidebar__title {
  font-size: 1.35rem;
}

.map-sidebar__subtitle {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.92;
  line-height: 1.45;
  position: relative;
  z-index: 1;
  color: #ffffff !important;
}

.map-sidebar__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}

.map-sidebar__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.map-sidebar__chip:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.map-sidebar__chip--accent {
  background: rgba(236, 232, 25, 0.28);
  border-color: rgba(236, 232, 25, 0.45);
}

.map-sidebar__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  min-height: 0;
}

.map-sidebar__list.is-empty {
  display: none;
}

[data-map-property-card].is-hidden {
  display: none !important;
}

/* Card verticale Compass — sidebar Lista + Mappa */
.map-sidebar__list .property-card--compass {
  display: flex;
  flex-direction: column;
  width: auto;
  margin: 0 12px 12px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid #e8f2f3;
  box-shadow: 0 4px 16px rgba(26, 74, 77, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  background: #fff;
  overflow: hidden;
}

.map-sidebar__list .property-card--compass:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(26, 74, 77, 0.12);
}

.map-sidebar__list .property-card--compass .property-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #eef4f5;
}

.map-sidebar__list .property-card--compass .property-card-image-link {
  display: block;
  width: 100%;
  height: 100%;
}

.map-sidebar__list .property-card--compass .property-card-image-link img,
.map-sidebar__list .property-card--compass .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-sidebar__list .property-card--compass .property-card-swiper {
  width: 100%;
  height: 100%;
}

.map-sidebar__list .property-card--compass .swiper,
.map-sidebar__list .property-card--compass .swiper-wrapper,
.map-sidebar__list .property-card--compass .swiper-slide {
  height: 100%;
}

.map-sidebar__list .property-card--compass .card-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 14px;
  min-width: 0;
}

.map-sidebar__list .property-card--compass .property-card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.map-sidebar__list .property-card--compass .price {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  color: #0d7377;
  margin: 0;
}

.map-sidebar__list .property-card--compass .meta {
  font-size: 13px;
  color: #5a7a7c;
  line-height: 1.35;
}

.map-sidebar__list .property-card--compass .title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-sidebar__list .property-card--compass .title a {
  color: #2e5d63;
  text-decoration: none;
}

.map-sidebar__list .property-card--compass .city {
  font-size: 11.5px;
  color: #7a9699;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.map-sidebar__list .property-card--compass .property-action-favorite {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.map-sidebar__list .property-card--compass.is-hidden {
  display: none !important;
}

/* Legacy horizontal (preferiti/altre viste fuori sidebar mappa) */
.map-sidebar__list .property-card--horizontal {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 12px;
  margin: 0 12px 10px;
  border-radius: 14px;
  border: 1px solid #e8f2f3;
  box-shadow: 0 4px 16px rgba(26, 74, 77, 0.06);
  background: #fff;
}

.map-sidebar__list .property-card--horizontal .property-card-image-link img {
  width: 110px;
  height: 80px;
  border-radius: 10px;
  object-fit: cover;
}

.map-sidebar__empty {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  color: #5a7a7c;
  min-height: 220px;
}

.map-sidebar__empty.is-visible {
  display: flex;
}

.map-sidebar__empty-icon {
  font-size: 2.8rem;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 12px rgba(60, 180, 184, 0.25));
}

.map-sidebar__empty h3 {
  margin: 0 0 8px;
  color: #1a4a4d;
  font-size: 1.1rem;
}

.map-sidebar__empty p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 280px;
}

/* Mappa */
.map-canvas-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #dceef0;
}

.map-canvas-wrap .leaflet-control-draw {
  display: none;
}

/* Pin custom — pillola prezzo */
.map-pin {
  background: transparent !important;
  border: none !important;
}

.map-pin--price {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content !important;
  height: auto !important;
  margin-left: 0 !important;
  margin-top: 0 !important;
  transform: translate(-50%, calc(-100% - 2px));
}

.map-pin__price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  color: #0d7377;
  font-family: Montserrat, sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid #e8f2f3;
  box-shadow: 0 4px 14px rgba(46, 93, 99, 0.28);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.map-pin__tip {
  width: 0;
  height: 0;
  margin-top: -1px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #fff;
  filter: drop-shadow(0 2px 2px rgba(46, 93, 99, 0.18));
}

.map-pin--price.is-active .map-pin__price,
.leaflet-marker-icon.map-pin--price:hover .map-pin__price {
  background: linear-gradient(135deg, #ece819, #f7e733);
  color: #1a2b33;
  border-color: #f2e347;
  transform: translateY(-1px) scale(1.06);
  box-shadow: 0 8px 18px rgba(46, 93, 99, 0.32);
}

.map-pin--price.is-active .map-pin__tip,
.leaflet-marker-icon.map-pin--price:hover .map-pin__tip {
  border-top-color: #f7e733;
}

/* Legacy dot (se ancora usato altrove) */
.map-pin__dot {
  display: block;
  width: 14px;
  height: 14px;
  margin: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3cb4b8, #2e8f96);
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(46, 93, 99, 0.35);
  transition: transform 0.15s ease;
}

.map-pin.is-active .map-pin__dot,
.leaflet-marker-icon:hover .map-pin__dot {
  transform: scale(1.25);
  background: linear-gradient(135deg, #ece819, #f7e733);
  border-color: #fff;
}

/* Selezione card da pin / hover (Lista + Mappa) */
[data-map-property-card].is-pin-hover .property-card--compass,
[data-map-property-card].is-selected .property-card--compass,
[data-listing-card].is-pin-hover .property-card--compass,
[data-listing-card].is-selected .property-card--compass {
  border-color: #3cb4b8;
  box-shadow: 0 8px 24px rgba(60, 180, 184, 0.22);
}

[data-map-property-card].is-selected .property-card--compass,
[data-listing-card].is-selected .property-card--compass {
  outline: 2px solid #3cb4b8;
  outline-offset: 0;
  background: #f7fcfc;
}

/* Overlay disegno */
.map-draw-overlay {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 45, 48, 0.2);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.map-draw-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.map-draw-card {
  pointer-events: auto;
  max-width: 380px;
  width: 100%;
  padding: 28px 26px;
  border-radius: 20px;
  background: linear-gradient(145deg, #fff 0%, #f8fcfc 100%);
  box-shadow: 0 24px 60px rgba(15, 45, 48, 0.2);
  text-align: center;
  animation: mapCardIn 0.4s ease;
}

@keyframes mapCardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.map-draw-card__icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.map-draw-card h3 {
  margin: 0 0 8px;
  color: #1a4a4d;
  font-size: 1.25rem;
  font-weight: 800;
}

.map-draw-card p {
  margin: 0 0 18px;
  color: #5a7a7c;
  font-size: 0.92rem;
  line-height: 1.5;
}

.map-draw-card__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-draw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-draw-btn--primary {
  background: linear-gradient(135deg, #f7e733 0%, #ece819 100%);
  color: #1a4a4d;
  box-shadow: 0 8px 22px rgba(236, 232, 25, 0.35);
}

.map-draw-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(236, 232, 25, 0.45);
}

.map-draw-btn--ghost {
  background: rgba(60, 180, 184, 0.12);
  color: #1a5c62;
  border: 1px solid rgba(60, 180, 184, 0.35);
}

.map-draw-btn--ghost:hover {
  background: rgba(60, 180, 184, 0.2);
}

/* Toolbar mappa */
.map-floating-tools {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 450;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #1a4a4d;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(15, 45, 48, 0.14);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.map-tool-btn:hover {
  transform: translateY(-1px);
}

.map-tool-btn--accent {
  background: linear-gradient(135deg, #3cb4b8, #2e9a9e);
  color: #fff;
}

/* Popup mappa */
.leaflet-popup-content {
  margin: 0;
  width: 240px !important;
}

.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(15, 45, 48, 0.18);
}

/* Popup mappa — gerarchia allineata a card Compass */
.map-card {
  width: 240px;
  font-family: Montserrat, sans-serif;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e8f2f3;
}

.map-card-main {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.map-card-main:hover .map-card-title,
.map-card-main:focus-visible .map-card-title {
  text-decoration: underline;
}

.map-card-main:focus-visible {
  outline: 2px solid #0d7377;
  outline-offset: -2px;
}

.map-card-image {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #eef4f5;
}

.map-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-card-body {
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-card-price {
  font-weight: 800;
  font-size: 20px;
  line-height: 1.2;
  color: #0d7377;
}

.map-card-meta {
  font-size: 13px;
  color: #5a7a7c;
  line-height: 1.35;
}

.map-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #2e5d63;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-card-city {
  font-size: 11.5px;
  color: #7a9699;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.map-card-actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
  margin-top: 0;
}

.map-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #eee;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
}

.map-btn svg {
  width: 18px;
  height: 18px;
  fill: #333;
}

.map-btn.wa {
  background: #25d366;
  border: none;
}

.map-btn.wa svg {
  fill: #fff;
}

.map-btn.call {
  background: #f5f5f5;
}

/* Area disegnata */
.leaflet-interactive {
  stroke: #3cb4b8 !important;
  stroke-width: 3 !important;
  fill: rgba(60, 180, 184, 0.18) !important;
}

/* Mobile: lista fullscreen nell'area contenuto, mappa absolute slide-in dal lato */
@media (max-width: 900px) {
  .property-search-toolbar__nav {
    display: none;
  }

  .property-search-toolbar .portal-user-name {
    display: none;
  }

  .map-page__body,
  .search-list-page .layout {
    flex: 1;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: 0;
  }

  .map-page__body .map-sidebar,
  .search-list-page .layout .map-sidebar {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    max-height: none;
    transform: none;
    z-index: 1;
    box-shadow: none;
  }

  .map-canvas-wrap {
    position: absolute !important;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    transform: translateX(100%);
    transition: transform 0.28s ease;
    background: #dceef0;
    pointer-events: none;
  }

  .map-page__body.is-map-open .map-canvas-wrap,
  .search-list-page .layout.is-map-open .map-canvas-wrap {
    transform: translateX(0);
    pointer-events: auto;
  }

  .map-canvas-wrap #map,
  .map-canvas-wrap .map-dx,
  .map-canvas-wrap .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
  }

  .map-sidebar-backdrop {
    display: none !important;
  }

  .map-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    width: 42px;
    height: 54px;
    padding: 0;
    border: none;
    border-radius: 16px 0 0 16px;
    background: linear-gradient(135deg, #3cb4b8, #2e9a9e);
    color: #fff;
    box-shadow: -4px 0 18px rgba(13, 115, 119, 0.35);
    cursor: pointer;
  }

  .map-sidebar-toggle__icon {
    font-size: 1.2rem;
    line-height: 1;
    font-weight: 700;
  }

  .map-sidebar-toggle__icon--close {
    display: none;
    font-size: 1.6rem;
    margin-left: 2px;
  }

  .map-page__body.is-map-open .map-sidebar-toggle__icon--open,
  .search-list-page .layout.is-map-open .map-sidebar-toggle__icon--open {
    display: none;
  }

  .map-page__body.is-map-open .map-sidebar-toggle__icon--close,
  .search-list-page .layout.is-map-open .map-sidebar-toggle__icon--close {
    display: block;
  }

  .map-floating-tools {
    top: auto;
    bottom: 16px;
    right: 12px;
    left: 12px;
    flex-direction: row;
    flex-wrap: wrap;
    z-index: 10;
  }

  .map-tool-btn {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    padding: 0 12px;
  }
}

@media (min-width: 901px) {
  .map-sidebar-toggle,
  .map-sidebar-backdrop {
    display: none !important;
  }
}

/* Modalità classica */
body.theme-classic .map-sidebar__head {
  background: #1f2937;
}

body.theme-classic .map-sidebar__chip--accent {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

body.theme-classic .map-sidebar-toggle {
  background: #374151;
}
