.map-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 76px);
}

.map-sidebar {
  padding: 1rem;
  overflow: auto;
  max-height: calc(100vh - 76px);
}

.map-panel {
  position: sticky;
  top: 92px;
}

.map-filter {
  display: grid;
  gap: .75rem;
}

.map-results {
  margin-top: 1rem;
  display: grid;
  gap: .75rem;
}

.map-result {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: .75rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  cursor: pointer;
  transition: .18s ease;
}

.map-result:hover,
.map-result.active {
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(14,165,233,.12);
  transform: translateY(-1px);
}

.map-result-img {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  background: linear-gradient(135deg, #0f172a, #0ea5e9);
  overflow: hidden;
}

.map-result-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-result h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.16;
}

.map-result p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .86rem;
}

.map-canvas-wrap {
  position: relative;
  min-height: calc(100vh - 76px);
  border-left: 1px solid var(--line);
  background: #dbeafe;
}

#mapCanvas {
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
  width: 100%;
  z-index: 1;
}

.map-floating {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.leaflet-popup-content-wrapper {
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(15,23,42,.18);
}

.leaflet-popup-content {
  margin: 0;
  min-width: 250px;
}

.map-popup {
  padding: .85rem;
}

.map-popup-img {
  height: 130px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f172a, #0ea5e9);
  overflow: hidden;
  margin-bottom: .75rem;
}

.map-popup-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-popup h3 {
  margin: 0 0 .35rem;
  font-size: 1.06rem;
  line-height: 1.15;
}

.map-popup p {
  margin: 0;
  color: #64748b;
  font-size: .9rem;
}

.map-popup-actions {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}

/* ============================================================
   Fase 16B - Pins por tipo de comercio
   ============================================================ */

.guia-map-pin {
  position: relative;
  width: 42px;
  height: 52px;
  transform: translate(-50%, -100%);
}

.guia-map-pin__body {
  width: 42px;
  height: 42px;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  display: grid;
  place-items: center;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 12px 24px rgba(15,23,42,.28);
  background: var(--pin-color, #0f172a);
}

.guia-map-pin__icon {
  transform: rotate(45deg);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
}

.guia-map-pin__icon svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: currentColor;
}

.guia-map-pin__shadow {
  position: absolute;
  left: 12px;
  bottom: -1px;
  width: 20px;
  height: 8px;
  background: rgba(15,23,42,.23);
  border-radius: 999px;
  filter: blur(2px);
}

.guia-map-pin.is-selected .guia-map-pin__body,
.guia-map-pin:hover .guia-map-pin__body {
  transform: rotate(-45deg) scale(1.12);
  box-shadow: 0 18px 36px rgba(15,23,42,.36);
}

.map-legend {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .55rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: #475569;
  font-size: .74rem;
  font-weight: 800;
}

.map-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--legend-color, #0f172a);
}

@media (max-width: 980px) {
  .map-layout {
    grid-template-columns: 1fr;
  }

  .map-sidebar {
    max-height: none;
  }

  .map-panel {
    position: relative;
    top: auto;
  }

  .map-canvas-wrap {
    min-height: 70vh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  #mapCanvas {
    position: relative;
    top: auto;
    height: 70vh;
  }

  .map-floating {
    position: static;
    padding: 1rem;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
}
