/* 
 * Veteran Property Network - Map Styles (Zillow-inspired)
 * Modern interactive map with property markers and cards
 */

/* ============================================================================
   MAP CONTAINER LAYOUT
   ============================================================================ */

.map-view-container {
  display: flex;
  height: calc(100vh - 64px); /* Account for nav height */
  position: relative;
  overflow: hidden;
  margin-top: 64px; /* Ensure space for fixed nav */
}

.map-listings-panel {
  width: 45%;
  max-width: 600px;
  min-width: 400px;
  overflow-y: auto;
  background: var(--gray-50);
  border-right: 1px solid var(--gray-200);
  transition: width 0.3s ease;
}

.map-listings-panel.collapsed {
  width: 0;
  min-width: 0;
  opacity: 0;
}

.map-container {
  flex: 1;
  position: relative;
  background: #e5e3df;
}

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

/* ============================================================================
   LISTING CARDS IN SIDEBAR
   ============================================================================ */

.map-listing-card {
  background: white;
  border-radius: 12px;
  margin: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.map-listing-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--vpn-blue-300);
  transform: translateY(-2px);
}

.map-listing-card.active {
  border-color: var(--vpn-blue-600);
  box-shadow: 0 0 0 3px rgba(0, 106, 255, 0.1), var(--shadow-lg);
}

.map-listing-image {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

.map-listing-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.map-listing-card:hover .map-listing-image img {
  transform: scale(1.05);
}

.map-listing-price {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  box-shadow: var(--shadow-md);
}

.map-listing-military {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--vpn-blue-600) 0%, var(--vpn-blue-700) 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.map-listing-assumable {
  position: absolute;
  top: 50px;
  right: 12px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-listing-rate {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(16, 185, 129, 0.95);
  backdrop-filter: blur(10px);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.map-listing-content {
  padding: 16px;
}

.map-listing-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.map-listing-address {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
}

.map-listing-address i {
  margin-right: 6px;
  color: var(--gray-400);
}

.map-listing-details {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--gray-700);
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
}

.map-listing-detail {
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-listing-detail i {
  color: var(--gray-400);
  font-size: 0.75rem;
}

/* ============================================================================
   MAP MARKERS (Custom Leaflet Styling)
   ============================================================================ */

.property-marker {
  background: white;
  border: 2px solid var(--vpn-blue-600);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-900);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.property-marker:hover {
  background: var(--vpn-blue-600);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 106, 255, 0.4);
  z-index: 1000 !important;
}

.property-marker.active {
  background: var(--vpn-blue-600);
  color: white;
  border-color: var(--vpn-blue-700);
  box-shadow: 0 6px 20px rgba(0, 106, 255, 0.5);
  transform: scale(1.15);
  z-index: 1001 !important;
}

.property-marker-icon {
  width: 16px;
  height: 16px;
  font-size: 0.75rem;
}

/* Marker cluster styling */
.marker-cluster {
  background: rgba(0, 106, 255, 0.9);
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.marker-cluster:hover {
  background: var(--vpn-blue-700);
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 106, 255, 0.4);
}

.marker-cluster-small {
  width: 40px;
  height: 40px;
  font-size: 0.875rem;
}

.marker-cluster-medium {
  width: 50px;
  height: 50px;
  font-size: 1rem;
}

.marker-cluster-large {
  width: 60px;
  height: 60px;
  font-size: 1.125rem;
}

/* ============================================================================
   MAP POPUP (Property Card on Map)
   ============================================================================ */

.map-popup {
  font-family: 'Inter', sans-serif;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  padding: 0;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
  width: 280px !important;
}

.map-popup-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
}

.map-popup-content {
  padding: 16px;
}

.map-popup-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.map-popup-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
  line-height: 1.4;
}

.map-popup-address {
  font-size: 0.8125rem;
  color: var(--gray-600);
  margin-bottom: 12px;
}

.map-popup-details {
  display: flex;
  gap: 12px;
  font-size: 0.8125rem;
  color: var(--gray-700);
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
  margin-bottom: 12px;
}

.map-popup-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, var(--vpn-blue-600) 0%, var(--vpn-blue-700) 100%);
  color: white;
  text-align: center;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.map-popup-btn:hover {
  background: linear-gradient(135deg, var(--vpn-blue-700) 0%, var(--vpn-blue-800) 100%);
  box-shadow: 0 4px 12px rgba(0, 106, 255, 0.3);
}

/* ============================================================================
   MAP CONTROLS
   ============================================================================ */

.map-controls {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  gap: 12px;
}

.map-control-btn {
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.map-control-btn.active {
  background: var(--vpn-blue-600);
  color: white;
  border-color: var(--vpn-blue-600);
}

.map-toggle-list {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

/* ============================================================================
   MAP SEARCH BOX
   ============================================================================ */

.map-search-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 90%;
  max-width: 500px;
}

.map-search-box {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 2px solid var(--gray-200);
  transition: border-color 0.2s ease;
}

.map-search-box:focus-within {
  border-color: var(--vpn-blue-500);
  box-shadow: 0 0 0 3px rgba(0, 106, 255, 0.1), var(--shadow-lg);
}

.map-search-input {
  width: 100%;
  padding: 14px 48px 14px 16px;
  border: none;
  font-size: 0.9375rem;
  color: var(--gray-900);
  outline: none;
}

.map-search-input::placeholder {
  color: var(--gray-400);
}

.map-search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

/* ============================================================================
   MAP FILTERS PANEL
   ============================================================================ */

.map-filters {
  padding: 16px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.map-filter-chip {
  padding: 8px 16px;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.map-filter-chip:hover {
  background: var(--gray-200);
  border-color: var(--gray-400);
}

.map-filter-chip.active {
  background: var(--vpn-blue-600);
  color: white;
  border-color: var(--vpn-blue-600);
}

.map-filter-chip i {
  margin-right: 6px;
}

/* ============================================================================
   MAP LOADING STATE
   ============================================================================ */

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 24px 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 16px;
}

.map-loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--vpn-blue-600);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.map-loading-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-700);
}

/* ============================================================================
   RESULTS COUNT
   ============================================================================ */

.map-results-header {
  padding: 16px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-results-count {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-900);
}

.map-results-count span {
  color: var(--vpn-blue-600);
}

.map-sort-select {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--gray-700);
  background: white;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.map-sort-select:focus {
  border-color: var(--vpn-blue-500);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet adjustments */
@media (max-width: 1024px) {
  .map-listings-panel {
    width: 50%;
    min-width: 350px;
  }
}

/* OLD mobile styles removed - now handled by mobile-responsive.css */
/* Mobile styles are now comprehensive in mobile-responsive.css */

/* ============================================================================
   LEAFLET OVERRIDES
   ============================================================================ */

.leaflet-container {
  font-family: 'Inter', sans-serif;
}

.leaflet-popup-tip {
  background: white;
}

.leaflet-popup-close-button {
  width: 24px !important;
  height: 24px !important;
  font-size: 18px !important;
  padding: 0 !important;
  color: var(--gray-500) !important;
  transition: color 0.2s ease;
}

.leaflet-popup-close-button:hover {
  color: var(--gray-900) !important;
}

/* Zoom controls styling */
.leaflet-control-zoom {
  border: 1px solid var(--gray-300) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
  color: var(--gray-700) !important;
  font-size: 1.125rem !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  transition: all 0.2s ease;
}

.leaflet-control-zoom a:hover {
  background: var(--gray-100) !important;
  color: var(--gray-900) !important;
}

/* Attribution */
.leaflet-control-attribution {
  font-size: 0.6875rem !important;
  background: rgba(255, 255, 255, 0.8) !important;
  padding: 4px 8px !important;
  border-radius: 4px;
}
