/* ================================
   CSS: LIVE LISTINGS PAGE
   ================================ */

/* =============================
   LISTING TILE MARKET INDICATOR
   ============================= */
.listing-tile-market-indicator {
    margin-top: 6px;
    font-size: 0.85em;
    line-height: 1.3;
}

.market-estimate {
    font-weight: 600;
    color: #666;
    margin-bottom: 2px;
}

.market-status {
    font-weight: 700;
    font-size: 0.9em;
    padding: 4px 9px;
    border-radius: 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1.5px solid;
    background: white;
    display: inline-block;
    margin-left: -9px;
    margin-top: 5px;
}

.market-status.good-deal.green {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.market-status.comparable.yellow {
    color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.market-status.overvalued.red {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
}

/* =============================
   SAVE LISTING FUNCTIONALITY
   ============================= */

/* Ensure info container has relative positioning for absolute save button */
.info {
    position: relative !important;
}

/* Save listing wrapper positioning - unified for all contexts */
.save-listing-wrapper {
    position: absolute !important;
    top: 12px !important;
    right: 9px !important;
    bottom: auto !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
}

/* Save listing button styling - round clickable button */
.save-listing-wrapper .save-listing-btn {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    outline: none !important;
}

/* Save button hover state */
.save-listing-wrapper .save-listing-btn:hover {
    background: rgba(255, 255, 255, 1) !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Save button when listing is saved - no background change, just icon color */
.save-listing-wrapper .save-listing-btn.saved,
.save-listing-wrapper .save-listing-btn.favorited {
    background: rgba(255, 255, 255, 0.95) !important;
    border: none !important;
}

/* Hide text in save button (icon only) */
.save-listing-wrapper .save-text {
    display: none !important;
}

/* Save icon styling - light blue outline heart */
.save-listing-wrapper .save-icon {
    font-size: 20px !important;
    color: #D3E7F4 !important;
    line-height: 1 !important;
}

/* Save icon when listing is saved - red filled heart */
.save-listing-wrapper .save-listing-btn.saved .save-icon,
.save-listing-wrapper .save-listing-btn.favorited .save-icon {
    color: #ff4444 !important;
}

/* Save notification positioning and styling */
.save-notification {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    color: white !important;
    font-weight: 600 !important;
    z-index: 99999 !important;
    display: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 14px !important;
}

/* Notification variants */
.save-notification.success {
    background: #28a745 !important;
}

.save-notification.error {
    background: #dc3545 !important;
}

.save-notification.info {
    background: #17a2b8 !important;
}

/* EMERGENCY OVERRIDE - Highest specificity to override any remaining conflicts */
body .listing-card .info .save-listing-wrapper,
body .grid-item .save-listing-wrapper,
body .carousel .save-listing-wrapper,
body .save-listing-wrapper {
    position: absolute !important;
    top: 12px !important;
    right: 9px !important;
    bottom: auto !important;
    z-index: 1111 !important;
    pointer-events: auto !important;
}

body .listing-card .info .save-listing-wrapper .save-listing-btn,
body .grid-item .save-listing-wrapper .save-listing-btn,
body .carousel .save-listing-wrapper .save-listing-btn,
body .save-listing-wrapper .save-listing-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Compact version for smaller tiles */
.listing-tile-market-indicator.compact {
    margin-top: 4px;
    font-size: 0.75em;
}

.listing-tile-market-indicator.compact .market-estimate {
    font-size: 0.9em;
}

.listing-tile-market-indicator.compact .market-status {
    font-size: 0.8em;
    padding: 2px 6px;
}

/* Mobile responsive for market indicators */
@media (max-width: 768px) {
    .listing-tile-market-indicator {
        font-size: 0.8em;
        margin-top: 4px;
    }
    
    .market-estimate {
        font-size: 0.85em;
    }
    
    .market-status {
        font-size: 0.8em;
        padding: 2px 6px;
    }
}

/* === RESET & GLOBAL === */
html, body, #page, #content {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* === FILTER FORM === */
.filter-form-wrapper, .filter-form-wrapper-2 {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #fff;
  padding: 1rem;
  border-bottom: 1px solid #ddd;
  box-shadow: 0 3px 9px -3px rgba(0,0,0,0.65);
  margin-bottom: 0;
}

.filter-form, .filter-form-2 {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-form input, .filter-form select,
.filter-form-2 input, .filter-form-2 select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.field-25 { flex: 1 1 22%; min-width: 120px; }
.field-50 { flex: 1 1 48%; min-width: 200px; }
.field-100 { flex: 1 1 100%; }

/* Mobile-first responsive adjustments for small screens */
@media (max-width: 400px) {
  .field-25, .field-50 { 
    flex: 1 1 100%; 
    min-width: unset;
  }
}

.input-wrapper {
  position: relative;
}

.input-wrapper .prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none;
}

.input-wrapper input {
  padding-left: 24px !important;
}

/* === FILTER BUTTONS === */
.filter-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-actions {
  margin-bottom: 0 !important;
}

.filter-actions button,
.filter-actions .reset-btn {
  padding: 0.5rem 1rem;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.filter-actions .reset-btn {
  background: #777;
}

.filter-actions button:hover,
.filter-actions .reset-btn:hover {
  background: #333;
}

.submit-btn {
  width: 100%;
  padding: 12px 16px;
  background-color: #0073e6;
  color: #fff;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.submit-btn:hover {
  background-color: #005bb5;
}

.submit-btn.loading {
  opacity: 0.6;
  pointer-events: none;
  background-color: #999;
}

/* === LAYOUT === */
.content, .content-2 {
  display: flex;
  align-items: stretch;
  padding: 0;
  flex-wrap: nowrap;
  height: 100vh;
  overflow: hidden;
}

.content.stacked-layout {
  flex-direction: column;
  height: auto;
}

.content.stacked-layout .listing-column {
  height: auto;
  max-height: 70vh;
}

.content.stacked-layout .map-column {
  height: 50vh;
  flex: none;
}

/* === LISTING GRID & CARD - HOMEPAGE STYLE === */
.listing-grid, .listing-grid-2 {
  flex: 1 1 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  align-content: start;
  padding: 24px;
}

.listing-grid.shortcode-grid {
  /* Use exact same grid layout as live listing page */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 24px;
  align-content: start;
  flex: 1 1 100%;
  width: 100%;
}

.listing-grid.live-page-grid, #ip-listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 24px;
  align-content: start;
  flex: 1 1 100%;
  width: 100%;
}

/* IP Listing Grid - Match main listing grid exactly */
#ip-listing-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 24px !important;
  padding: 24px !important;
  background: none !important;
  align-content: start;
  flex: 1 1 100% !important;
  width: 100% !important;
}

/* Override any base .elementor-grid styles that might interfere */
.elementor-grid {
  display: grid !important;
  grid-template-columns: unset !important;
  grid-column-gap: unset !important;
  grid-row-gap: unset !important;
  gap: unset !important;
}

/* Ensure Elementor grid containers match the main listing grid styling exactly */
.elementor-posts-container.elementor-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: 24px !important;
  padding: 24px !important;
  flex: 1;
  height: auto;
  align-content: start;
  background: none !important;
}

/* New Homepage-Style Listing Cards */
.listing-card, .listing-card-2, .featured-listing-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
  position: relative;
}

.listing-card:hover, .listing-card-2:hover, .featured-listing-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border-color: #e0e0e0;
}

/* Property Type Badge */
.listing-card:not(.similar-listing-card)::before {
  content: attr(data-property-type);
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  color: #333;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 20px;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Listing Date Badge */
.listing-card::after {
  content: attr(data-listing-date);
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 15px;
  z-index: 5;
}

/* Image/Carousel Area */
.listing-card .carousel, .listing-card-2 .carousel {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: #f8f9fa;
}

.listing-card .carousel img, .listing-card-2 .carousel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

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

/* Info Section - Homepage Style Layout */
.listing-card .info, .listing-card-2 .info-2 {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

/* Price - Large and Bold */
.listing-card .info > p:first-of-type {
  font-family: "Poppins", Sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 6px 0;
}

/* Bed/Bath Info */
.listing-card .info > p:nth-of-type(2) {
  font-size: 13px;
  color: #666;
  margin: 6px 0;
}

/* Address */
.listing-card .info h4 {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin: 6px 0;
  line-height: 1.3;
}

/* Property Type and Location */
.listing-card .info > p:nth-of-type(3) {
  font-size: 12px;
  color: #999;
  margin: 6px 0;
  font-weight: 400;
}

/* MLS Info and Brokerage - consistent small text */
.listing-card .info > p:last-of-type {
  font-size: 12px;
  color: #999;
  margin: 6px 0;
  font-weight: 400;
}

/* Action Buttons */
.listing-card .actions, .listing-card-2 .actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.listing-card .actions .listing-action-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: #204B61;
  color: white;
  border-radius: 0;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
  height: 40px;
  line-height: 20px;
  box-sizing: border-box;
}

.listing-card .actions .listing-action-btn:hover {
  background: #163547;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(32, 75, 97, 0.3);
}

/* === SOLD LISTING STYLES === */
.listing-card.sold-listing, .listing-card-2.sold-listing {
  opacity: 0.85;
  border-color: #dc3545;
  background: #fafafa;
}

.listing-card.sold-listing:hover, .listing-card-2.sold-listing:hover {
  transform: translateY(-4px); /* Less dramatic hover effect for sold properties */
  opacity: 0.95;
}

/* Sold badge styling */
.sold-badge {
  background-color: rgba(220, 53, 69, 0.9) !important;
  color: white !important;
  font-weight: bold !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Additional desaturation for sold listing images in carousels */
.sold-listing .carousel img {
  filter: grayscale(100%) contrast(0.8) brightness(0.9);
  transition: filter 0.3s ease;
}

.sold-listing:hover .carousel img {
  filter: grayscale(80%) contrast(0.9) brightness(1);
}

.no-listings {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 40px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 20px;
  color: #666;
  border: 2px dashed #dee2e6;
}

.no-listings h3 {
  margin: 0 0 16px 0;
  color: #333;
  font-size: 24px;
  font-weight: 600;
}

.no-listings a {
  color: #0073e6;
  text-decoration: none;
  font-weight: 600;
  background: linear-gradient(135deg, #0073e6, #005bb5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.listing-column {
  flex: 1 1 100%;
  width: 100%;
  height: 100vh;
  overflow-y: auto;
  background: #fff;
  scroll-behavior: smooth;
}

/* Custom scrollbar for webkit browsers */
.listing-column::-webkit-scrollbar {
  width: 8px;
}

.listing-column::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.listing-column::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.listing-column::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* === Map Pin === */

.map-popup { width: 300px; font-family: inherit; }
.popup-carousel { position: relative; width: 100%; height: 170px; display: flex; align-items: center; justify-content: center; background: #f8f8f8; border-radius: 6px; overflow: hidden; }
.popup-carousel img.popup-img { width: 100%; height: 170px; object-fit: cover; border-radius: 6px; }
.popup-prev, .popup-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(30,30,30,0.6); color: #fff; border: none; font-size: 1.3rem; padding: 8px 14px; cursor: pointer; border-radius: 3px; z-index: 2; }
.popup-prev { left: 10px; }
.popup-next { right: 10px; }
.popup-price { font-size: 1.15rem; font-weight: bold; color: #007cba; margin-bottom: 2px; }
.popup-details { font-size: 0.98rem; color: #444; }

.doma-popup {
  width: 310px;
  font-family: "Roboto", Arial, sans-serif;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.14);
  padding: 15px 15px 10px 15px;
}
.doma-price {
  background: #006AFF;
  color: #fff;
  font-weight: 600;
  font-size: 1.2rem;
  border-radius: 6px;
  padding: 7px 14px;
  margin-bottom: 10px;
  display: inline-block;
}
.doma-carousel {
  position: relative;
  height: 160px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.doma-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 7px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.doma-prev, .doma-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,106,255,0.85);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 3px;
  z-index: 2;
}
.doma-prev { left: 5px; }
.doma-next { right: 5px; }
.doma-details {
  font-size: 1rem;
  color: #333;
  margin-top: 4px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.doma-address {
  font-size: 0.96em;
  color: #666;
  margin-top: 6px;
}
.marker-cluster {
  background: #006AFF !important;
  color: #fff !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.marker-cluster span {
  font-weight: 600;
  font-size: 1.08em;
}

/* === CAROUSEL === */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  display: block;
  margin: auto;
}


#lightbox .close, #lightbox .prev, #lightbox .next {
  position: absolute;
  z-index: 100;
  background: rgba(30,30,30,0.80);
  color: #fff;
  border: none;
  font-size: 2em;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.96;
  box-shadow: 0 3px 16px rgba(0,0,0,0.18);
  transition: background 0.2s, color 0.2s;
}

/* Overlay left/right on image Y-centered, close top-right */
 #lightbox .prev { left: 36px; top: 50%; transform: translateY(-50%); }
#lightbox .next { right: 36px; top: 50%; transform: translateY(-50%); }
#lightbox .close { top: 144px; right: 36px; }


#lightbox .prev:hover, #lightbox .next:hover, #lightbox .close:hover {
  background: #0073e6;
  color: #fff;
  opacity: 1;
}

/* Make sure the overlay parent is positioned */
#lightbox {
  position: fixed;
}

/* === CAROUSEL BUTTONS OVER IMAGE === */
.carousel {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.carousel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel .prev-btn, .carousel .next-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(30,30,30,0.80);
  color: #fff;
  border: none;
  font-size: 2em;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0.95;
  box-shadow: 0 2px 8px rgba(0,0,0,0.13);
  transition: background 0.2s, color 0.2s;
}

.carousel .prev-btn { left: 12px; }
.carousel .next-btn { right: 12px; }

.carousel .prev-btn:hover, .carousel .next-btn:hover {
  background: #0073e6;
  color: #fff;
  opacity: 1;
}

/* For popup-tile image wrap (map card popups) */
.popup-tile-img-wrap {
  position: relative;
}
.popup-tile-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(30,30,30,0.80);
  color: #7dd3fc;
  border: none;
  font-size: 1.5em;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10;
  opacity: 0.95;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-tile-btn-prev { left: 9px; }
.popup-tile-btn-next { right: 9px; }
.popup-tile-btn:hover {
  background: #0073e6;
  color: #fff;
  opacity: 1;
}

/* === DOM Badge & Buttons === */
.dom-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: bold;
  box-shadow: 0 1px 5px rgba(0,0,0,0.2);
  z-index: 5;
}

.top-buttons {
  position: absolute;
  bottom: 9px;
  right: 9px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.top-buttons button {
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  border-radius: 50%;
  padding: 4px 6px;
  font-size: 15px;
}

/* Lightbox styles are defined earlier in the file */



/* === QUICK VIEW MODAL === */
.quick-view-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.quick-view-modal .modal-inner {
  background: #fff;
  padding: 2rem;
  border-radius: 10px;
  max-width: 1200px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.quick-view-modal .close-modal {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2rem;
  background: none;
  border: none;
  color: #333;
  cursor: pointer;
}

/* === MAP AREA === */
.map-column {
  flex: 0 0 40%;
  height: 100vh;
  pointer-events: auto;
  position: relative;
  overflow-y: scroll;
}

/* Map inside template uses 100% height of parent container */
.map-column #map {
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border: none;
  height: 100% !important;
  width: 100% !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
  touch-action: pan-x pan-y !important;
  cursor: grab;
}

/* Map shortcode in Elementor - fill available space */
.repliers-map-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 800px;
  height: 100vh;
  max-height: 100vh;
}

.repliers-map-wrapper #map {
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border: none;
  flex: 1;
  height: 100% !important;
  width: 100% !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
  touch-action: pan-x pan-y !important;
  cursor: grab;
}

.map-column #map:active,
.repliers-map-wrapper #map:active {
  cursor: grabbing;
}

/* Ensure all Leaflet elements can receive pointer events */
.map-column #map *,
.repliers-map-wrapper #map * {
  pointer-events: auto !important;
}

/* Specifically ensure the map pane is interactive */
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-interactive {
  pointer-events: auto !important;
  touch-action: pan-x pan-y !important;
}
.leaflet-control-attribution {
  font-size: 11px;
  color: #888 !important;
  background: rgba(255,255,255,0.8) !important;
  border-radius: 6px;
}
.leaflet-control-zoom {
  background: rgba(245,245,245,0.95) !important;
  border-radius: 6px;
  box-shadow: none !important;
}

/* === PAGINATION === */
.pagination {
  margin-top: 24px;
  text-align: center;
  padding: 0 20px 20px 20px;
}

.pagination ul {
  display: inline-flex;
  gap: 8px;
  list-style: none;
  padding: 0;
}

.pagination li a, .pagination li span {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  color: #333;
}

.pagination li .current {
  background: #0073e6;
  color: #fff;
  border-color: #0073e6;
}

.pagination li a:hover {
  background: #f0f0f0;
}

/* === POPUP === */
.map-popup {
  max-width: 220px;
}

.popup-img {
  width: 100%;
  height: auto;
  margin-bottom: 6px;
  border-radius: 8px;
}

.popup-info {
  font-size: 13px;
  line-height: 1.4;
}

.popup-tile {
  background: white;
  color: #f7f7f7;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(20, 20, 32, 0.13);
  padding: 0;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  min-width: 258px;
  max-width: 310px;
  overflow: hidden;
}

.popup-tile-img-wrap {
  position: relative;
  background: #23272f;
  border-radius: 14px 14px 0 0;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.popup-tile-img {
  width: 100%;
  max-width: 300px;
  height: 170px;
  object-fit: cover;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.09);
  display: block;
}

.popup-tile-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #2d3441cc;
  color: #7dd3fc;
  border: none;
  font-size: 1.15em;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 2;
  opacity: 0.95;
}
.popup-tile-btn:hover {
  background: #3a4258;
}
.popup-tile-btn-prev { left: 9px; }
.popup-tile-btn-next { right: 9px; }

.popup-tile-content {
  padding: 15px 18px 12px 18px;
}

.popup-tile-price {
  font-size: 1.35em;
  font-weight: 700;
  color: #7dd3fc;
  margin-bottom: 3px;
}

.popup-tile-info {
  margin-bottom: 4px;
  display: flex;
  gap: 10px;
  font-size: 1em;
  color: #d1d5db;
}

.popup-tile-beds, .popup-tile-baths, .popup-tile-type {
  background: #31384b;
  color: #a3e5ff;
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 0.95em;
  font-weight: 500;
}

.popup-tile-address {
  font-size: 1em;
  font-weight: 500;
  color: #f3f3f3;
  margin-bottom: 2px;
}

.popup-tile-mls {
  font-size: 0.92em;
  color: #7dd3fc;
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* === RESPONSIVE === */
@media (max-width: 1020px) {
  .content, .content-2 {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .map-column {
    order: -1;
    flex: none;
    height: 50vh;
    min-height: 300px;
    position: relative;
  }

  #map, #map2, #map-shortcode {
    height: 100%;
    width: 100%;
    margin-bottom: 1rem;
    position: relative;
  }
  
  .listing-column {
    order: 1;
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 768px) {
  .filter-form-wrapper, .filter-form-wrapper-2 {
    position: static;
    box-shadow: none;
    border-bottom: none;
    padding: 1rem 0.75rem;
  }

  .filter-form, .filter-form-2 {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .field-25, .field-50 { 
    flex: 1 1 100%; 
    min-width: unset;
  }

  .listing-grid, .listing-grid-2 {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
  }
  
  .listing-card, .listing-card-2 {
    border-radius: 12px;
  }
  
  .listing-card .carousel, .listing-card-2 .carousel {
    height: 200px;
  }
  
  .listing-card .info, .listing-card-2 .info-2 {
    padding: 16px;
  }
  
  .listing-card .info > p:first-of-type {
    font-size: 24px;
  }
  
  .listing-card .info h4 {
    font-size: 15px;
  }
  
  .listing-card .actions {
    flex-direction: column;
  }
  
  .listing-card .actions .listing-action-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* Additional mobile breakpoint for very small screens */
@media (max-width: 600px) {
  .filter-form-wrapper, .filter-form-wrapper-2 {
    padding: 0.75rem 0.5rem;
  }
  
  .filter-form, .filter-form-2 {
    gap: 0.5rem;
  }
  
  .field-25, .field-50 { 
    flex: 1 1 100%; 
    min-width: unset;
  }
  
  .listing-grid, .listing-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 16px;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .filter-form-wrapper, .filter-form-wrapper-2 {
    padding: 0.5rem;
  }
  
  .filter-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .filter-actions button,
  .filter-actions .reset-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 14px;
  }
  
  .listing-grid, .listing-grid-2 {
    padding: 8px;
    gap: 12px;
    grid-template-columns: 1fr !important;
  }
  
  .listing-card .carousel, .listing-card-2 .carousel {
    height: 180px;
  }
  
  .listing-card:not(.similar-listing-card)::before {
    font-size: 11px;
    padding: 4px 8px;
    top: 8px;
    left: 8px;
  }
  
  .listing-card::after {
    font-size: 10px;
    padding: 3px 8px;
    top: 8px;
    right: 8px;
  }
  
  .listing-card .info > p:first-of-type {
    font-size: 22px;
  }
  
  .listing-card .info, .listing-card-2 .info-2 {
    padding: 12px;
  }
  
  /* Mobile bottom section adjustments */
  .listing-bottom-section {
    padding-top: 12px !important;
  }
  
  .listing-bottom-section p {
    font-size: 12px;
    margin: 0 0 8px 0;
  }
  
  .listing-bottom-section .actions {
    margin-top: 6px;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .listing-grid, .listing-grid-2 {
    padding: 8px;
    gap: 8px;
    grid-template-columns: 1fr !important;
  }
  
  .listing-card .info > p:first-of-type {
    font-size: 20px;
  }
  
  .listing-card .carousel, .listing-card-2 .carousel {
    height: 160px;
  }
}

/* ================================
   MAP MARKER HOVER ENHANCEMENTS
   ================================ */

/* Enhanced marker hit areas for better hover experience */
.custom-marker-blue, .custom-marker-orange {
  cursor: pointer !important;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.custom-marker-blue:hover, .custom-marker-orange:hover {
  transform: scale(1.1);
  z-index: 1000 !important;
}

/* CSS-only hover highlighting for listing cards */
.custom-marker-blue.marker-highlighted {
  /* Use transform-origin to scale from center while preserving position */
  transform-origin: center center !important;
  /* Don't override transform directly - use filter and z-index instead */
  z-index: 9999 !important;
  animation: pulse-highlight 1.5s infinite !important;
  /* Use filter to create scaling effect without affecting positioning */
  filter: drop-shadow(0 0 8px rgba(255, 145, 4, 0.6)) !important;
}

/* Scale using a CSS variable or pseudo-element approach */
.custom-marker-blue.marker-highlighted::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  border-radius: inherit;
  background: transparent;
  transform: scale(1.3);
  z-index: -1;
}

.custom-marker-blue.marker-highlighted > div > div {
  background-color: #ff9104 !important;
  border-color: #e6820e !important;
  box-shadow: 0 0 8px rgba(255, 145, 4, 0.6) !important;
  /* Apply scaling to the inner element instead */
  transform: scale(1.2) !important;
}

/* Target markers by data-mls attribute for more reliable highlighting */
.custom-marker-blue[data-mls-highlight] {
  z-index: 9999 !important;
  animation: pulse-highlight 1.5s infinite !important;
  filter: drop-shadow(0 0 8px rgba(255, 145, 4, 0.6)) !important;
}

.custom-marker-blue[data-mls-highlight] > div > div {
  background-color: #ff9104 !important;
  border-color: #e6820e !important;
  box-shadow: 0 0 8px rgba(255, 145, 4, 0.6) !important;
  transform: scale(1.2) !important;
}

@keyframes pulse-highlight {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Leaflet popup enhancements for better hover experience */
.leaflet-popup {
  pointer-events: auto !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  pointer-events: auto !important;
}

.leaflet-popup-tip {
  pointer-events: none;
}

/* Cluster popup styling */
.cluster-popup .leaflet-popup-content-wrapper {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
}

.cluster-popup .leaflet-popup-content {
  margin: 8px 12px;
  min-width: 200px;
}

/* Ensure map markers stay interactive */
.leaflet-marker-icon {
  pointer-events: auto !important;
}

.leaflet-marker-shadow {
  pointer-events: none !important;
}

/* Improve cluster marker hover */
.marker-cluster {
  pointer-events: auto !important;
  transition: all 0.2s ease;
}

.marker-cluster:hover {
  transform: scale(1.05);
  z-index: 1000 !important;
}

/* Cluster highlighting when listing card is hovered - MUST override default blue */
.leaflet-marker-icon.marker-cluster.marker-highlighted,
.marker-cluster-medium.marker-highlighted,
.marker-cluster-large.marker-highlighted,
.marker-cluster.marker-highlighted {
  background: #ff6b35 !important; /* Orange background */
  background-color: #ff6b35 !important; /* Orange background - alternative property */
  border: 3px solid #e55a2b !important; /* Darker orange border */
  transform: scale(1.15) !important;
  z-index: 1001 !important;
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.8) !important; /* Orange glow */
  animation: pulse-highlight 1.5s infinite !important;
}

.leaflet-marker-icon.marker-cluster.marker-highlighted span,
.marker-cluster-medium.marker-highlighted span,
.marker-cluster-large.marker-highlighted span,
.marker-cluster.marker-highlighted span {
  color: white !important; /* White text for contrast */
  font-weight: bold !important;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5) !important;
}

/* Pulse animation for highlighted clusters */
@keyframes pulse-highlight {
  0%, 100% { 
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.8);
  }
  50% { 
    box-shadow: 0 0 30px rgba(255, 107, 53, 1);
  }
}

/* ========================================= */
/* LISTING CARD BOTTOM SECTION STYLING      */
/* ========================================= */

/* Hide any remaining deal quality percentage divs */
.deal-quality-with-percentage {
  display: none !important;
}

/* Ensure consistent card heights and bottom positioning */
.listing-grid {
  display: grid;
  align-items: stretch; /* Make all cards same height */
}

.listing-card, .listing-card-2 {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.listing-card .info, .listing-card-2 .info-2 {
  display: flex;
  flex-direction: column;
  flex: 1; /* Fill remaining space */
  height: 100%;
}

/* Bottom section styling - pushes MLS ID and actions to bottom */
.listing-bottom-section {
  margin-top: auto !important;
  padding-top: 16px !important;
  border-top: 1px solid #f0f0f0;
}

.listing-bottom-section p {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.listing-bottom-section .actions {
  margin-top: 8px;
}

/* IP location specific cards */
.ip-location-card, .grid-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ip-location-card .info, .grid-card .info {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
}

/* ========================================= */
/* ELEMENTOR GRID CONSISTENCY               */
/* ========================================= */

/* Ensure Elementor grid items behave like regular listing cards */
.elementor-posts-container .elementor-grid-item {
  display: flex !important;
  width: 100% !important;
  margin: 0 !important;
}

/* Override Elementor's default grid styles to match our listing grid */
.elementor-posts-container.elementor-grid-3,
.elementor-posts-container.elementor-grid-tablet-2,
.elementor-posts-container.elementor-grid-mobile-1 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
}

/* Override Elementor's default grid styles to match our listing grid */
.elementor-posts-container.elementor-grid-3,
.elementor-posts-container.elementor-grid-tablet-2,
.elementor-posts-container.elementor-grid-mobile-1 {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 20px !important;
  padding: 9px !important;
  background: none !important;
}

/* Responsive grid for Elementor containers and IP grid - match main listing grid exactly */
@media (max-width: 768px) {
  .elementor-posts-container.elementor-grid,
  #ip-listing-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 24px !important;
  }
  
  .elementor-posts-container.elementor-grid-3,
  .elementor-posts-container.elementor-grid-tablet-2,
  .elementor-posts-container.elementor-grid-mobile-1 {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 24px !important;
  }
}

@media (max-width: 480px) {
  .elementor-posts-container.elementor-grid,
  #ip-listing-grid {
    padding: 24px !important;
    gap: 24px !important;
    grid-template-columns: 1fr !important;
  }
  
  .elementor-posts-container.elementor-grid-3,
  .elementor-posts-container.elementor-grid-tablet-2,
  .elementor-posts-container.elementor-grid-mobile-1 {
    padding: 8px !important;
    gap: 12px !important;
    grid-template-columns: 1fr !important;
  }
}

/* ================================
   PROPERTY TYPE & DAYS ON MARKET BADGES
   ================================ */

/* Property type badge (top left) */
.property-type-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

/* Days since listing badge (top right) */
.days-since-listing {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Sold badge (top right) */
.sold-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}