/* Vista mappa: pin solo se latitude e longitude sono compilate. */

body.ts-map .ts-hero-lead {
  max-width: 36em;
}

.ts-map-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 20px 28px;
}

.ts-map-stage {
  position: relative;
  z-index: 0;
  isolation: isolate;
  height: min(62dvh, 640px);
  min-height: 320px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--ts-line);
  background: #e8e4f4;
}

body.ts-map .ts-bottom {
  z-index: 1200;
}

.ts-map-canvas,
.ts-map-stage .leaflet-container {
  width: 100%;
  height: 100%;
  background: #e8e4f4;
  font-family: var(--ts-font-body);
  touch-action: pan-x pan-y;
}

.ts-map-gesture {
  position: absolute;
  z-index: 500;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  max-width: calc(100% - 132px);
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(27, 21, 48, 0.82);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
}

.ts-map-gesture.is-emphasis {
  background: var(--ts-violet);
}

.ts-user-icon {
  background: transparent;
  border: 0;
}

.ts-user-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3F2FB8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(90, 72, 219, 0.28);
}

.ts-map-note {
  position: absolute;
  z-index: 500;
  left: 12px;
  right: 12px;
  bottom: 28px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ts-ink);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(27, 21, 48, 0.12);
}

.ts-map-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  max-height: 280px;
  overflow: auto;
}

.ts-map-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--ts-line);
  border-radius: 16px;
  background: #fff;
  color: var(--ts-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ts-map-card strong {
  font-family: var(--ts-font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.ts-map-card span,
.ts-map-empty {
  color: var(--ts-muted);
  font-size: 13px;
  line-height: 1.4;
}

.ts-map-empty {
  margin: 0;
}

.ts-pin-icon {
  background: transparent;
  border: 0;
}

.ts-pin-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--ts-violet);
  border: 2px solid #fff;
  box-shadow: 0 8px 16px rgba(27, 21, 48, 0.28);
}

.ts-pin-dot span {
  transform: rotate(45deg);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
}

.ts-map-popup {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ts-map-popup li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
}

.ts-map-popup li + li {
  border-top: 1px solid var(--ts-line);
}

.ts-map-popup button {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-weight: 700;
  color: var(--ts-violet-strong);
  cursor: pointer;
}

.ts-map-popup span {
  color: var(--ts-muted);
  font-size: 12px;
}

@media (min-width: 992px) {
  body.ts-map .ts-hero {
    display: block;
    padding: 28px 64px 12px;
  }

  body.ts-map.site-shell .ts-hero h1 {
    font-size: 48px;
    margin-bottom: 8px;
  }

  .ts-map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: stretch;
    padding: 8px 64px 40px;
  }

  .ts-map-stage,
  .ts-map-list {
    height: calc(100dvh - 280px);
    min-height: 560px;
    max-height: none;
  }
}
