/* Listing Page Specific Styles */

/* Full-width layout */
.listing-page {
  overflow: hidden;
}

.listing-page .site_header {
  width: 100%;
  max-width: 100%;
}

.listing-page .site_header .container {
  max-width: 100%;
  padding: 0 20px;
}

.listing-main {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--menuHeight));
  overflow: hidden;
}

/* Filter Bar */
.listing-filters {
  background: #fff;
  border-bottom: 1px solid var(--lightBorder);
  padding: 12px 20px;
  flex-shrink: 0;
}

.listing-filters-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.location-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8f9fa;
  border: 1px solid var(--lightBorder);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 250px;
}

.location-search img {
  width: 20px;
  height: 20px;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.2s;
}

.location-search img:hover {
  opacity: 0.8;
}

.location-input {
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--default);
  width: 100%;
  font-family: var(--primaryfont);
}

.location-input:focus {
  outline: none;
}

.location-input::placeholder {
  color: var(--muted);
}

.filter-info {
  display: flex;
  flex-direction: column;
}

.filter-info strong {
  font-size: 16px;
  color: var(--default);
}

.filter-info span {
  font-size: 13px;
  color: var(--muted);
}

.filter-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select {
  position: relative;
  min-width: 120px;
}

.filter-select select {
  appearance: none;
  background: #f8f9fa;
  border: 1px solid var(--lightBorder);
  border-radius: 8px;
  padding: 8px 32px 8px 12px;
  font-size: 14px;
  color: var(--default);
  cursor: pointer;
  width: 100%;
  font-family: var(--primaryfont);
}

.filter-select::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--muted);
  pointer-events: none;
}

.filter-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f8f9fa;
  border: 1px solid var(--lightBorder);
  border-radius: 8px;
  font-size: 14px;
  color: var(--default);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: var(--lightBorder);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.filter-btn img {
  width: 18px;
  height: 18px;
}

/* Main Content Area */
.listing-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Property List Side */
.listing-properties {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #fff;
}

/* Responsive Grid */
.property-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 1400px) {
  .property-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .property-grid {
    grid-template-columns: 1fr;
  }
}

/* Property Card in Listing Grid */
.property-grid .site_card.v2 {
  position: relative;
}

.property-grid .site_card.v2.highlighted {
  box-shadow: 0 0 0 3px var(--accent);
}

.property-grid .site_card.v2 .card_img_wrap {
  height: 18rem;
}

.property-grid .site_card.v2 .card_img {
  height: 18rem;
}

.property-grid .site_card.v2 .card_info {
  min-height: auto;
  padding: 1.5rem 2rem 2rem 2rem;
}

/* Card Badge */
.card_badge {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 1rem;
  border-radius: 0.6rem;
  font-size: 1.2rem;
  font-weight: 600;
  z-index: 1;
}

/* Pagination */
.listing-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pagination-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background: #f8f9fa;
  border: 1px solid var(--lightBorder);
  border-radius: 8px;
  font-size: 14px;
  color: var(--default);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.pagination-btn:hover {
  background: var(--lightBorder);
}

.pagination-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination-btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.pagination-info {
  font-size: 14px;
  color: var(--muted);
  margin: 0 16px;
}

/* Map Side */
.listing-map {
  width: 50%;
  min-width: 400px;
  position: relative;
  background: #e5e5e5;
}

.listing-map.hidden {
  display: none;
}

.listing-map.hidden + .listing-properties {
  width: 100%;
}

#propertyMap {
  width: 100%;
  height: 100%;
}

/* Map Popup */
.map-popup {
  min-width: 250px;
}

.map-popup-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}

.map-popup-content {
  padding: 12px;
}

.map-popup-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--default);
  margin-bottom: 4px;
}

.map-popup-title {
  font-size: 13px;
  color: var(--default);
  margin-bottom: 4px;
}

.map-popup-specs {
  font-size: 12px;
  color: var(--muted);
}

/* Map Marker */
.property-marker {
  background: var(--accent);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Manrope', sans-serif;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.property-marker:hover,
.property-marker.active {
  background: var(--accentDark);
  transform: scale(1.1);
  z-index: 1000 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Loading State */
.listing-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
}

.listing-loading img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* No Results */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.no-results h3 {
  font-size: 20px;
  color: var(--default);
  margin-bottom: 8px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .listing-map {
    display: none;
  }

  .listing-map.mobile-visible {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
  }

  .listing-filters-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-center {
    order: 3;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .filter-right {
    order: 2;
  }

  .listing-properties {
    padding: 12px;
  }

  .property-grid {
    gap: 12px;
  }
}

/* Leaflet Overrides */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0;
  min-width: 200px;
}

.leaflet-popup-content a {
  text-decoration: none;
  color: inherit;
}

.leaflet-popup-close-button {
  top: 8px !important;
  right: 8px !important;
  color: #fff !important;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Marker Cluster Styles */
.marker-cluster {
  background: transparent;
}

.cluster-marker {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Manrope', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 3px solid #fff;
}

.cluster-marker.cluster-small {
  width: 36px;
  height: 36px;
  font-size: 11px;
}

.cluster-marker.cluster-medium {
  width: 44px;
  height: 44px;
  font-size: 12px;
}

.cluster-marker.cluster-large {
  width: 52px;
  height: 52px;
  font-size: 13px;
}

/* Page marker highlighting */
.property-marker.page-marker {
  z-index: 500 !important;
}

.property-marker.page-marker.active {
  z-index: 1000 !important;
}
