/* List View Container */
#list-container {
  height: 100vh;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: #f8f9fa;
  padding: 0;
  z-index: 900;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* List view layout */
.list-view-layout {
  height: 100%;
  width: 100%;
}

/* Sidebar now as a direct child of body */
#filter-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  min-width: 260px;
  background-color: #f8f9fa;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e0e0e0;
  transition: transform 0.3s ease-in-out;
  z-index: 950;
}

/* Default collapsed state for desktop */
#filter-sidebar.collapsed {
  transform: translateX(-260px);
}

#filter-sidebar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Sidebar toggle button */
#sidebar-toggle {
  background-color: transparent;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transform: rotate(0deg);
  transition: transform 0.3s ease;
  padding: 0 4px;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#sidebar-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* When sidebar is collapsed, make toggle button visible outside */
#filter-sidebar.collapsed #sidebar-toggle {
  visibility: hidden; /* Hide the toggle button when collapsed */
}

.list-main-content {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin-left: 0; /* Default margin when sidebar is collapsed */
  transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
  width: 100%;
  box-sizing: border-box;
}

/* Adjust main content when sidebar is visible */
body.sidebar-visible .list-main-content {
  margin-left: 260px; /* Match sidebar width */
  width: calc(100% - 260px); /* Adjust width to account for sidebar */
}

/* Ensure list container takes full width */
body.sidebar-visible #list-container {
  width: 100%;
  left: 0;
}

/* Show sidebar in both map and list view */
#filter-sidebar {
  display: flex; /* Always display, visibility controlled by classes */
}

/* Control sidebar visibility with classes */
body.sidebar-collapsed #filter-sidebar {
  transform: translateX(-260px);
}

body.sidebar-visible #filter-sidebar {
  transform: translateX(0);
}

/* List toolbar */
.list-toolbar {
  position: sticky;
  top: 0;
  background-color: #ffffff;
  z-index: 950;
  width: 100%;
  padding: 10px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.properties-count {
  font-size: 16px;
  font-weight: 500;
  color: #555;
  padding-left: 5px;
}

#list-toolbar h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-right: 8px;
}

/* Style toolbar buttons to match filter panel buttons */
#list-toolbar .btn-sm {
  padding: 4px 12px;
  font-size: 13px;
  border-radius: 4px;
}

.list-content {
  flex: 1;
  margin: 0;
  padding: 15px 15px 0;
}

/* Property Cards */
.property-card {
  height: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.property-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

/* Title above the image */
.property-card .card-title {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  line-height: 1.3;
  max-height: 2.6rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.property-card .card-img-top {
  height: 200px;
  object-fit: cover;
  background-color: #f1f3f4;
}

.property-card .card-body {
  padding: 1rem;
  display: flex; /* Enable Flexbox */
  flex-direction: column; /* Stack items vertically */
  flex-grow: 1; /* Allow body to grow */
}

/* Make the content above the button grow to push the button down */
.property-card .card-body > *:not(.btn) {
  flex-grow: 1; /* Allow content elements to grow */
}

/* Ensure the button doesn't grow and stays at the bottom */
.property-card .card-body .btn {
  margin-top: auto; /* Push button to the bottom */
  flex-shrink: 0; /* Prevent button from shrinking */
}

.property-badge {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* Price and location row */
.price-location-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 8px;
}

/* Make price less prominent */
.price-tag {
  font-weight: 500; /* Less bold */
  font-size: 1.1rem; /* Reduced size */
  color: #191c1d;
  margin-bottom: 0; /* Remove bottom margin since it's in flex container */
  flex-shrink: 0; /* Don't let price shrink */
}

/* Slightly smaller features text */
.property-features {
  display: flex;
  gap: 10px;
  margin-top: 8px; /* Adjust spacing */
  color: #666;
  font-size: 0.85rem; /* Reduced size */
}

/* Clickable location styling in price row */
.price-location-row .location-clickable {
  cursor: pointer;
  color: #198754;
  border-radius: 3px;
  padding: 2px 4px;
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 50%;
  min-width: 0;
  font-size: 0.9rem;
}

.price-location-row .location-clickable:hover {
  background-color: rgba(25, 135, 84, 0.1);
  color: #146c43;
}

/* Location text with ellipsis */
.location-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Icon-only location styling */
.price-location-row .location-icon-only {
  max-width: none;
  min-width: auto;
  padding: 4px 6px;
}

/* Slightly smaller description text */
.property-card .card-text {
  font-size: 0.9rem; /* Reduced size */
  line-height: 1.4;
  margin-bottom: 0.5rem; /* Reduced space before realtor info */
}

/* Realtor info styling */
.property-card .realtor-info {
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.property-source {
  font-size: 0.75rem;
  color: #999;
  margin-top: 10px;
}

.property-source a {
  color: #666;
  text-decoration: none;
}

.property-source a:hover {
  text-decoration: underline;
}

/* Load More Spinner */
#load-more-spinner {
  position: relative;
  width: 100%;
  clear: both;
}


/* Map popup overlay */
.map-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

/* Map popup content */
.map-popup {
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Map popup header */
.map-popup-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8f9fa;
}

.map-popup-header h5 {
  margin: 0;
  font-size: 1.1rem;
  color: #333;
}

.map-popup-header .btn-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 8px;
  color: #666;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.map-popup-header .btn-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: #333;
}

.map-popup-header .btn-close:active {
  background-color: rgba(0, 0, 0, 0.2);
}

/* Map popup content area */
.map-popup-content {
  flex: 1;
  display: flex;
  min-height: 350px;
}

/* The actual map container */
.popup-map {
  width: 100%;
  height: 100%;
  min-height: 350px;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .map-popup {
    max-width: 95vw;
    max-height: 70vh;
  }
  
  .map-popup-content {
    min-height: 250px;
  }
  
  .popup-map {
    min-height: 250px;
  }
}

/* Toggle button styling for both map and list view */
.map-view-toggle, .list-view-toggle {
  cursor: pointer;
  padding: 0 4px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
}

.map-view-toggle:hover, .list-view-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
