/* Frontend Styles for Listings */

/* Full-width map layout - override theme styles */
body.maloney-listings-active #main-content,
body.maloney-listing-single #main-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.maloney-listings-active #main-content .container,
body.maloney-listing-single #main-content .container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Full-width layout for listings archive page only */
body.maloney-listings-active:not(.single-listing) #content-area {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.maloney-listings-active:not(.single-listing) #left-area {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

body.maloney-listings-active #sidebar,
body.maloney-listing-single #sidebar {
    display: none !important;
}

/* Prevent background scroll when overlays/modals are open */
body.filter-modal-open {
    overflow: hidden;
}

/* Full-width Map Layout */
.listings-map-layout {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    clear: both;
}

/* Page Title */
.listings-page-title {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .listings-page-title {
        position: sticky;
        top: 0;
        z-index: 1002;
        padding: 15px 20px;
    }
    
    /* Lower z-index when filter modal is open */
    body.filter-modal-open .listings-page-title {
        z-index: 1;
    }
    
    body.filter-modal-open .listings-search-bar {
        z-index: 1;
    }
    
    body.filter-modal-open .mobile-view-toggle {
        z-index: 1;
    }
}

.listings-page-title h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #333;
}

/* Search/Filter Bar */
.listings-search-bar {
    background: #f5f5f5;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    z-index: 2000;
    position: relative;
}

@media (max-width: 768px) {
    .listings-search-bar {
        position: sticky;
        top: 0;
        z-index: 1001;
        padding: 12px 20px;
    }
}

.listings-search-container {
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: center;
    position: relative;
}

.listings-search-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

.search-location {
    display: flex;
    flex: 0 0 auto;
    position: relative;
    width: 300px;
    max-width: 100%;
    min-width: 0;
}

.location-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 2002;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    margin-top: 5px;
}

.location-autocomplete ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.location-autocomplete li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.location-autocomplete li:hover {
    background: #f5f5f5;
}

.location-autocomplete li:last-child {
    border-bottom: none;
}

.location-autocomplete .suggestion-icon {
    font-size: 16px;
    line-height: 1;
    color: #2d4f5e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-autocomplete .suggestion-pin {
    width: 16px;
    height: 16px;
}

.location-autocomplete .suggestion-primary {
    font-weight: 600;
    color: #1d1d1f;
}

.search-location input[type="text"] {
    flex: 1;
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 14px;
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .search-location input[type="text"] {
        padding: 12px 12px;
        font-size: 14px;
    }
}

.search-btn {
    padding: 0;
    background: #0073aa;
    color: white;
    border: 1px solid #0073aa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    box-sizing: border-box;
    margin-left: 10px; /* Spacing between input and button */
}

.search-btn:hover {
    background: #005a87;
}

.filter-dropdowns {
    display: flex;
    gap: 8px;
    flex: 1 1 320px;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    min-width: 0;
}

.filter-btn {
    padding: 0 14px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 44px;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-dropdowns select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    min-width: 120px;
    height: 44px;
    box-sizing: border-box;
}

.filter-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
    vertical-align: middle;
    margin-right: 4px;
}

.filter-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    display: inline-block;
}

.filter-btn:hover {
    background: #f5f5f5;
}

.filter-btn.button-primary {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.filter-btn.button-primary:hover {
    background: #005a87;
}

.reset-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.advanced-filters {
    width: auto;
    padding: 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: absolute;
    top: auto;
    left: auto;
    right: auto;
    z-index: 2001;
    max-height: 80vh;
    overflow-y: auto;
    display: none; /* Hidden by default, shown via JavaScript */
}

.advanced-filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.advanced-filters-grid .filter-group:first-child {
    grid-column: 1;
}

.advanced-filters-grid .filter-group:last-child {
    grid-column: 2;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Compact popover panels */
.filter-popover {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 5px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    padding: 8px 10px;
    z-index: 2100;
    min-width: 240px;
    max-width: 400px;
}
.filter-popover-content { min-width: 240px; }

/* Price filter: tabs use status-type-btn styling; min/max labels on top of fields; no overflow */
#popover_price_range .filter-popover-content {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}
.price-filter-fields {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
    min-width: 0;
}
.price-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 0;
}
.price-filter-field label {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}
.price-filter-sep {
    color: #666;
    flex-shrink: 0;
    padding-bottom: 6px;
}
.price-filter-select {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    padding: 6px 8px;
    box-sizing: border-box;
}

.filter-popover-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-popover-header-title {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.filter-popover-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.filter-popover-title { 
    font-weight: 600; 
    margin: 4px 2px 8px 2px; 
    font-size: 16px;
}
.filter-popover-options { display: grid; grid-template-columns: repeat(5, auto); gap: 8px 10px; }
.filter-popover-options.two-col { 
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.filter-popover-options label { 
    font-weight: normal; 
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Button-style checkboxes and radios */
.filter-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 768px) {
    .filter-button-group {
        gap: 6px;
    }
}

.filter-option-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 60px;
    text-align: center;
    user-select: none;
}

@media (max-width: 768px) {
    .filter-option-button {
        padding: 10px 14px;
        font-size: 15px;
        min-width: 70px;
        min-height: 44px; /* Better touch target */
        flex: 1 1 auto;
    }
    
    .filter-button-group.two-col .filter-option-button {
        flex: 1 1 calc(50% - 3px);
    }
}

.filter-option-button:hover {
    border-color: #0073aa;
    background: #f0f7fa;
}

.filter-option-button input[type="checkbox"],
.filter-option-button input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
}

.filter-option-button input[type="checkbox"]:checked + span,
.filter-option-button input[type="radio"]:checked + span {
    color: #0073aa;
    font-weight: 600;
}

.filter-option-button input[type="checkbox"]:checked ~ span,
.filter-option-button input[type="radio"]:checked ~ span {
    color: #0073aa;
    font-weight: 600;
}

.filter-option-button:has(input[type="checkbox"]:checked),
.filter-option-button:has(input[type="radio"]:checked),
.filter-option-button.checked {
    border-color: #0073aa;
    background: #e6f3f8;
}

.filter-option-button span {
    display: block;
    pointer-events: none;
}

.filter-popover-actions { 
    margin-top: 16px; 
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.beds-baths-section {
    margin-bottom: 16px;
}

.beds-baths-section + .beds-baths-section {
    border-top: 1px solid #e6e6e6;
    padding-top: 16px;
}

.filter-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2d4f5e;
}

@media (max-width: 768px) {
    .beds-baths-section {
        margin-bottom: 20px;
    }
    
    .beds-baths-section + .beds-baths-section {
        padding-top: 20px;
        margin-top: 20px;
    }
    
    .filter-section-title {
        font-size: 15px;
        margin-bottom: 12px;
    }
}

.filter-done-btn {
    width: 100%;
    padding: 12px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.filter-done-btn:hover {
    background: #005a87;
}

.filter-done-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

/* Status filter sections */
.status-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.status-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.status-section-title {
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 6px;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .status-section {
        margin-top: 16px;
        padding-top: 16px;
    }
    
    .status-section-title {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .status-options-container {
        margin-left: 0;
    }
}
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
}

.status-section-title:hover {
    color: #0073aa;
}

.status-options-container {
    margin-left: 12px;
    margin-top: 6px;
}

.status-filter-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.status-type-btn {
    flex: 1;
    padding: 8px 16px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.status-type-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.status-type-btn.active {
    border-color: #0073aa;
    background: #0073aa;
    color: white;
}

.status-options-panel {
    margin-top: 12px;
}

.status-options-panel .filter-popover-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-options-panel .filter-popover-options label {
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
    padding: 4px 0;
}

/* Results header with sort */
.results-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.results-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.results-sort {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.results-sort > label {
    margin-bottom: 0;
}

.results-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-sort .page-info {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.results-sort label {
    font-weight: 500;
    font-size: 14px;
    color: #666;
}

.results-sort select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.amenities-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.amenities-checkboxes label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Desktop: side-by-side cards + map (like alt view) */
@media (min-width: 769px) {
    .listings-map-container {
        position: relative;
        width: 100%;
        flex: 1;
        min-height: calc(100vh - 120px);
        height: auto;
        overflow: hidden;
        clear: both;
        display: flex;
        flex-direction: row;
        align-items: stretch;
    }
    .listings-cards-overlay {
        position: relative;
        flex: 0 0 52%;
        min-width: 460px;
        max-width: 700px;
        height: calc(100vh - 120px);
        max-height: 100%;
        background: white;
        box-shadow: 2px 0 8px rgba(0,0,0,0.12);
        z-index: 2;
        display: flex;
        flex-direction: column;
        overflow-y: scroll;
        overflow-x: scroll;
        padding-bottom: 70px;
    }
    .full-width-map {
        position: sticky;
        top: 90px; /* keep clear of header/nav */
        flex: 1 1 48%;
        min-width: 0;
        width: 100%;
        height: calc(100vh - 120px);
        min-height: 640px;
        z-index: 1;
        background: #f5f5f5;
        overflow: hidden;
    }
    .full-width-map #listings-map {
        width: 100%;
        height: 100%;
        min-height: 100%;
    }
    .listings-layout-two-col {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
}


.listings-cards-content {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.listings-cards-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    padding: 15px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.listings-cards-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: white;
    flex-shrink: 0;
}

.listings-cards-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-info {
    font-size: 14px;
    font-weight: normal;
    color: #666;
}

.active-filters { margin-top: 6px; }
/* Reset Filters now lives next to the active-filter chips in the cards header,
   and is shown only when there are active filters (toggled by JS). */
.active-filters-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.active-filters-row:empty {
    margin-top: 0;
}
.active-filters-row .reset-btn {
    flex-shrink: 0;
}
.active-filters-row .active-filters {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}
.active-filters .chip {
    display:inline-block; background:#eef5fb; color:#0d47a1; border:1px solid #cfe1f5; border-radius:16px;
    padding:2px 8px; margin:2px 4px; font-size:12px; cursor:pointer;
    user-select: none;
    transition: background 0.2s;
}
.active-filters .chip:hover {
    background:#dde9f5;
}
.active-filters .chip .x { 
    margin-left:6px; 
    font-weight:bold; 
    pointer-events: none;
    display: inline-block;
}

/* Back to Results / View Listings link */
.back-to-results-container {
    margin: 10px 0 20px 0;
}

/* .back-to-results otherwise inherits Divi's #2ea3f2, which is only 2.74:1 on white. */
.back-to-results a,
.back-to-results-container a {
    color: #0073aa;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-to-results a:hover,
.back-to-results-container a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Sidebar Layout for Single Listing Pages */
#content-area.listing-with-sidebar {
    display: flex !important;
    flex-direction: row !important;
    gap: 30px;
    align-items: flex-start;
    margin-top: 0;
    padding-top: 0;
}

.listing-main-content {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
    margin-top: 0;
    padding-top: 0;
    order: 1;
}

.listing-sidebar {
    width: 350px;
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 0;
    order: 2;
    /* Scrolls with left content (no sticky) */
}

.similar-properties-sidebar {
    margin-top: 0;
    padding-top: 0;
}

/* Similar Properties Sidebar - Vertical Stack */
.similar-properties-sidebar {
    background: #fff;
    padding: 0 20px 20px 20px; /* No top padding to align with main content */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: static;
}

.similar-properties-sidebar h2 {
    font-size: 20px;
    margin: 0 0 20px 0;
    padding: 20px 0 15px 0; /* Add top padding to h2 to match main content spacing */
    border-bottom: 2px solid #0073aa;
    color: #333;
}

.similar-listings-vertical {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.similar-listings-vertical .listing-card {
    width: 100%;
    margin: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.similar-listings-vertical .listing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Responsive: Stack sidebar below on mobile */
@media (max-width: 980px) {
    #content-area.listing-with-sidebar {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    .listing-main-content {
        width: 100% !important;
        flex: 1 1 100% !important;
        max-width: 100% !important;
        order: 1 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .listing-sidebar {
        width: 100% !important;
        position: static !important;
        top: auto !important;
        order: 2 !important;
        padding: 0 !important;
        margin: 20px 0 0 0 !important;
    }
    
    .similar-properties-sidebar,
    .similar-properties-sidebar:has(.maloney-newsletter-similar-card) {
        position: static !important;
        width: 100% !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 48px 20px 20px 20px !important;
        margin: 32px 0 0 0 !important;
        background: #f9f9f9 !important;
        border-top: 1px solid #ddd !important;
    }
    
    .similar-properties-sidebar h2 {
        padding: 8px 0 15px 0 !important;
        margin: 0 0 20px 0 !important;
    }
    
    .listing-single-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px !important;
        margin: 0 !important;
    }
    
    .listing-single {
        width: 100% !important;
        max-width: 100% !important;
    }

    .ml-listing-nest:not([open]) .ml-listing-nest__body {
        display: none !important;
    }
}

/* Container spacing for similar properties (legacy support) */
.similar-properties { margin-bottom: 24px; }

/* Single Listing Container */
.listing-single-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 20px 20px; /* No top padding to align with sidebar */
    background: #fff;
}

.listing-single {
    width: 100%;
}

.listing-single .listing-featured-image {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.listing-single .listing-featured-image picture {
    display: block;
    width: 100%;
}

.listing-single .listing-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.listing-single .entry-title {
    font-size: 32px;
    margin: 0 0 15px 0;
    color: #333;
}

.listing-single .listing-header-badges {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.listing-single .listing-type-badge,
.listing-single .listing-status-badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.listing-single .listing-price {
    margin-bottom: 20px;
}

.listing-single .listing-price .price-amount {
    font-size: 24px;
    font-weight: 600;
    color: #0073aa;
}

.listing-single .listing-details {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.listing-single .detail-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.listing-single .detail-item {
    margin-bottom: 12px;
    line-height: 1.6;
}

.listing-single .detail-item strong {
    display: inline-block;
    min-width: 140px;
    color: #333;
    font-weight: 600;
}

.listing-single .detail-item .unit-types {
    color: #666;
}

.listing-single .listing-amenities {
    margin: 30px 0;
}

.listing-single .listing-amenities h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.listing-single .listing-amenities ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.listing-single .listing-amenities li {
    padding: 8px 16px;
    background: #f0f0f0;
    border-radius: 4px;
    color: #333;
}

.listing-single .listing-content {
    margin: 30px 0;
    line-height: 1.8;
    color: #555;
}

.listing-single .listing-content h2,
.listing-single .listing-content h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #333;
}

.listing-single .listing-content p {
    margin-bottom: 15px;
}

/* Scrollable Cards Area */
.listings-cards-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.listings-cards-scroll::-webkit-scrollbar {
    width: 8px;
}

.listings-cards-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.listings-cards-scroll::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.listings-cards-scroll::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Listing Card Styles */
.listing-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.listing-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: #0073aa;
}

.listing-card-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
    border-radius: 4px 4px 0 0;
}

/* Anchor and picture must fill wrapper so img has a defined area (fixes blank when lazy or 404) */
.listing-card-image-wrapper > a {
    display: block;
    width: 100%;
    height: 100%;
}

.listing-card-image-wrapper picture,
.map-popup-image-wrapper picture {
    display: block;
    width: 100%;
    height: 100%;
}

.listing-card-image-wrapper img,
.listing-card-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    display: block;
    vertical-align: top;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: high-quality;
}

.listing-card-image-placeholder {
    width: 100%;
    height: 100%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    /* #999 on #f5f5f5 is 2.61:1; #6b6b6b clears 4.5:1. */
    color: #6b6b6b;
}

.listing-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 10;
    display: block;
}

.listing-card-badge.listing-type-badge {
    background: rgba(0,0,0,0.85); /* Default fallback */
}
.leaflet-popup-pane .listing-type-badge, .leaflet-popup-pane .featured-badge {
    padding: 7px 10px;
}
/* Badge colours meet 4.5:1 against their text; the raw brand tints stay on the map pins. */
.listing-card-badge.badge-condo {
    background: rgba(228, 199, 128, 1) !important;
    color: #1a1a1a !important;
}

.listing-card-badge.badge-rental {
    background: #c0504a !important;
    color: #ffffff !important;
}

.featured-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: #FFD700;
    color: #333;
    padding: 0px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    z-index: 11;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.available-units-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    /* Deepened from #6ecc39 (2.02:1) so the white badge text clears 4.5:1. */
    background: #3f7d21;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    letter-spacing: 0.2px;
}

/* Top-left icon badges container (when icons enabled) */
.listing-card-top-left-icons {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: row;
    gap: 6px;
    z-index: 12;
}

/* Individual icon badges */
.listing-card-top-left-icons .badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.listing-card-top-left-icons .badge-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.listing-card-top-left-icons .badge-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Specific badge colors/backgrounds */
.listing-card-top-left-icons .badge-featured {
    background: rgba(255, 215, 0, 0.95);
}

.listing-card-top-left-icons .badge-condo {
    background: rgba(228, 199, 128, 0.95);
}

.listing-card-top-left-icons .badge-rental {
    background: rgba(232, 105, 98, 0.95);
}

.listing-card-top-left-icons .badge-verified {
    background: rgba(255, 255, 255, 0.95);
}

.listing-card-top-left-icons .badge-accessible {
    background: rgba(33, 150, 243, 0.95);
}

.listing-card-top-left-icons .badge-income-based {
    background: rgba(76, 175, 80, 0.95);
}

.listing-card-top-left-icons .badge-age-restricted {
    background: rgba(255, 152, 0, 0.95);
}

.listing-card-top-left-icons .badge-champ {
    background: rgba(156, 39, 176, 0.95);
}

.badge-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2196F3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.badge-icon svg {
    width: 16px;
    height: 16px;
}

.listing-card-content {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 60px;
    overflow: visible;
}

.listing-card-content > * {
    display: block;
    visibility: visible !important;
    opacity: 1 !important;
}

.listing-card-title {
    display: block !important;
    visibility: visible !important;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
    color: #333;
    line-height: 1.3;
}

.maloney-featured-listings-block {
    background: white;
    padding: 0;
    margin: 40px 0;
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
}

.featured-listings-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 0 20px;
}

.featured-listings-title {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #2f7b9b;
}

.featured-listings-description {
    margin: 8px 0 0;
    color: #2d4f5e;
    max-width: 640px;
    line-height: 1.5;
}

.featured-listings-all-link {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: #2d4f5e;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.featured-listings-grid {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0 20px;
}

.featured-listings-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 16px;
    margin-top: 28px;
}

.featured-listings-slider-wrapper {
    position: relative;
    padding: 0 40px;
}

.featured-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    z-index: 2;
}

.featured-slider-nav.prev {
    left: -23px;
}

.featured-slider-nav.next {
    right: -23px;
}

.featured-slider-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.featured-slider-nav .dashicons {
    font-size: 18px;
}

.featured-listings-grid.featured-listings-slider {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 10px 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-x;
}

.featured-listings-grid.featured-listings-slider::-webkit-scrollbar {
    display: none;
}

.featured-listings-grid.featured-listings-slider {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.featured-listings-grid.featured-listings-slider .featured-listing-card {
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.featured-listing-card {
    background: #fafafa;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    flex: 0 0 calc(33.333% - 14px);
    max-width: calc(33.333% - 14px);
    min-width: 280px;
}

/* Ensure 3-column grid on desktop (gap is 20px, so we need to account for 2 gaps across 3 items = 13.33px per item) */
@media (min-width: 1024px) {
    .featured-listings-grid:not(.featured-listings-slider) .featured-listing-card {
        flex: 0 0 calc(33.333% - 14px) !important;
        max-width: calc(33.333% - 14px) !important;
    }
}

.featured-listing-card-media {
    position: relative;
    min-height: 200px;
    overflow: hidden;
}

.featured-listing-card-media picture {
    display: block;
    width: 100%;
}

.featured-listing-card-media img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.featured-listing-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.featured-listing-card-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.featured-listing-card-title a {
    color: #111;
    text-decoration: none;
}

.featured-listing-card-address {
    margin: 0;
    color: #5a5a5a;
    font-size: 14px;
    line-height: 1.4;
}

.featured-listing-card-price {
    font-size: 20px;
    font-weight: 600;
    color: #1f7c95;
}

.featured-listing-card-status {
    font-size: 13px;
    color: #4e4e4e;
    letter-spacing: 0.1px;
    text-transform: uppercase;
}

.featured-listing-meta {
    margin-top: auto;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.featured-listing-card-footer {
    padding-top: 12px;
}

.featured-view-apply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid #0073aa;
    color: #0073aa;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.1em;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.featured-view-apply-btn:hover {
    background: #0073aa;
    color: white;
}
.featured-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #444;
    letter-spacing: 0.02em;
}

.featured-meta-icon {
    display: inline-flex;
    color: #444;
}

.featured-meta-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.featured-listing-card-availability {
    font-size: 13px;
    color: #4e4e4e;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

@media (max-width: 768px) {
    .maloney-featured-listings-block {
        padding: 0;
        margin: 30px 0;
    }

    .featured-listings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 0;
    }

    .featured-listings-header-content {
        width: 100%;
    }

    .featured-listings-title {
        font-size: 24px;
        line-height: 1.2;
    }

    .featured-listings-description {
        font-size: 14px;
        margin-top: 8px;
    }

    .featured-listings-all-link {
        font-size: 13px;
        align-self: flex-start;
    }

    .featured-listings-grid {
        margin-top: 20px;
        gap: 16px;
        justify-content: flex-start;
        padding: 0 16px;
    }

    .featured-listing-card {
        flex: 0 0 calc(100% - 8px);
        max-width: calc(100% - 8px);
        min-width: 0;
    }

    .featured-listings-grid.featured-listings-slider .featured-listing-card {
        flex: 0 0 calc(85vw - 32px);
        max-width: calc(85vw - 32px);
        min-width: 280px;
    }

    .featured-listings-slider-wrapper {
        margin: 0;
        padding: 0;
    }

    .featured-listings-grid.featured-listings-slider {
        padding: 0 0 10px 0;
    }

    .featured-slider-nav {
        width: 40px;
        height: 40px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .featured-slider-nav.prev {
        left: -20px;
    }

    .featured-slider-nav.next {
        right: -20px;
    }

    .featured-slider-nav .dashicons {
        font-size: 16px;
    }

    .featured-listing-card-media {
        min-height: 180px;
    }

    .featured-listing-card-media img {
        height: 180px;
    }

    .featured-listing-card-body {
        padding: 16px;
        gap: 6px;
    }

    .featured-listing-card-title {
        font-size: 16px;
    }

    .featured-listing-card-address {
        font-size: 12px;
    }

    .featured-listing-card-price {
        font-size: 18px;
    }

    .featured-listing-card-status,
    .featured-listing-card-availability {
        font-size: 12px;
    }

    .featured-listing-card-footer {
        padding-top: 10px;
    }

    .listing-card-cta-btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
    }
}

.listing-card-address {
    display: block !important;
    visibility: visible !important;
}

.listing-card-features {
    display: flex !important;
    visibility: visible !important;
}

.waitlist-status {
    display: block !important;
    visibility: visible !important;
}

.listing-card-title a {
    color: #333;
    text-decoration: none;
}

.listing-card-title a:hover {
    color: #0073aa;
}

.listing-card-address {
    color: #666;
    font-size: 12px;
    margin-bottom: 6px;
    line-height: 1.3;
}

/* View & Apply CTA Button */
.listing-card-cta-btn {
    display: block;
    background: #0073aa;
    color: white;
    text-align: center;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-top: auto;
    transition: background 0.2s;
}

.listing-card-cta-btn:hover {
    background: #005a87;
    color: white;
}

.listing-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.feature-tag {
    background: #e9eef2;
    color: #345;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
    margin-right: 4px;
    margin-bottom: 4px;
}
.badge-lottery { background: #E8F5E9; color: #2E7D32; }
.badge-firstcome { background: #E3F2FD; color: #1565C0; }
.badge-available { background: #E8F5E9; color: #2E7D32; }
.badge-waitlist { background: #FFF3E0; color: #EF6C00; }
.badge-waitlist-open { background: #FFFDE7; color: #827717; }

.waitlist-status {
    margin: 4px 0 0 0;
    padding: 0;
    border-top: 1px solid #e0e0e0;
    font-size: 11px;
}

.waitlist-status.available {
    color: #2e7d32;
}

.waitlist-status.waitlist {
    color: #1976d2;
}

.waitlist-status.not-available {
    color: #666;
}

.waitlist-status strong {
    display: block;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.available-units {
    margin-top: 4px;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.available-units strong {
    font-weight: 600;
    color: #333;
}

.unit-types {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.3;
    color: #666;
}

.available-units-offered {
    margin-top: 4px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.4;
}

.available-units-offered strong {
    font-weight: 600;
    color: #333;
}

.unit-type {
    display: inline;
    color: #555;
}

.wheelchair-icon {
    font-size: 14px;
    vertical-align: middle;
    margin-left: 2px;
}

.listing-card-price {
    font-size: 18px;
    font-weight: bold;
    color: #2e7d32;
    margin: 12px 0;
}

.listing-card-button {
    width: 100%;
    padding: 12px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-top: auto; /* Push button to bottom */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: background 0.3s ease;
    text-align: center;
}

.listing-card-button:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

.listing-card-button svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

/* Pagination */
.listings-pagination {
    padding: 20px;
    border-top: 1px solid #eee;
    background: white;
    flex-shrink: 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    grid-column: span 2;
}


.listings-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    margin: 0;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 400;
    min-width: 32px;
    height: 32px;
    text-align: center;
    transition: all 0.2s ease;
    background: #f5f5f5;
    border-color: #ddd;
}

.listings-pagination .page-numbers:hover {
    background: #e9e9e9;
    border-color: #bbb;
    color: #333;
}

.listings-pagination .page-numbers.current {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
    font-weight: 500;
}

.listings-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    cursor: default;
    min-width: auto;
    padding: 0 4px;
    color: #333;
}

.listings-pagination .page-numbers.dots:hover {
    background: transparent;
    border: none;
    color: #333;
}

.listings-pagination .page-numbers.prev,
.listings-pagination .page-numbers.next {
    padding: 6px 10px;
    background: #f5f5f5;
}

/* No Listings */
/* Loading Spinner */
.loading {
    padding: 60px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 300px;
    background: #fafafa;
    border-radius: 8px;
    margin: 20px 0;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e8e8e8;
    border-top: 5px solid #0073aa;
    border-right: 5px solid #0073aa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
}

.loading-text {
    font-size: 16px;
    color: #555;
    font-weight: 500;
    margin-top: 10px;
    letter-spacing: 0.3px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile adjustments for loading spinner */
@media (max-width: 768px) {
    .loading {
        padding: 40px 15px;
        min-height: 200px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .loading-text {
        font-size: 14px;
    }
}

.no-listings-found {
    padding: 60px 20px;
    text-align: center;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin: 20px 0;
}

.no-listings-found p {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

.no-listings-found .reset-filters-link {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s ease;
    margin-top: 10px;
}

.no-listings-found .reset-filters-link:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

/* Map Popup Styles */
/* Map Popup Styles - Caritas-style design */

/* Isolate popup pane so it's not affected by leaflet-map-pane's transform (own compositing layer; avoids popup jump when marker at top is clicked) */
#listings-map .leaflet-popup-pane {
  transform: translateZ(0);
  backface-visibility: hidden;
}

.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  border: none !important;
  z-index: 10000 !important; /* Ensure popup appears above left section */
}

.leaflet-popup {
    z-index: 10000 !important; /* Ensure popup appears above left section */
}

.leaflet-popup-content {
    margin: 0 !important;
    width: auto !important;
    min-width: 320px;
}

.leaflet-popup-tip {
    background: white !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.leaflet-popup-close-button {
    display: none !important;
}

.map-popup-custom {
    width: 320px;
    max-width: 90vw;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
}

.map-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: background 0.2s;
}

.map-popup-close:hover {
    background: rgba(0,0,0,0.8);
}

.map-popup {
    min-width: 200px;
}

.map-popup .status-badge {
    display: inline-block;
    background: #E3F2FD;
    color: #0D47A1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin: 4px 0;
}

.map-popup h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.map-popup h3 a {
    color: #0073aa;
    text-decoration: none;
}

.map-popup p {
    margin: 5px 0;
    font-size: 14px;
}

.map-popup .button {
    display: inline-block;
    padding: 8px 15px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 10px;
}

/* Filter Modal Button (Mobile) */
.filter-modal-btn {
    display: none; /* Hidden on desktop */
    padding: 0 16px;
    background: white;
    border: 1px solid #bbb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    height: 44px; /* Match input and search button height */
    flex-shrink: 0;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s;
}

.filter-modal-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.filter-modal-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

@media (max-width: 768px) {
    .filter-modal-btn {
        display: inline-flex;
    }
}

@media (min-width: 769px) {
    .listings-search-container {
        display: grid;
        gap: 10px 12px;
        align-items: center;
    }

    .search-location {
        grid-area: search;
        flex: none;
        width: 100%;
        max-width: 300px;
    }

    .filter-dropdowns {
        grid-area: filters;
        flex: none;
        min-width: 0;
    }

    .listings-search-actions {
        grid-area: actions;
        margin-left: 0;
        flex-shrink: 0;
    }

    .listings-display-options {
        align-self: center;
    }
}

@media (min-width: 769px) and (max-width: 980px) {
    .listings-search-container {
        grid-template-columns: minmax(220px, 1fr) auto;
        grid-template-areas:
            "search actions"
            "filters filters";
    }

    .filter-dropdowns {
        gap: 6px;
    }

    .filter-btn {
        padding: 0 11px;
        font-size: 13px;
    }

    .listings-search-actions {
        justify-self: end;
    }
}

@media (min-width: 981px) {
    .listings-search-container {
        grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) auto;
        grid-template-areas: "search filters actions";
    }
}

.filter-modal-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.filter-modal-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

/* Filter Modal Overlay */
.filter-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile Chrome */
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999 !important; /* Much higher than all sticky headers */
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
}

.filter-modal-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.filter-modal-content {
    background: white;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile Chrome */
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 0;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    /* Account for safe area insets on mobile */
    padding-top: env(safe-area-inset-top, 0);
    padding-right: env(safe-area-inset-right, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
}

@media (max-width: 768px) {
    .filter-modal-overlay {
        align-items: stretch;
        justify-content: stretch;
    }
    
    .filter-modal-content {
        border-radius: 0;
    }
}

.filter-modal-header {
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top, 0));
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: white;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.filter-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.filter-modal-header-btn {
    display: none; /* Hidden on desktop */
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .filter-modal-header-btn {
        display: inline-flex;
        align-items: center;
        min-height: 44px; /* Better touch target */
        padding: 10px 16px;
    }
    
    .filter-modal-header {
        flex-wrap: wrap;
        padding: 12px 16px;
    }
    
    .filter-modal-header h2 {
        font-size: 18px;
        flex: 1 1 100%;
        margin-bottom: 12px;
    }
    
    .filter-modal-header-actions {
        flex: 1 1 100%;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 8px;
        position: relative;
    }
    
    .filter-modal-header-actions .filter-modal-header-btn {
        flex: 0 0 auto;
    }
    
    .filter-modal-close {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        min-width: 44px;
        min-height: 44px;
        flex-shrink: 0;
        margin-left: auto;
    }
}

.filter-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-modal-header .dashicons {
    font-size: 18px;
    color: #666;
}

.filter-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.filter-modal-close:hover {
    background: #f5f5f5;
}

.filter-modal-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.filter-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    min-height: 0; /* Allow flex child to shrink */
}

@media (max-width: 768px) {
    .filter-modal-body {
        padding: 16px;
    }
}

.filter-modal-body .filter-dropdowns {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.filter-modal-body .filter-dropdowns {
    display: block !important;
}

.filter-modal-body .filter-btn {
    display: none !important; /* Hide filter buttons in modal */
}

.filter-modal-body #toggle_advanced_filters {
    display: none !important; /* Specifically hide "More" button in modal */
}

.filter-modal-body .filter-popover {
    position: relative !important;
    display: block !important;
    margin-bottom: 20px !important;
    box-shadow: none !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 0 !important;
    min-width: auto !important;
    max-width: 100% !important;
    width: 100% !important;
}

@media (max-width: 768px) {
    .filter-modal-body .filter-popover {
        padding: 16px !important;
        margin-bottom: 16px !important;
        border-radius: 6px !important;
    }
}

.filter-modal-body .filter-popover-content {
    padding: 0 !important;
}

.filter-modal-body .filter-popover-header {
    margin-bottom: 16px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid #e0e0e0 !important;
}

.filter-modal-body .filter-popover-header-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #111 !important;
}

@media (max-width: 768px) {
    .filter-modal-body .filter-popover-header {
        margin-bottom: 12px !important;
        padding-bottom: 10px !important;
    }
    
    .filter-modal-body .filter-popover-header-title {
        font-size: 15px !important;
    }
}

.filter-modal-body .advanced-filters {
    display: block !important;
    position: relative !important;
    margin: 20px 0 0 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    order: 999; /* Ensure it appears after all popovers */
}

@media (max-width: 768px) {
    .filter-modal-body .advanced-filters {
        padding: 16px !important;
        margin: 16px 0 0 0 !important;
        border-radius: 6px !important;
    }
    
    .filter-modal-body .filter-group label {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .filter-modal-body .amenities-checkboxes label,
    .filter-modal-body .accessibility-checkboxes label,
    .filter-modal-body .other-filters label {
        font-size: 15px;
        padding: 8px 0;
        min-height: 44px; /* Better touch target */
        display: flex;
        align-items: center;
    }
    
    .filter-modal-body .amenities-checkboxes input,
    .filter-modal-body .accessibility-checkboxes input,
    .filter-modal-body .other-filters input {
        width: 20px;
        height: 20px;
        margin-right: 12px;
        flex-shrink: 0;
    }
}

.filter-modal-body .advanced-filters-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
}

.filter-modal-body .status-type-btn {
    width: 100% !important;
    margin-bottom: 10px !important;
    cursor: pointer !important;
}

.filter-modal-body .status-options-panel {
    display: none;
    margin-top: 12px !important;
}

.filter-modal-body .status-options-panel[style*="display: block"] {
    display: block !important;
}

.filter-modal-body #status_panel_rental,
.filter-modal-body #status_panel_condo {
    margin-top: 12px !important;
    padding-top: 12px !important;
    border-top: 1px solid #e0e0e0 !important;
}

.filter-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    background: white;
}

@media (max-width: 768px) {
    .filter-modal-footer {
        padding: 12px 16px;
        gap: 10px;
    }
}

.filter-modal-reset-btn,
.filter-modal-apply-btn {
    flex: 1;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    min-height: 48px; /* Better touch target */
}

@media (max-width: 768px) {
    .filter-modal-reset-btn,
    .filter-modal-apply-btn {
        padding: 14px 20px;
        font-size: 16px;
        min-height: 50px;
    }
}

.filter-modal-reset-btn {
    background: white;
    color: #0073aa;
    border: 2px solid #0073aa;
}

.filter-modal-reset-btn:hover {
    background: #f0f7fa;
}

.filter-modal-apply-btn {
    background: #0073aa;
    color: white;
}

.filter-modal-apply-btn:hover {
    background: #005a87;
}

/* Desktop: Hide modal button, show inline filters */
@media (min-width: 769px) {
    .filter-modal-btn {
        display: none !important;
    }
    
    .filter-modal-overlay {
        display: none !important;
    }
}

/* Mobile: Show modal button, hide inline filters */
@media (max-width: 768px) {
    .filter-modal-btn {
        display: inline-flex !important;
    }
    
    .filter-dropdowns {
        display: none !important;
    }

    body.maloney-listings-active .listings-search-container > .filter-dropdowns,
    body.maloney-listings-active .listings-search-container > #advanced_filters {
        display: none !important;
    }
    
    .filter-modal-overlay {
        align-items: flex-end;
    }
    
    .filter-modal-content {
        max-height: 100vh;
    }

    .filter-modal-header-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .filter-modal-close {
        margin-left: auto;
    }
}

/* Mobile View Toggle */
.mobile-view-toggle {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #ddd;
    justify-content: center;
    z-index: 2200;
    position: relative;
}

@media (max-width: 768px) {
    .mobile-view-toggle {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
}

.view-toggle-btn {
    flex: 1;
    max-width: 150px;
    padding: 12px 20px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

.view-toggle-btn.active {
    background: #0073aa;
    border-color: #0073aa;
    color: white;
}

.view-toggle-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    /* Show mobile toggle on mobile */
    .mobile-view-toggle {
        display: flex !important;
    }
    
    /* Default: Show list view by default on mobile, hide when map is active */
    .listings-cards-overlay {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        height: auto !important;
        overflow: visible !important;
        box-shadow: none !important;
        z-index: 1 !important;
        flex-direction: column !important;
    }
    
    /* When list view is explicitly active, ensure it's shown */
    .listings-cards-overlay.mobile-list-active {
        display: flex !important;
        position: relative !important;
    }
    
    /* Hide list when map view is active */
    .listings-cards-overlay.mobile-list-hidden {
        display: none !important;
    }
    
    .listings-cards-scroll {
        overflow-y: visible !important;
        padding: 15px !important;
        max-height: none !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
    }
    
    #listings-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* Map container - always visible, contains both map and listings */
    .listings-map-container {
        position: relative !important;
        width: 100% !important;
        display: block !important;
    }
    
    /* Hide the map itself when in list view */
    .listings-map-container:not(.mobile-map-active) .full-width-map {
        display: none !important;
    }
    
    /* Show the map when map view is active */
    .listings-map-container.mobile-map-active .full-width-map {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        height: calc(100vh - 180px) !important;
        min-height: 400px !important;
    }
    
    .listings-cards-scroll {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
    
    .listings-map-layout,
    .listings-layout-two-col {
        height: auto !important;
        min-height: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .listings-layout-two-col .listings-cards-overlay {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        height: auto !important;
        box-shadow: none !important;
        overflow: visible !important;
    }
    .listings-layout-two-col .listings-map-container {
        width: 100% !important;
        min-height: 400px !important;
        position: relative !important;
    }
    
    .listings-pagination {
        grid-column: span 1 !important;
    }
    
    .search-location {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        max-width: none;
    }

    .listings-search-actions {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
        gap: 10px;
    }

    .listings-search-actions .reset-btn {
        display: none;
    }

    .filter-dropdowns {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-dropdowns select,
    .filter-btn {
        width: 100%;
    }
    
    /* Advanced filters (More container) - mobile responsive */
    .advanced-filters {
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        left: auto !important;
        right: auto !important;
        position: relative !important; /* Part of page flow */
        top: auto !important;
        bottom: auto !important;
        max-height: none !important;
        border-radius: 4px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
        z-index: 1 !important;
        margin-top: 10px !important;
    }
    
    /* Compact popovers become full-width panels on small screens */
    .filter-dropdowns { position: static; }
    .filter-popover {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin-top: 8px !important;
        box-sizing: border-box;
    }
    
    /* Advanced filters grid - single column on mobile */
    .advanced-filters-grid {
        grid-template-columns: 1fr !important; /* Single column on mobile */
        gap: 16px !important;
    }
    
    .advanced-filters-grid .filter-group:first-child {
        grid-column: 1 !important;
    }
    
    .advanced-filters-grid .filter-group:last-child {
        grid-column: 1 !important;
    }
}

/* Mobile-first fixes for filters and advanced filters */
@media (max-width: 768px) {
    /* Avoid floating overlays; keep single scroll */
    .listings-map-layout {
        height: auto !important;
        min-height: 100vh;
    }

    /* More (advanced) dropdown as full-width panel */
    .advanced-filters {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        overflow-y: visible !important;
        background: #fff !important;
        padding: 16px !important;
        border-radius: 4px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
        z-index: 1 !important;
        margin-top: 10px !important;
    }

    .filter-dropdowns {
        width: 100% !important;
        gap: 10px !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .filter-popover {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        left: 0 !important;
        right: 0 !important;
        margin-top: 10px !important;
        margin-bottom: 10px !important;
        box-sizing: border-box;
        flex-basis: 100% !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .filter-popover-content {
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        padding: 12px;
        border-radius: 6px;
        background: #fff;
    }

    .advanced-filters-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .search-location input[type="text"] {
        width: 100% !important;
    }
}

@media (min-width: 769px) {
    /* Hide mobile toggle on desktop */
    .mobile-view-toggle {
        display: none !important;
    }
    
    /* Always show both on desktop */
    .listings-cards-overlay {
        display: block !important;
    }
    
    .listings-map-container {
        display: flex !important;
    }
    .listings-map-layout {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* Tablet-specific adjustments (landscape/portrait) */
@media (min-width: 769px) and (max-width: 1024px)  {
    /* Keep advanced filters as a dropdown, not a full overlay */
    .advanced-filters {
        position: absolute !important;
        top: calc(100% + 8px) !important;
        left: 0 !important;
        right: auto !important;
        width: auto !important;
        max-width: 520px !important;
        max-height: 70vh !important;
        padding: 16px !important;
        border-radius: 6px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
        margin-top: 0 !important;
        background: #fff !important;
    }

    .listings-cards-overlay {
        max-width: 48%;
        min-width: 380px;
    }

    /* Let the layout breathe on tablets to avoid content being clipped */
    .listings-map-layout {
        display: flex !important;
        flex-direction: column !important;
    }
}
@media (min-width: 1025px) and (max-width: 1280px) {
    .search-location {
        flex: 1 1 360px;
        min-width: 300px;
    }
    .listings-map-layout {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* Custom Map Marker Icons */
.custom-marker-icon {
    background: transparent !important;
    border: none !important;
}

.custom-marker-icon div {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 3px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Ensure marker cluster icons don't interfere */
.leaflet-marker-icon {
    background: transparent !important;
}

/* Search Visible Area Button */
.search-visible-area-control {
    margin-top: 10px;
    margin-right: 10px;
    z-index: 1000;
    position: relative;
    pointer-events: auto;
}

.search-visible-area-btn {
    background: #0073aa;
    color: white !important;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background 0.2s;
    pointer-events: auto;
    z-index: 1001;
    position: relative;
    display: block;
    width: 100%;
}

.search-visible-area-btn:hover {
    background: #005a87;
    color: white !important;
}

.search-visible-area-btn:disabled {
    background: #999;
    cursor: not-allowed;
    opacity: 0.7;
    pointer-events: none;
}

.search-visible-area-btn:active {
    color: white !important;
}

/* Active filter tag */
.active-filter-tag {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin: 5px 5px 0 0;
}

/* Map Legend */
.map-legend {
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 12px;
}

.map-legend-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-legend-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 13px;
    color: #333;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-pin {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.legend-pin-condo {
    background-color: #E4C780;
}

.legend-pin-rental {
    background-color: #E86962;
}

/* Inline legend for top-right placement */
.inline-legend {
    box-shadow: none;
    background: rgba(255,255,255,0.9);
    padding: 8px 10px;
}

.map-legend-content.inline {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.map-legend-title {
    margin: 0;
}

/* Arrange legend and zoom side by side in the top-right */
.leaflet-top.leaflet-right {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    padding-right: 8px;
    padding-top: 8px;
}

.leaflet-top.leaflet-right .leaflet-control-zoom {
    order: 2;
}

.leaflet-top.leaflet-right .map-legend {
    order: 1;
}

.legend-label {
    color: #333;
    font-size: 12px;
}

/* Marker Cluster Styling */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    z-index: 1000 !important;
    visibility: visible !important;
    display: block !important;
}

.marker-cluster-small div {
    background-color: rgba(110, 204, 57) !important;
    z-index: 1000 !important;
    visibility: visible !important;
}

.marker-cluster-medium div {
    background-color: rgba(110, 204, 57) !important;
    z-index: 1000 !important;
    visibility: visible !important;
}

.marker-cluster-large div {
    background-color: #78c453 !important;
    z-index: 1000 !important;
    visibility: visible !important;
}

/* Active listing card state */
.listing-card.active {
    border: 2px solid #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2);
}

/* Active marker state */
.marker-active {
    z-index: 1000 !important;
}

.marker-active div,
.marker-active-inner {
    transform: scale(1.3) rotate(-45deg) !important;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.4), 0 0 0 6px rgba(255, 255, 255, 0.8) !important;
    border: 3px solid #0073aa !important;
    border-width: 4px !important;
}

/* Listing card options/more info */
.listing-card-options {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.listing-card-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.listing-card-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

/* Single Listing Map - Links Control */
.single-map-links-control {
    margin-top: 10px;
    margin-right: 10px;
    display: flex;
    flex-direction: row; /* Side by side */
    gap: 8px;
    z-index: 1000;
    position: relative;
    pointer-events: auto;
}

.single-map-link-btn {
    display: inline-block;
    background: #0073aa;
    color: white !important;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background 0.2s;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: auto;
    z-index: 1001;
    position: relative;
    border: none;
}

.single-map-link-btn:hover {
    background: #005a87;
    color: white !important;
    text-decoration: none;
}

.single-map-link-btn:visited {
    color: white !important;
}

.single-map-link-btn:active {
    color: white !important;
}

/* Single listing map container */
#listing-single-map {
    cursor: default !important;
}

#listing-single-map.leaflet-container {
    cursor: default !important;
}

/* Available Units Heading */
.available-heading {
    color: rgba(255, 255, 255, 1) !important;
    text-align: center;
    background-color: rgba(47, 123, 155, 1) !important;
    border-top-right-radius: 0;
    border-bottom-left-radius: 0;
    padding: 16px 20px 16px 20px !important;
    text-transform: uppercase !important;
}

/* Availability Table Styling */
.maloney-availability-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
}

/* # Beds column - no padding for tbody td */
.maloney-availability-table tbody td.availability-beds {
    padding: 0 !important;
    text-align: left;
}

/* Middle 4 columns - center aligned */
.maloney-availability-table tbody td:nth-child(2),
.maloney-availability-table tbody td:nth-child(3),
.maloney-availability-table tbody td:nth-child(4),
.maloney-availability-table tbody td:nth-child(5) {
    text-align: center;
}

/* Accessible Units - left aligned, 14px font */
.maloney-availability-table tbody td.availability-accessible {
    font-size: 14px;
    text-align: left;
}

/* Mobile: Stack tables vertically, each row becomes its own card with two-column layout */
@media (max-width: 768px) {
    .maloney-listing-availability-block {
        padding: 0 !important;
        margin: 20px 0 !important;
    }
    
    .maloney-availability-table {
        display: block;
        width: 100%;
        border: none;
        background: transparent;
    }
    
    .maloney-availability-table thead {
        display: none;
    }
    
    .maloney-availability-table tbody {
        display: block;
    }
    
    /* Alternate row background colors */
    .maloney-availability-table tbody tr {
        display: block;
        width: 100%;
        margin-bottom: 20px;
        padding: 15px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background: #ffffff;
    }
    
    .maloney-availability-table tbody tr:nth-child(even) {
        background: #f9f9f9;
    }
    
    .maloney-availability-table tbody tr:last-child {
        margin-bottom: 0;
    }
    
    /* # Beds as heading */
    .maloney-availability-table tbody td.availability-beds {
        display: block;
        font-weight: 600;
        font-size: 16px;
        padding: 0 0 12px 0 !important;
        margin-bottom: 12px;
        border-bottom: 1px solid #eee;
        text-align: left;
    }
    
    /* All other cells as label:value pairs using grid for better alignment */
    .maloney-availability-table tbody td:not(.availability-beds) {
        display: grid;
        grid-template-columns: 160px 1fr;
        gap: 10px;
        padding: 8px 0 !important;
        border: none;
        font-size: 14px;
        align-items: start;
    }
    
    .maloney-availability-table tbody td:not(.availability-beds)::before {
        content: attr(data-label);
        font-weight: 600;
        color: #333;
        text-align: left;
        background-color: #f0f0f0;
        padding: 6px 10px;
        border-radius: 3px;
    }
    
    /* Center align values for middle 4 columns */
    .maloney-availability-table tbody td:nth-child(2) .availability-value,
    .maloney-availability-table tbody td:nth-child(3) .availability-value,
    .maloney-availability-table tbody td:nth-child(4) .availability-value,
    .maloney-availability-table tbody td:nth-child(5) .availability-value {
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Accessible units - left aligned, 14px font */
    .maloney-availability-table tbody td.availability-accessible {
        font-size: 14px !important;
    }
    
    .maloney-availability-table tbody td.availability-accessible .availability-value {
        text-align: left !important;
        display: flex;
        align-items: flex-start;
    }
}

/* Map vs List display toggle (filter bar, right side) */
.listings-display-options {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.listings-display-options__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #666;
    line-height: 1;
}

.listings-display-toggle {
    display: inline-flex;
    gap: 0;
    margin: 0;
    border: 1px solid #c8ccd4;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.listings-display-toggle__btn {
    margin: 0;
    padding: 0 18px;
    border: 0;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #222;
    line-height: 1.2;
    border-radius: 0;
    height: 44px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.listings-display-toggle__btn + .listings-display-toggle__btn {
    border-left: 1px solid #c8ccd4;
}

.listings-display-toggle__btn.active {
    background: #1a7f7a;
    color: #fff;
}

.listings-display-toggle__btn:focus-visible {
    outline: 2px solid #1a7f7a;
    outline-offset: 2px;
}

.listings-units-panel {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.listings-units-panel__scroll {
    flex: 1;
    overflow: visible;
    padding: 0 4px 12px;
}

/* Scroll-shadow indicator — a dark gradient hugs whichever edge can still scroll.
   @property registers the opacity vars as <number> so the shadows fade smoothly.
   JS (updateUnitsTableScrollFade) sets each to 1 (can scroll that way) or 0. */
@property --ml-shadow-left {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
}

@property --ml-shadow-right {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
}

.ml-units-table-viewport {
    position: relative;
    --ml-shadow-left: 0;
    --ml-shadow-right: 0;
    /* the viewport's own width drives the card-stack container query below */
    container-type: inline-size;
    container-name: mlunits;
}

.ml-units-table-viewport::before,
.ml-units-table-viewport::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    z-index: 3;
    transition: opacity 0.2s ease;
}

.ml-units-table-viewport::before {
    left: 0;
    opacity: var(--ml-shadow-left);
    background: linear-gradient(to right, rgba(15, 30, 40, 0.20), rgba(15, 30, 40, 0));
}

.ml-units-table-viewport::after {
    right: 0;
    opacity: var(--ml-shadow-right);
    background: linear-gradient(to left, rgba(15, 30, 40, 0.20), rgba(15, 30, 40, 0));
}

.ml-units-table-scroll {
    /* visible (not auto) so the sticky <thead> sticks to the PAGE as it scrolls,
       rather than being trapped in an inner scroll box. The fixed-layout table is
       always 100% wide, so there is nothing to scroll horizontally anyway. */
    overflow: visible;
    border-radius: 8px;
}

.ml-units-table-scroll:focus-visible {
    outline: 2px solid #1a7f7a;
    outline-offset: 2px;
}

.ml-units-table-scroll::-webkit-scrollbar {
    height: 6px;
}

.ml-units-table-scroll::-webkit-scrollbar-thumb {
    background: #c5ccd6;
    border-radius: 999px;
}

.ml-units-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 15px;
    line-height: 1.5;
    background: #fff !important;
    border: 1px solid #dde1e8 !important;
    border-radius: 0;
    margin: 0 !important;
    table-layout: fixed;
}

.ml-units-table__col--property { width: 18%; }
.ml-units-table__col--town { width: 11%; }
.ml-units-table__col--area { width: 8%; }
.ml-units-table__col--size { width: 10%; }
.ml-units-table__col--price { width: 11%; }
.ml-units-table__col--minincome { width: 11%; }
.ml-units-table__col--income { width: 9%; }
.ml-units-table__col--availability { width: 13%; }
.ml-units-table__col--units { width: 9%; }

.ml-units-table th,
.ml-units-table td {
    padding: 16px 18px !important;
    border: 0 !important;
    border-bottom: 1px solid #eef1f5 !important;
    text-align: left !important;
    vertical-align: middle !important;
}

.ml-units-table tbody tr:last-child td {
    border-bottom: 0;
}

.ml-units-table tbody tr {
    transition: background 0.12s ease;
}

.ml-units-table tbody tr {
    background: #fff !important;
}

.ml-units-table tbody tr:nth-child(even) {
    background: #fafbfc !important;
}

.ml-units-table tbody tr:hover {
    background: #f3faf9 !important;
}

/* Property cell — badge + name + town folded into one column */
.ml-units-table__prop {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ml-units-table__prop-top {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.ml-units-table__prop-name {
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* Accessibility (wheelchair) icon next to the property name */
.ml-units-table__ada {
    display: inline-flex;
    align-items: center;
    color: #1a7f7a;
    flex: none;
    cursor: help;
}
.ml-units-table__ada svg {
    width: 17px;
    height: 17px;
}
.ml-units-table .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Phone: collapsible cards. Tablet/desktop: table. */
.ml-units-mobile-list {
    display: none;
}

@media (max-width: 600px) {
    .ml-units-table-scroll {
        display: none !important;
    }

    .ml-units-mobile-list {
        display: block;
        padding: 0 8px 12px;
    }
}

@media (min-width: 601px) {
    .ml-units-mobile-list {
        display: none !important;
    }
}

/* Tablet horizontal-scroll "more →" arrow (hidden except on the tablet tier) */
.ml-units-table__scroll-hint {
    display: none;
}

.ml-units-table__prop-town {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #6b7682;
}

.ml-units-table__prop-town svg {
    width: 12px;
    height: 12px;
    opacity: 0.65;
    flex: none;
}

.ml-units-table__size {
    font-weight: 600;
}

/* Availability status dot */
.ml-units-table__avail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}

.ml-units-table__avail::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2bb673;
    flex: none;
}

.ml-units-table__avail--lottery::before {
    background: #e0a106;
}

.ml-units-table__avail--waitlist::before {
    background: #9aa4af;
}

/* Download CSV toolbar above the units table */
.listings-units-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}
.ml-units-export-btn {
    flex-shrink: 0;
}

/* "N units available" tag — matches the green badge on the map cards */
.ml-units-table__avail-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 5px;
    background: rgba(110, 204, 57, 1);
    color: #fff;
    white-space: nowrap;
}

.ml-units-table__avail-tag strong {
    font-weight: 800;
}

/* Expand toggle for a property's per-unit detail */
.ml-units-table__expand {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin: 6px 0 0 !important;
    padding: 2px 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    color: #1a7f7a !important;
    font-family: inherit;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    cursor: pointer;
    width: auto !important;
    text-transform: none !important;
}

.ml-units-table__expand:hover .ml-units-table__expand-label {
    text-decoration: underline;
}

.ml-units-table__expand-icon {
    width: 0;
    height: 0;
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
}

.ml-units-table__expand[aria-expanded="true"] .ml-units-table__expand-icon {
    transform: rotate(90deg);
}

.ml-units-table__expand:focus-visible {
    outline: 2px solid #1a7f7a !important;
    outline-offset: 2px;
    border-radius: 3px;
}

/* Per-unit detail row + sub-table.
   All selectors are scoped under .ml-units-table__detail-row so they out-rank
   (and reset) the main table's descendant rules — .ml-units-table thead th /
   tbody td / tbody tr would otherwise leak into this nested table (wrong
   padding, sticky header, zebra, gray header bg). */
.ml-units-table__detail-row > td {
    padding: 0 !important;
    background: #f7f9fb !important;
    border-bottom: 1px solid #e3e7ec !important;
}

.ml-units-detail-wrap {
    padding: 12px 16px 16px;
    overflow-x: auto;
}

.ml-units-table__detail-row .ml-units-detail {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    border: 1px solid #e3e7ec !important;
    border-radius: 8px;
    font-size: 12.5px;
    table-layout: auto !important;
}

.ml-units-table__detail-row .ml-units-detail th,
.ml-units-table__detail-row .ml-units-detail td {
    position: static !important;
    padding: 8px 12px !important;
    text-align: left !important;
    vertical-align: middle !important;
    border: 0 !important;
    border-bottom: 1px solid #eef1f5 !important;
    white-space: nowrap;
}

.ml-units-table__detail-row .ml-units-detail thead th {
    position: static !important;
    top: auto !important;
    z-index: auto !important;
    background: #eef2f6 !important;
    font-size: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em;
    font-weight: 700 !important;
    color: #5a6672 !important;
}

.ml-units-table__detail-row .ml-units-detail tbody tr,
.ml-units-table__detail-row .ml-units-detail tbody tr:hover {
    background: #fff !important;
}

.ml-units-table__detail-row .ml-units-detail tbody tr:nth-child(even) {
    background: #fafbfc !important;
}

.ml-units-table__detail-row .ml-units-detail tbody tr:last-child td {
    border-bottom: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
    .ml-units-table__expand-icon {
        transition: none !important;
    }
}

.ml-units-table thead th {
    /* opaque background so rows scrolling underneath the stuck header are hidden.
       !important throughout to beat the theme's (Divi) generic table-header styles. */
    background: #f6f8fa !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em;
    font-weight: 700 !important;
    color: #5a6672 !important;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e3e7ec !important;
    white-space: normal;
}

/* List view: keep column headers visible while scrolling (page scroll). */
.ml-display-mode-list {
    --ml-units-thead-top: 0px;
}

@media (min-width: 769px) {
    .ml-display-mode-list {
        --ml-units-thead-top: 90px; /* matches .full-width-map sticky offset */
    }

    body.admin-bar .ml-display-mode-list {
        --ml-units-thead-top: 122px;
    }
}

/* Tablet horizontal-scroll table: header sticks to the scroll container, not the page nav. */
@media (min-width: 601px) and (max-width: 1024px) {
    .ml-display-mode-list {
        --ml-units-thead-top: 0px;
    }

    .ml-display-mode-list .ml-units-table thead th {
        top: 0 !important;
    }
}

.ml-display-mode-list .ml-units-table thead th {
    top: var(--ml-units-thead-top, 0px);
    z-index: 15;
    box-shadow: 0 1px 0 #e3e7ec;
}

/* Sortable column headers — button reset (beats Divi's generic button styles) */
.ml-units-table__sort {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em;
    color: #5a6672 !important;
    cursor: pointer;
    line-height: 1.2 !important;
    text-align: left;
    width: auto !important;
}

.ml-units-table__sort:hover,
.ml-units-table__sort.is-active {
    color: #1a7f7a !important;
}

.ml-units-table__sort-arrow {
    font-size: 11px;
    line-height: 1;
    opacity: 0.45;
}

.ml-units-table__sort.is-active .ml-units-table__sort-arrow {
    opacity: 1;
}

/* Accessibility: visible keyboard focus rings */
.ml-units-table__sort:focus-visible,
.ml-units-table a.ml-units-table__cta:focus-visible,
.ml-units-table a:not(.ml-units-table__cta):focus-visible,
.ml-units-table-scroll:focus-visible {
    outline: 2px solid #1a7f7a !important;
    outline-offset: 2px;
    border-radius: 3px;
}

/* Visually-hidden table caption — announced to screen readers, not shown */
.ml-units-table__caption {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .ml-units-table tbody tr,
    .ml-units-table a.ml-units-table__cta,
    .ml-units-table-viewport::before,
    .ml-units-table-viewport::after {
        transition: none !important;
    }
}

/* All data columns wrap their content (fixed table layout constrains the width). */
.ml-units-table__cell--size,
.ml-units-table__cell--town,
.ml-units-table__cell--area,
.ml-units-table__cell--minincome,
.ml-units-table__cell--income,
.ml-units-table__cell--availability,
.ml-units-table__cell--units,
.ml-units-table__cell--price,
.ml-units-table__cell--property {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.ml-units-table__units {
    display: block;
    font-weight: 700;
    color: #1f2a33;
    line-height: 1.5;
}

.ml-units-table__cell--cta {
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.ml-units-table__price-value {
    display: block;
    font-weight: 800;
    font-size: 15px;
    color: #1f2a33;
}

.ml-units-table__kind {
    display: inline-flex;
    align-items: center;
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 5px;
    background: #e3f4f2;
    color: #0f6b65;
}

.ml-units-table__kind--condo {
    background: #fdf1dd;
    color: #8a5a00;
}

/* "Featured" tag — explains why these rows are pinned to the top */
.ml-units-table__featured {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 5px;
    background: #fff2cc;
    color: #7a5600;
    border: 1px solid #f0d384;
    white-space: nowrap;
}

.ml-units-table__featured-star {
    color: #e0a106;
    font-size: 11px;
    line-height: 1;
}

/* subtle highlight on featured rows / cards */
.ml-units-table tbody tr.is-featured td,
.ml-units-table tbody tr.is-featured:nth-child(even) td {
    background: #fffdf4;
}
.ml-units-table tbody tr.is-featured:hover td {
    background: #fff8e6;
}
.ml-units-card.is-featured {
    border-color: #f0d384;
    background: #fffdf4;
}

.ml-units-table__price-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7682;
}

.ml-units-table a.ml-units-table__cta,
.ml-units-table a.ml-units-table__cta:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    color: #fff !important;
    background: #1a7f7a;
    border-radius: 8px;
    /* wrap (don't clip) when the fixed CTA column gets tight at narrow widths */
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    max-width: 100%;
    box-sizing: border-box;
    transition: background 0.12s ease;
}

.ml-units-table a.ml-units-table__cta:hover,
.ml-units-table a.ml-units-table__cta:focus {
    background: #14635f;
    color: #fff !important;
    text-decoration: none !important;
}

/* Property name is the link — underlined so it reads as clickable. */
.ml-units-table a:not(.ml-units-table__cta) {
    color: #1a7f7a;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ml-units-table a:not(.ml-units-table__cta):hover,
.ml-units-table a:not(.ml-units-table__cta):focus {
    color: #14635f;
    text-decoration: underline;
}

.ml-units-empty {
    padding: 24px 16px;
    text-align: center;
    color: #555;
}

.listings-units-pagination {
    flex-shrink: 0;
    padding: 8px;
}

.ml-display-mode-list .listings-cards-scroll#listings-grid {
    display: none !important;
}

.ml-display-mode-list .listings-featured-strip {
    display: block;
    flex-shrink: 0;
    padding: 0 12px 12px;
    border-bottom: 1px solid #e8eaed;
}

.ml-display-mode-list .listings-featured-strip[hidden] {
    display: none !important;
}

.listings-featured-strip__heading {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.listings-featured-strip__cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
}

.ml-display-mode-map .listings-featured-strip {
    display: none !important;
}

.ml-display-mode-list .listings-units-panel {
    display: flex !important;
}

.ml-display-mode-map .listings-units-panel {
    display: none !important;
}

.ml-display-mode-list .mobile-view-toggle {
    display: none !important;
}

/* List mode: full-width table — no map */
.ml-display-mode-list #listings-map,
.ml-display-mode-list .full-width-map {
    display: none !important;
}

.ml-display-mode-list.listings-map-layout {
    overflow: visible !important;
}

.ml-display-mode-list .listings-map-container {
    min-height: auto;
    height: auto;
    flex-direction: column;
    overflow: visible !important;
}

.ml-display-mode-list .listings-cards-overlay {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: none !important;
    box-shadow: none !important;
    /* visible (map mode sets overflow: scroll) so the table's sticky header is
       not trapped in this box and instead sticks to the page as it scrolls. */
    overflow: visible !important;
}

/* Ensure nothing between the overlay and the table clips the sticky header. */
.ml-display-mode-list .listings-units-panel,
.ml-display-mode-list .listings-units-panel__scroll,
.ml-display-mode-list .ml-units-table-viewport,
.ml-display-mode-list .ml-units-table-scroll {
    overflow: visible !important;
}

.ml-display-mode-list .listings-units-panel__scroll {
    max-height: none;
    flex: 1;
}

/* Contained, centered layout for List view — the table is NOT edge-to-edge;
   it sits in a centered column with a card around it (matches the design mockup). */
.ml-display-mode-list .listings-units-panel {
    width: 100%;
    max-width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
    box-sizing: border-box;
    padding: 12px 16px;
}

.ml-display-mode-list .listings-units-pagination {
    width: 100%;
    max-width: min(1440px, calc(100% - 32px));
    margin: 0 auto;
}

@media (min-width: 769px) {
    .ml-display-mode-list .listings-map-container {
        display: block;
    }

    .ml-display-mode-list .listings-cards-overlay {
        min-height: calc(100vh - 220px);
    }

    /* White rounded card around the table on desktop (flat on mobile cards). */
    .ml-display-mode-list .listings-units-panel__scroll {
        background: #fff;
        border: 0;
        border-radius: 14px;
        box-shadow: 0 6px 24px rgba(20, 40, 55, 0.06);
        padding: 0;
    }
}

@media (max-width: 768px) {
    .listings-search-container {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }

    .listings-display-options {
        flex: 1 1 auto;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        margin-left: 0;
    }

    .listings-display-toggle {
        width: auto;
        flex-shrink: 0;
    }

    .listings-display-toggle__btn {
        flex: 1;
        text-align: center;
    }

    .ml-display-mode-list .listings-map-container {
        width: 100% !important;
    }

    .ml-display-mode-list .listings-units-panel,
    .ml-display-mode-list .listings-units-panel__scroll,
    .ml-display-mode-list .ml-units-table-viewport,
    .ml-display-mode-list .ml-units-table-scroll {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .ml-units-table-scroll {
        padding: 0 12px 12px;
    }
}

/* ---------------------------------------------------------------------------
   Tablet (601–1024px): horizontal-scroll table. The 9 columns don't squish —
   the table scrolls sideways with the Property column frozen on the left, and
   the edge scroll-shadow signals there's more. Phones use the cards below.
   --------------------------------------------------------------------------- */
@media (min-width: 601px) and (max-width: 1024px) {
    .ml-display-mode-list .ml-units-table-scroll {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
    }

    .ml-units-table {
        width: max-content !important;
        min-width: 100% !important;
        table-layout: auto;
    }

    /* readable minimum column widths (table-layout is auto here) */
    .ml-units-table thead th:nth-child(1) { min-width: 190px; }
    .ml-units-table thead th:nth-child(2) { min-width: 130px; }
    .ml-units-table thead th:nth-child(3) { min-width: 90px; }
    .ml-units-table thead th:nth-child(4) { min-width: 110px; }
    .ml-units-table thead th:nth-child(5) { min-width: 110px; }
    .ml-units-table thead th:nth-child(6) { min-width: 120px; }
    .ml-units-table thead th:nth-child(7) { min-width: 100px; }
    .ml-units-table thead th:nth-child(8) { min-width: 150px; }
    .ml-units-table thead th:nth-child(9) { min-width: 80px; }

    /* freeze the Property column while the rest scrolls sideways */
    .ml-units-table th:first-child,
    .ml-units-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 3;
        background: #fff;
        box-sizing: border-box;
        width: 190px;
        min-width: 190px;
        max-width: 190px;
        overflow: hidden;
        box-shadow: 4px 0 8px -4px rgba(20, 40, 55, 0.22);
    }
    .ml-units-table tbody tr:nth-child(even) td:first-child {
        background: #fafbfc;
    }
    .ml-units-table tbody tr:hover td:first-child {
        background: #f3faf9;
    }
    /* frozen header corner must sit above the other sticky headers (z-index 15) */
    .ml-units-table thead th:first-child {
        z-index: 20;
        background: #f6f8fa !important;
    }

    .ml-units-table td:not(:first-child) {
        position: relative;
        z-index: 0;
    }

    /* "more →" arrow — near the top-right of the table, over the first rows;
       fades out (via --ml-shadow-right, set by the scroll JS) at the end. */
    .ml-units-table__scroll-hint {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 62px;
        right: 12px;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: #1a7f7a;
        color: #fff;
        font-size: 17px;
        font-weight: 700;
        box-shadow: 0 2px 8px rgba(20, 40, 55, 0.28);
        opacity: var(--ml-shadow-right, 0);
        transition: opacity 0.2s ease;
        pointer-events: none;
        z-index: 100;
    }

    .ml-units-table__scroll-hint.is-visible {
        opacity: 1;
        visibility: visible;
    }
}

/* ---------------------------------------------------------------------------
   Mobile (≤600px): collapsible list (one compact line per unit; tap to expand).
   Matches table-mobile-mockup.html "Collapsible list" mode.
   --------------------------------------------------------------------------- */
@media (max-width: 600px) {
    .ml-units-mobile-list {
        padding: 0 8px 12px;
    }

    .ml-units-card {
        background: #fff;
        border: 1px solid #e3e7ec;
        border-radius: 12px;
        margin: 0 0 8px;
        overflow: hidden;
        box-shadow: 0 1px 5px rgba(20, 40, 55, 0.05);
    }

    .ml-units-card__sum {
        display: grid;
        grid-template-columns: 1fr auto auto;
        align-items: center;
        gap: 10px;
        padding: 11px 12px;
        cursor: pointer;
    }

    .ml-units-card__toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 32px;
        min-height: 32px;
        padding: 0;
        background: none;
        border: 0;
        cursor: pointer;
        flex: none;
    }

    .ml-units-card__toggle:focus-visible {
        outline: 3px solid #10394a;
        outline-offset: 2px;
    }

    .ml-units-card__main {
        min-width: 0;
    }

    .ml-units-card__top {
        display: flex;
        align-items: center;
        gap: 7px;
        flex-wrap: wrap;
    }

    .ml-units-card__name {
        font-weight: 700;
        font-size: 15px;
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
        margin-top: 5px;
    }

    .ml-units-card__name a {
        color: #1a7f7a;
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .ml-units-card__town {
        display: block;
        font-size: 12px;
        color: #6b7682;
        margin-top: 2px;
    }

    /* Unit size sits above the price in the right column */
    .ml-units-card__size {
        display: block;
        margin-bottom: 10px;
        font-size: 12.5px;
        font-weight: 700;
        color: #1f2a33;
        white-space: normal;
        line-height: 1.25;
    }

    /* Download CSV button aligned + same width as the cards */
    .listings-units-toolbar {
        padding: 0 12px;
        margin-bottom: 10px;
    }
    .ml-units-export-btn {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .ml-units-card__price {
        font-weight: 800;
        font-size: 15px;
        white-space: nowrap;
        text-align: right;
        line-height: 1.2;
    }

    .ml-units-card__price small {
        display: block;
        font-size: 9px;
        font-weight: 700;
        text-transform: uppercase;
        color: #6b7682;
        letter-spacing: 0.04em;
    }

    .ml-units-card__chev {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        color: #6b7682;
        flex: none;
    }

    .ml-units-card__chev svg {
        width: 16px;
        height: 16px;
        transition: transform 0.15s ease;
    }

    .ml-units-card.is-open .ml-units-card__chev svg {
        transform: rotate(180deg);
    }

    .ml-units-card__detail {
        border-top: 1px solid #eef1f5;
        padding: 6px 12px 12px;
    }

    .ml-units-card__fields {
        display: grid;
        grid-template-columns: 128px 1fr;
        gap: 6px 12px;
        margin: 8px 0 0;
        font-size: 13px;
    }

    .ml-units-card__fields dt {
        color: #6b7682;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        align-self: center;
        margin: 0;
    }

    .ml-units-card__fields dd {
        margin: 0;
    }

    .ml-units-card__cta {
        display: inline-block;
        margin-top: 12px;
        background: #1a7f7a;
        color: #fff !important;
        font-weight: 700;
        font-size: 13px;
        padding: 9px 16px;
        border-radius: 8px;
        text-decoration: none !important;
    }

    .ml-units-card__cta:hover,
    .ml-units-card__cta:focus {
        background: #14635f;
        color: #fff !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ml-units-card__chev svg { transition: none !important; }
}

/* Visually hidden labels for plugin-owned controls (themes may not ship this class). */
.search-location .screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Keyboard-highlighted location suggestion (aria-activedescendant target). */
.location-suggestion.is-active,
.location-suggestion:hover {
    background: #eef3f6;
}

#search_location_input:focus-visible,
#search_location_btn:focus-visible,
.filter-btn:focus-visible,
.filter-modal-btn:focus-visible,
.listings-display-toggle__btn:focus-visible {
    outline: 3px solid #10394a;
    outline-offset: 2px;
}

/* Listing page: jump to application + nested income/FAQ */
body.maloney-listing-single #contact,
body.maloney-listing-single #listing-apply {
    scroll-margin-top: calc(var(--ml-sticky-top, 90px) + 12px);
}

.ml-listing-apply-jump-wrap {
    margin: 16px 0 8px;
}

.ml-listing-apply-jump {
    display: inline-block;
    background: #c0504a;
    color: #fff !important;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none !important;
    padding: 14px 22px;
    border-radius: 0 30px 0 30px;
    line-height: 1.2;
}

.ml-listing-apply-jump:hover,
.ml-listing-apply-jump:focus {
    background: #a63f3a;
    color: #fff !important;
}

.ml-listing-apply-jump:focus-visible {
    outline: 3px solid #10394a;
    outline-offset: 2px;
}

.ml-listing-nest {
    margin: 28px 0 16px;
    border: 0;
}

.ml-listing-nest__summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: #2d4e5d;
    color: #fff;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ml-listing-nest__summary::-webkit-details-marker {
    display: none;
}

.ml-listing-nest__summary:focus-visible {
    outline: 3px solid #10394a;
    outline-offset: 2px;
}

.ml-listing-nest__title {
    flex: 1 1 auto;
}

.ml-listing-nest__chev {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
    margin-top: -4px;
    transition: transform 0.15s ease;
}

.ml-listing-nest[open] .ml-listing-nest__chev {
    transform: rotate(225deg);
    margin-top: 4px;
}

.ml-listing-nest__body {
    padding: 8px 0 0;
}

.ml-listing-nest__body > h3.tb-heading,
.ml-listing-nest__body > .table_title,
.ml-listing-nest__body .footable_title {
    display: none;
}

.listing-single .vacancy-notification-form {
    display: none !important;
}

@media (max-width: 768px) {
    .ml-listing-apply-jump-wrap {
        position: sticky;
        top: var(--ml-sticky-top, 80px);
        z-index: 20;
        margin: 8px 0 12px;
        padding: 8px 0 10px;
        background: #fff;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    }

    .ml-listing-apply-jump-wrap.is-apply-visible {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }

    .ml-listing-apply-jump {
        display: block;
        text-align: center;
        width: 100%;
        box-sizing: border-box;
        padding: 16px 20px;
        font-size: 14px;
    }

    .ml-listing-nest {
        margin: 20px 0 12px;
    }

    .ml-listing-nest__summary {
        font-size: 14px;
        padding: 14px 16px;
    }

    .ml-listing-nest:not([open]) .ml-listing-nest__body {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ml-listing-nest__chev {
        transition: none;
    }
}

/* Tighten Toolset section spacing on listing pages (templates use 100px heading margins). */
body.maloney-listing-single .listing-content h3.tb-heading,
body.maloney-listing-single .listing-content h3.tb-heading[class] {
    margin-top: 28px !important;
    margin-bottom: 12px !important;
}

/* Content-template section bars ship white text on rgb(180,191,197) — 1.88:1.
   Match the accordion bar so every section heading clears WCAG AA (4.5:1). */
body.maloney-listing-single .listing-content h3.tb-heading.has-background,
body.maloney-listing-single .listing-content h3.tb-heading.has-background[class],
body.maloney-listing-single .listing-content h2.tb-heading.has-background,
body.maloney-listing-single .listing-content h2.tb-heading.has-background[class],
body.maloney-listing-single .listing-content h3.available-heading,
body.maloney-listing-single .listing-content h3.available-heading[class] {
    background-color: #2d4e5d !important;
    color: #fff !important;
}

body.maloney-listing-single .listing-content h3.tb-heading.has-background a,
body.maloney-listing-single .listing-content h3.tb-heading.has-background strong,
body.maloney-listing-single .listing-content h3.available-heading strong {
    color: #fff !important;
}

body.maloney-listing-single .listing-content .listing-map,
body.maloney-listing-single .listing-content .listing-map.leaflet-container {
    margin-top: 8px !important;
    margin-bottom: 12px !important;
}

body.maloney-listing-single .listing-content .tb-fields-and-text:empty,
body.maloney-listing-single .listing-content .ml-is-empty,
body.maloney-listing-single .listing-content > p:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
}

body.maloney-listing-single .ml-listing-nest {
    margin-top: 16px;
    margin-bottom: 8px;
}

body.maloney-listing-single .ml-listing-nest + .ml-listing-nest {
    margin-top: 8px;
}

body.maloney-listing-single .ml-listing-nest:not([open]) {
    overflow: hidden;
}

body.maloney-listing-single .ml-listing-nest:not([open]) .ml-listing-nest__body {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
}

body.maloney-listing-single .ml-listing-nest__body > h3.tb-heading {
    margin: 0 !important;
}

@media (max-width: 980px) {
    body.maloney-listing-single .listing-content h3.tb-heading,
    body.maloney-listing-single .listing-content h3.tb-heading[class] {
        margin-top: 20px !important;
        margin-bottom: 8px !important;
    }
}

