/* Map View Specifics */
.map-view .map-container {
  position: relative; /* For positioning map controls */
  height: 100%;
}

.map {
  /* The Leaflet map div */
  width: 100%;
  height: 100%;
  background-color: var(--gray-100); /* Background while tiles load */ /* */
}

.map-controls {
  position: absolute;
  top: var(
    --space-4
  ); /* Moved to top-right to avoid conflict with zoom controls */
  right: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 1000; /* Higher z-index to ensure it's above Leaflet controls */
}

.map-control-btn {
  width: 40px;
  height: 40px;
  background: var(--white); /* */
  border: 1px solid var(--gray-300); /* Softer border */ /* */
  border-radius: var(--radius); /* */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow); /* */
  transition: var(--transition); /* */
}

.map-control-btn:hover {
  background: var(--gray-50); /* */
  transform: translateY(-1px);
  box-shadow: var(--shadow-md); /* */
}

.map-control-btn i {
  color: var(--gray-700); /* */
}

/* Enhanced Cluster Styles */
.custom-cluster-icon {
  background: none !important;
  border: none !important;
}

.cluster-marker {
  background: var(--primary); /* */
  color: white;
  border-radius: 50%;
  text-align: center;
  font-weight: bold;
  line-height: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 3px solid white;
  transition: transform 0.2s ease;
}

.cluster-marker:hover {
  transform: scale(1.1);
}

.cluster-small {
  width: 40px;
  height: 40px;
  font-size: 12px;
}

.cluster-medium {
  width: 50px;
  height: 50px;
  font-size: 14px;
  line-height: 44px;
  background: var(--secondary); /* */
}

.cluster-large {
  width: 60px;
  height: 60px;
  font-size: 16px;
  line-height: 54px;
  background: var(--warning); /* */
}

/* Multi-Property Popup Styles (Overall Container) */
.multi-property-popup {
  /* Content div inside Leaflet's structure */
  max-height: 400px;
  overflow-y: auto;
  padding: 0; /* Padding will be on individual cards or header */
  /* border-radius is handled by .multi-property-popup-container .leaflet-popup-content */
}

.property-popup-header {
  /* Header for the list of properties */
  background: var(--primary); /* */
  color: var(--white); /* */
  padding: var(--space-3); /* */
  font-weight: 600;
  text-align: center;
  margin: 0;
  /* border-radius applied to match the main popup container's top */
  border-top-left-radius: var(--radius-lg); /* */
  border-top-right-radius: var(--radius-lg); /* */
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Leaflet specific styling for the multi-property popup container */
.multi-property-popup-container .leaflet-popup-content-wrapper {
  border-radius: var(--radius-lg) !important; /* */
  padding: 0 !important; /* Remove Leaflet's default padding for the wrapper */
  box-shadow: var(--shadow-xl) !important; /* */
  background: transparent !important; /* Wrapper itself is transparent, content div handles background */
}

.multi-property-popup-container .leaflet-popup-content {
  margin: 0 !important;
  border-radius: var(--radius-lg); /* */
  overflow: hidden; /* Important for containing header and scrolling items */
  background-color: var(
    --white
  ); /* Background for the content area if not covered by .multi-property-popup */
}

/* Styles for NEW property cards within a cluster popup */
.multi-property-popup .cluster-property-card {
  display: flex;
  background-color: var(--white); /* */
  border-bottom: 1px solid var(--gray-200); /* */
  padding: var(--space-3); /* */
  cursor: pointer;
  transition: background-color var(--transition); /* */
  align-items: flex-start;
}

.multi-property-popup .cluster-property-card:hover {
  background-color: var(--gray-50); /* */
}

.multi-property-popup .cluster-property-card:last-child {
  border-bottom: none;
  /* Optional: if you want the last card to have bottom rounded corners to match popup */
  /* border-bottom-left-radius: var(--radius-lg); */
  /* border-bottom-right-radius: var(--radius-lg); */
}

.cluster-property-image {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-md); /* */
  margin-right: var(--space-3); /* */
  flex-shrink: 0;
  background-color: var(--gray-100); /* */
}

.cluster-property-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1); /* */
  min-width: 0;
}

.cluster-property-title {
  font-size: var(--font-size-sm); /* */
  font-weight: 600;
  color: var(--gray-900); /* */
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-property-price {
  font-size: var(--font-size-sm); /* */
  font-weight: 700;
  color: var(--primary); /* */
  margin: 0;
}

.cluster-property-info {
  font-size: var(--font-size-xs); /* */
  color: var(--gray-600); /* */
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-property-actions {
  display: flex;
  gap: var(--space-2); /* */
  margin-top: var(--space-2); /* */
}

.cluster-property-actions button {
  padding: var(--space-1) var(--space-2); /* */
  font-size: var(--font-size-xs); /* */
  border-radius: var(--radius); /* */
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition); /* */
  flex: 1;
  text-align: center;
  white-space: nowrap;
}

.cluster-property-actions .cluster-btn-details {
  background-color: var(--primary); /* */
  color: var(--white); /* */
}
.cluster-property-actions .cluster-btn-details:hover {
  background-color: var(--primary-dark); /* */
}

.cluster-property-actions .cluster-btn-select {
  background-color: var(--gray-100); /* */
  color: var(--gray-700); /* */
  border-color: var(--gray-300); /* */
}
.cluster-property-actions .cluster-btn-select:hover {
  background-color: var(--gray-200); /* */
}

/* General Leaflet Popup Custom Styles (for individual marker popups) */
.leaflet-popup-content-wrapper {
  /* Applies to ALL Leaflet popups unless overridden by more specific class like .multi-property-popup-container */
  border-radius: var(--radius-lg) !important; /* */
  box-shadow: var(--shadow-xl) !important; /* */
  border: none !important;
  background-color: var(--white) !important; /* */
}

.leaflet-popup-content {
  /* Applies to ALL Leaflet popups */
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  min-width: 280px !important;
}

.leaflet-popup-close-button {
  padding: var(--space-2) !important; /* */
  font-size: var(--font-size-lg) !important; /* */
  color: var(--gray-600) !important; /* */
  background: rgba(255, 255, 255, 0.9) !important;
  border-radius: 50% !important;
  width: 30px !important;
  height: 30px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  top: 8px !important;
  right: 8px !important;
}
.leaflet-popup-close-button:hover {
  color: var(--gray-900) !important; /* */
  background-color: var(--white) !important; /* */
  transform: scale(1.1) !important;
}

.popup-property {
  /* Container for custom content inside individual marker popups */
}

.popup-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-top-left-radius: var(--radius-lg); /* Match popup wrapper */ /* */
  border-top-right-radius: var(--radius-lg); /* Match popup wrapper */ /* */
  display: block;
}

.popup-content {
  /* Content area below image in individual marker popups */
  padding: var(--space-4); /* */
}

.popup-title {
  font-size: var(--font-size-base); /* */
  font-weight: 600;
  color: var(--gray-900); /* */
  margin-bottom: var(--space-2); /* */
  line-height: 1.3;
}

.popup-price {
  font-size: var(--font-size-lg); /* */
  font-weight: 700;
  color: var(--primary); /* */
  margin-bottom: var(--space-3); /* */
}

.popup-location {
  display: flex;
  align-items: center;
  gap: var(--space-2); /* */
  color: var(--gray-600); /* */
  font-size: var(--font-size-sm); /* */
  margin-bottom: var(--space-3); /* */
}
.popup-location i {
  color: var(--error); /* */
}

.popup-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3); /* */
  margin-bottom: var(--space-4); /* */
  font-size: var(--font-size-sm); /* */
  color: var(--gray-600); /* */
}
.popup-features span {
  display: flex;
  align-items: center;
  gap: var(--space-1); /* */
}
.popup-features i {
  color: var(--gray-400); /* */
}

.popup-actions {
  display: flex;
  gap: var(--space-2); /* */
}

.popup-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3); /* */
  border: none;
  border-radius: var(--radius); /* */
  font-size: var(--font-size-xs); /* */
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition); /* */
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1); /* */
}

.popup-btn-primary {
  background: var(--primary); /* */
  color: var(--white); /* */
}
.popup-btn-primary:hover {
  background: var(--primary-dark); /* */
  transform: translateY(-1px);
}

.popup-btn-secondary {
  background: var(--gray-100); /* */
  color: var(--gray-700); /* */
}
.popup-btn-secondary:hover {
  background: var(--gray-200); /* */
  transform: translateY(-1px);
}

/* Custom Map Marker Styles */
.custom-marker-container {
  background: none !important;
  border: none !important;
}

.custom-marker {
  background: var(--white); /* */
  border: 2px solid var(--primary); /* */
  border-radius: var(--radius-md); /* */
  box-shadow: var(--shadow-md); /* */
  padding: var(--space-1) var(--space-2); /* */
  font-size: var(--font-size-xs); /* */
  text-align: center;
  cursor: pointer;
  transition: var(--transition); /* */
  position: relative;
  white-space: nowrap;
  min-width: 80px;
}

.custom-marker:hover {
  transform: scale(1.05) translateY(-2px);
  z-index: 1000 !important;
  box-shadow: var(--shadow-lg); /* */
}

.custom-marker::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--primary); /* */
}

.marker-price {
  font-weight: 600;
  color: var(--primary); /* */
  margin-bottom: 1px;
  font-size: 0.8rem;
}

.marker-type {
  font-size: 0.65rem;
  color: var(--gray-600); /* */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* User Location Marker */
.user-location-container {
  background: none !important;
  border: none !important;
}

.user-location-marker {
  background: var(--primary); /* */
  color: var(--white); /* */
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg); /* */
  animation: pulse 2s infinite ease-in-out;
}
.user-location-marker i {
  font-size: 12px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* ENHANCED MAP MARKER STYLES - Add this to your map.css */

/* Enhanced Custom Map Marker Styles */
.custom-marker {
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-2);
  font-size: var(--font-size-xs);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-width: 120px;
  backdrop-filter: blur(4px);
}

.custom-marker:hover {
  transform: scale(1.05) translateY(-2px);
  z-index: 1000 !important;
  box-shadow: var(--shadow-xl);
}

.custom-marker::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid;
  border-top-color: inherit;
}

/* Status-based marker styles */
.custom-marker.status-available::after {
  border-top-color: #10b981;
}

.custom-marker.status-rented::after {
  border-top-color: #f59e0b;
}

.custom-marker.status-booked::after {
  border-top-color: #ef4444;
}

.custom-marker.status-occupied::after {
  border-top-color: #8b5cf6;
}

/* Marker content styling */
.marker-status {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.marker-price {
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 1px;
}

.marker-type {
  font-size: 9px;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

/* Enhanced Cluster Styles */
.cluster-marker {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  text-align: center;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 3px solid white;
  transition: transform 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cluster-marker:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.cluster-count {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.cluster-breakdown {
  font-size: 8px;
  font-weight: 500;
  margin-top: 1px;
  opacity: 0.9;
  line-height: 1;
}

/* Multi-property popup enhancements */
.cluster-status-header {
  position: sticky;
  top: 0;
  z-index: 20;
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.cluster-property-card.status-available {
  border-left: 3px solid #10b981;
}

.cluster-property-card.status-rented {
  border-left: 3px solid #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.cluster-property-card.status-booked {
  border-left: 3px solid #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.cluster-property-card.status-occupied {
  border-left: 3px solid #8b5cf6;
  background: linear-gradient(135deg, #f3f4f6 0%, #ffffff 100%);
}

/* Popup enhancements */
.popup-status-info {
  animation: statusSlideIn 0.3s ease;
}

@keyframes statusSlideIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Enhanced popup styling based on status */
.multi-property-popup-container.status-available
  .leaflet-popup-content-wrapper {
  border-top: 4px solid #10b981 !important;
}

.multi-property-popup-container.status-rented .leaflet-popup-content-wrapper {
  border-top: 4px solid #f59e0b !important;
}

.multi-property-popup-container.status-booked .leaflet-popup-content-wrapper {
  border-top: 4px solid #ef4444 !important;
}

/* Map control enhancements */
.map-status-legend {
  position: absolute;
  bottom: var(--space-4);
  left: var(--space-4);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-xs);
  z-index: 1000;
  backdrop-filter: blur(8px);
  max-width: 200px;
}

.map-status-legend-title {
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--gray-900);
  font-size: var(--font-size-sm);
}

.map-status-legend-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.map-status-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--gray-700);
}

.map-status-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.map-status-legend-dot.available {
  background: #10b981;
}

.map-status-legend-dot.rented {
  background: #f59e0b;
}

.map-status-legend-dot.booked {
  background: #ef4444;
}

.map-status-legend-dot.occupied {
  background: #8b5cf6;
}

/* Responsive map enhancements */
@media (max-width: 768px) {
  .custom-marker {
    min-width: 100px;
    padding: var(--space-1);
  }

  .marker-status {
    font-size: 8px;
    padding: 1px 4px;
  }

  .marker-price {
    font-size: 10px;
  }

  .marker-type {
    font-size: 8px;
  }

  .map-status-legend {
    bottom: var(--space-2);
    left: var(--space-2);
    padding: var(--space-2);
    max-width: 160px;
  }

  .cluster-breakdown {
    font-size: 7px;
  }
}

@media (max-width: 480px) {
  .custom-marker {
    min-width: 80px;
    font-size: 9px;
  }

  .map-status-legend {
    font-size: 10px;
  }

  .map-status-legend-dot {
    width: 8px;
    height: 8px;
  }
}

/* Remove old .property-popup-item if it's no longer used */
/* .property-popup-item { ... } */
