/* ==========================================================================
   AMOR D+ | MAPA REAL COM GOOGLE MAPS (ESTILOS LEAFLET & PINS)
   Pins personalizados, popups, animações de pulso e gaveta lateral
   ========================================================================== */

.map-view-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: calc(100vh - var(--topbar-height) - 4rem);
  min-height: 620px;
  position: relative;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: white;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  z-index: 20;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.legend-dot.green {
  background-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.legend-dot.orange {
  background-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.legend-dot.purple {
  background-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

/* Leaflet Real Map Canvas */
.map-canvas-card {
  flex: 1;
  background: #e2e8f0;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  z-index: 10;
  min-height: 520px;
}

#map-canvas-container {
  width: 100%;
  height: 100%;
}

/* Custom Marker Styling */
.custom-leaflet-marker {
  background: transparent !important;
  border: none !important;
}

.marker-container {
  position: relative;
  width: 44px;
  height: 52px;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.marker-container:hover {
  transform: scale(1.18) translateY(-4px);
  z-index: 1000 !important;
}

.marker-pin-body {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: white;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: var(--font-display);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
  border: 2.5px solid #ffffff;
  position: relative;
  z-index: 2;
}

.marker-pointer {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  margin-top: -3px;
  z-index: 1;
}

/* Color Themes */
.marker-container.pin-green .marker-pin-body {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}
.marker-container.pin-green .marker-pointer {
  border-top: 10px solid #10b981;
}

.marker-container.pin-orange .marker-pin-body {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}
.marker-container.pin-orange .marker-pointer {
  border-top: 10px solid #f59e0b;
}

.marker-container.pin-purple .marker-pin-body {
  background: linear-gradient(135deg, #7e22ce 0%, #a855f7 100%);
}
.marker-container.pin-purple .marker-pointer {
  border-top: 10px solid #a855f7;
}

.marker-container.pin-gray .marker-pin-body {
  background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
}
.marker-container.pin-gray .marker-pointer {
  border-top: 10px solid #94a3b8;
}
/* Localização aproximada (sem link exato do Google Maps no cadastro) */
.marker-container.pin-approx { opacity: 0.6; }

/* Pulse Halo for Open Beds */
.pin-pulse-halo {
  position: absolute;
  top: -4px;
  left: -2px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  animation: marker-pulse 2.2s infinite ease-out;
  pointer-events: none;
  z-index: 0;
}

.pin-pulse-halo.pin-green {
  background: rgba(16, 185, 129, 0.45);
}
.pin-pulse-halo.pin-orange {
  background: rgba(245, 158, 11, 0.45);
}
.pin-pulse-halo.pin-purple {
  background: rgba(168, 85, 247, 0.45);
}

@keyframes marker-pulse {
  0% { transform: scale(0.8); opacity: 0.9; }
  60% { transform: scale(1.65); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
  border: 1px solid var(--border-subtle) !important;
  overflow: hidden !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}

.map-popup-card {
  width: 270px;
  background: white;
}

.popup-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.popup-body {
  padding: 0.9rem 1rem;
}

.popup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-900);
  margin-bottom: 0.2rem;
  line-height: 1.25;
}

.popup-address {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.4rem;
}

.popup-price {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--primary-900);
  margin-bottom: 0.75rem;
}

.popup-actions {
  display: flex;
  gap: 0.4rem;
}

.popup-details-btn {
  flex: 1;
}

.popup-gmaps-btn {
  color: #0284c7;
  font-weight: 600;
}

/* Map Side Panel Drawer */
.map-side-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  background: white;
  border-left: 1px solid var(--border-subtle);
  box-shadow: -6px 0 25px rgba(15, 23, 42, 0.12);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.map-side-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.drawer-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-muted);
  display: flex;
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .map-side-drawer {
    width: 100%;
  }
}

/* Ficha da casa aberta direto no Catálogo (painel lateral fixo) */
.catalog-side-drawer {
  position: fixed;
  z-index: 2000;
  width: 440px;
  max-width: 100vw;
}
.catalog-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.catalog-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
@media (max-width: 768px) {
  .catalog-side-drawer { width: 100%; }
}
