/**
 * Listing Directory Component - Listings Style
 * Copyright (C) 2025 Vision Technology Consulting. All rights reserved.
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --font-family-poppins: 'Poppins', sans-serif;
    --font-family-opensans: 'Open Sans', sans-serif;
    --font-family-inter: 'Inter', sans-serif;
}

/* Listings Container */
.com-listingdirectory.listings-view {
    padding: 20px 0;
    max-width: 1440px;
    margin: 0 auto;
}

.com-listingdirectory .page-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

/* Main container row - responsive breakpoints */
.com-listingdirectory.listings-view > .row {
    margin: 0;
}

/* Listings content area with proper widths */
.com-listingdirectory .col-lg-9.col-md-8 {
    max-width: 100%;
}

/* Active Filters */
.active-filters {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.active-filters h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #495057;
}

/* Filters Sidebar - Legacy styles removed, see line 960+ for current styles */

.listings-filters .min-height-500 {
    min-height: 500px;
}

.listings-filters .card-header {
    background-color: #fff;
    border-bottom: none;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.listings-filters .card-header:hover {
    background-color: #f8f9fa;
}

.listings-filters .card-header h6 {
    margin: 0;
    color: #1E2939;
    font-family: Inter;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: -0.312px;
}

.listings-filters .card-body {
    padding: 15px;
}

/* Applied Filters Box (New Design) */
.applied-filters-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 17px;
    border: 1px solid #232323;
    border-radius: 10px;
    background: #FFF;
    margin-bottom: 20px;
    overflow: hidden;
}

.applied-filters-header h6 {
    margin: 0;
    color: #1E2939;
    font-family: Inter;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px; /* 150% */
    letter-spacing: -0.312px;
}

.filter-badges {
   display: flex;
    padding: var(--spacing-4xs, 2px) var(--sizing-component-xs, 8px);
    align-items: center;
    gap: 2px;
    border-radius: var(--border-radius-sm, 10px);
    background: var(--color-blue-bendera-MY-100, #E9EEF7);
}

.filter-badges .badge {
    background: #C6C6C6;
    display: flex;
    padding: 4px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 4px;
    border: none;
    
    /* Filter text styles */
    color: #1E2939;
    font-family: Inter;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px; /* 150% */
    letter-spacing: -0.312px;
}

.filter-badges .badge .btn-close {
    padding: 0;
    margin-left: 0;
    width: 24px;
    height: 24px;
    aspect-ratio: 1/1;
    background-size: 14px;
    opacity: 1;
    filter: none;
    flex-shrink: 0;
}

.filter-badges .badge .btn-close:hover {
    opacity: 1;
}

/* Old Applied Filters Section - Remove */
.applied-filters-section {
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.applied-filters-section .card-body {
    padding: 15px;
}

.applied-filters-section h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 10px;
}

/* Category Links List */
.category-links-list {
    max-height: 450px;
    overflow-y: auto;
}

.category-links-list::-webkit-scrollbar {
    width: 6px;
}

.category-links-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.category-links-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.category-links-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.category-link-item {
    margin-bottom: 8px;
}

.category-link {
    color: #364153;
    font-family: var(--font-family-inter);
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: -0.312px;
    text-decoration: none;
    display: block;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.category-link:hover {
    color: #212529;
    text-decoration: none;
}

.category-link:active,
.category-link.active {
    color: #0d6efd;
    font-weight: 600;
}

/* Filter Options (Checkboxes) */
.filter-options {
    max-height: 450px;
    overflow-y: auto;
}

.filter-options::-webkit-scrollbar {
    width: 6px;
}

.filter-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-options::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.filter-options::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.filter-options .form-check {
    padding-left: 1.5rem;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
}

.filter-options .form-check-input.state-checkbox,
.filter-options .form-check-input.category-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: #F3F3F5;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 0.15rem;
}

.filter-options .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.filter-options .form-check-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.filter-options .form-check-label {
    color: #364153;
    font-family: var(--font-family-inter);
    font-size: 16px;
    font-style: normal;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: -0.312px;
    cursor: pointer;
    user-select: none;
}

.filter-options .form-check-label:hover {
    color: #212529;
}


/* Clear All Filters Button */
.btn-clear-all-filters {
    border-radius: 10px;
    border: 1px solid #232323 !important;
    background: #FFF;
    background-color: #FFF;
    display: flex;
    height: 36px;
    padding: 8px 16px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    align-self: stretch;
    margin-top: 8px;
    
    /* Text styles */
    color: #0A0A0A;
    font-family: Inter;
    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    line-height: 20px;
    letter-spacing: -0.15px;
}

/* Override Bootstrap hover, focus, and active states */
.btn-clear-all-filters:hover,
.btn-clear-all-filters:focus,
.btn-clear-all-filters:active,
.btn-clear-all-filters:focus-visible {
    background: #FFF;
    background-color: #FFF;
    border: 1px solid #232323 !important;
    color: #0A0A0A;
    box-shadow: none;
}

/* Collapse Icon Animation */
.card-header[data-bs-toggle="collapse"] i {
    transition: transform 0.3s ease;
}

.card-header[data-bs-toggle="collapse"][aria-expanded="false"] i {
    transform: rotate(-90deg);
}

.listings-filters.card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 20px;
}

.listings-filters .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 15px;
}

.listings-filters .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
}

.listings-filters .card-body {
    padding: 20px;
}

.listings-filters .filter-group {
    margin-bottom: 20px;
}

.listings-filters .filter-group:last-child {
    margin-bottom: 0;
}

.listings-filters .form-label {
    font-weight: 600;
    color: #212529;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.listings-filters .form-select {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.listings-filters .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.listings-filters .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 500;
}

.listings-filters .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 500;
}

/* Results Header */
.search-result-header {
    color: #1E2939;
    font-family: var(--font-family-poppins);
    font-size: 24px;
    font-style: normal;
    font-weight: 700;
    line-height: 32px;
    margin-bottom: 16px;
    margin-top: 0px;
}

/* Listings Toolbar with Per Page Dropdown */
.listings-toolbar {
    margin-bottom: 20px;
}

.listings-count {
    display: flex;
    width: 100%;
    max-width: 1001px;
    height: 55px;
    justify-content: space-between;
    align-items: center;
}

.listings-count-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.listings-count-right {
    display: flex;
    align-items: center;
}

.items-found-text {
    color: #1E2939;
    font-family: var(--font-family-opensans);
    font-size: 18px;
    font-style: normal;
    font-weight: 400;
    line-height: 28px;
    letter-spacing: 0;
}

.items-found-text strong {
    font-weight: 400;
    color: #1E2939;
}

.separator {
    color: #1E2939;
    font-size: 18px;
}

.per-page-text {
    color: #4A5565;
    font-family: var(--font-family-inter);
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: -0.312px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-by-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-by-label {
    color: #4A5565;
    font-family: var(--font-family-inter);
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: -0.312px;
}

#perPageSelect {
    display: flex;
    width: auto;
    min-width: 60px;
    padding: 10px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #4A5565;
    font-family: var(--font-family-inter);
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: -0.312px;
    border: 1px solid rgba(0, 0, 0, 0.20);
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

#perPageSelect:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    outline: none;
}

.listings-ordering-controls {
    display: inline-flex;
}

.listings-ordering-controls select {
    display: flex;
    padding: 10px 40px 10px 10px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    color: #4A5565;
    font-family: var(--font-family-inter);
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: -0.312px;
    border: 1px solid rgba(0, 0, 0, 0.20);
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
}

.listings-ordering-controls select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
    outline: none;
}

/* Listings Grid */
.listings-grid {
    margin-top: 0;
    transition: opacity 0.3s ease;
}

/* Loading State */
.ajax-loader {
    padding: 20px;
    text-align: center;
}

.ajax-loader .spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Listing Item Card - Clean Design */
.listing-item {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.listing-item:hover {
    opacity: 0.85;
    text-decoration: none;
}

.listing-item .listing-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    border-radius: var(--border-radius-sm, 10px);
    background: lightgray 50% / cover no-repeat;
    height: 277px;
    flex-shrink: 0;
    align-self: stretch;
    border-radius: var(--border-radius-sm, 10px);
}

.listing-item .listing-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--border-radius-sm, 10px);
}

.listing-item-content {
    padding: 16px 0 0 0;
    display: flex;
    flex-direction: column;
}

.listing-item-title {
    align-self: stretch;
    color: var(--text-headings, #030264);
    /* Body M Sm-bold */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-Body-M, 14px);
    font-style: normal;
    font-weight: 600;
    line-height: var(--line-height-body-M, 22px); /* 157.143% */
    margin: 0;
}

.listing-item-company-name {
    color: var(--text-information, #3A39AE);
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-body-m, 14px);
    font-style: normal;
    font-weight: 600;
    line-height: var(--line-height-body-m, 22px);
    border-radius: var(--border-radius-sm, 10px);
    background: #E7F2FF;
    display: flex;
    padding: var(--spacing-4xs, 2px) var(--sizing-component-xs, 8px);
    align-items: center;
    gap: var(--sizing-component-3xs, 2px);
    width: fit-content;
}

.listing-item-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-body-secondary, #6B7280);
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontSize-12, 14px);
    font-style: normal;
    font-weight: 400;
    line-height: var(--line-height-body-M, 22px);
    margin-top: 8px;
}

.listing-item-location svg {
    flex-shrink: 0;
}

/* Pagination - Clean Design */
.listings-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.listings-pagination .pagination {
    display: flex;
    align-items: center;
    gap: var(--spacing-x, 12px);
}

.page-link {
    border-radius: var(--border-radius-round, 999px) !important;
    border: var(--border-width-sm, 1px) solid var(--border-primary-weak, #4B5563) !important;
    background: #FFF;
    display: flex;
    width: 100px;
    height: 42px;
    min-width: 80px;
    padding: 0 var(--sizing-component-lg, 20px);
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: none !important;
    color: var(--text-body-primary-weak, #4B5563);
    text-align: center;
    /* Body M bold */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-Body-M, 14px);
    font-style: normal;
    font-weight: 700;
    line-height: var(--line-height-body-M, 22px); /* 157.143% */
}

.listings-pagination .page-back .page-link:hover,
.listings-pagination .page-next .page-link:hover {
    background: #F9FAFB !important;
    border-color: #374151 !important;
    box-shadow: none !important;
}

/* Disabled state */
.listings-pagination .page-item.disabled .page-link {
    border-radius: var(--border-radius-round, 999px);
    border: var(--border-width-sm, 1px) solid #D1D5DB;
    background: #F3F4F6 !important;
    color: #9CA3AF !important;
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none !important;
}

.listings-pagination .page-item.disabled .page-link:hover {
    background: #F3F4F6 !important;
    color: #9CA3AF !important;
    border-color: #D1D5DB !important;
    box-shadow: none !important;
}

/* Ellipsis (...) styling */
.listings-pagination .page-link.dots {
    cursor: default;
    pointer-events: none;
    color: #6B7280;
    background-color: transparent;
    border: none;
    min-width: 24px;
    padding: 8px 4px;
}

/* Responsive adjustments - eBay-style breakpoints */

/* Desktop: 960px+ shows 4 products per row (col-3) */
@media (min-width: 960px) {
    .listings-grid .col-lg-4 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

/* Tablet: 860px-959px shows 3 products per row (col-4) */
@media (min-width: 860px) and (max-width: 959px) {
    .listings-grid .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
}

/* Tablet: 768px-859px shows 3 products per row */
@media (min-width: 768px) and (max-width: 859px) {
    .listings-grid .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .listings-filters.card {
        position: relative;
        top: 0;
        margin-bottom: 30px;
    }

    .listings-filters {
        margin-bottom: 30px;
    }
}

/* Mobile: Below 768px becomes mobile view (2 columns then 1) */
@media (max-width: 767px) {
    /* Hide sidebar filters on mobile */
    .com-listingdirectory .col-lg-3.col-md-4 {
        display: none;
    }

    /* Full width listings on mobile */
    .com-listingdirectory .col-lg-9.col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Show 2 products per row on small mobile */
    .listings-grid .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .search-result-header {
        font-size: 20px;
        line-height: 28px;
        margin-bottom: 16px;
    }

    .listings-count {
        flex-direction: column;
        height: auto;
        align-items: flex-start;
        gap: 16px;
        padding: 15px 0;
    }

    .listings-count-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }

    .listings-count-right {
        width: 100%;
    }

    .filter-sort-wrapper {
        display: flex;
        align-items: center;
        gap: 12px;
        width: auto;
    }

    .sort-by-wrapper {
        width: auto;
    }

    .items-found-text {
        font-size: 16px;
        line-height: 24px;
    }

    .per-page-text {
        font-size: 14px;
        line-height: 20px;
    }

    .separator {
        display: none;
    }

    .listing-item-title {
        font-size: 14px;
        line-height: 20px;
    }

    .listing-item-company-name,
    .listing-item-location {
        font-size: 12px;
        line-height: 18px;
    }

    .listing-item-content {
        padding: 12px 0 0 0;
    }

    .listing-item .listing-image {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }
}

/* Extra small mobile: Below 480px shows 1 product per row */


/* Smooth transitions for AJAX updates */
.listings-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* No listings message */
.alert-info {
    border-radius: 8px;
    padding: 20px;
    font-size: 0.95rem;
}

/* Filter badges for active filters */
.active-filters .badge {
    font-size: 0.85rem;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 500;
}


/* ============================================
   Filter Sidebar Styles - Matching Reference Design
   ============================================ */

.listings-filters {
    display: flex;
    max-width: 318px;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
}

/* Filters Header */
.listings-filters .filters-header {
    display: flex;
    padding: 0 var(--spacing-sm, 16px) var(--spacing-md, 20px) var(--spacing-sm, 16px);
    flex-direction: column;
    align-items: flex-start;
    gap: 11px;
    align-self: stretch;
}

.listings-filters .filters-header label {
    color: var(--text-body-secondary, #6B7280);
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-Body-XL, 18px);
    font-style: normal;
    font-weight: 700;
    line-height: var(--line-height-body-XL, 28px); /* 155.556% */
}

/* Mobile Filter Header - Hidden on desktop */
.filters-header-mobile {
    display: none;
}

/* Mobile Filter Header - Visible and styled on mobile */
@media (max-width: 767px) {
    .filter-sort-wrapper {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .filters-header-mobile {
        display: flex;
        border-radius: var(--border-radius-round, 999px);
        border: var(--border-width-sm, 1px) solid var(--border-primary-weak, #4B5563);
        background: #FFF;
        height: 42px;
        padding: 0 var(--sizing-component-md, 16px) 0 var(--sizing-component-lg, 20px);
        justify-content: center;
        align-items: center;
        gap: var(--spacing-xs, 8px);
        margin-bottom: 0;
        cursor: pointer;
        transition: border-color 0.2s ease, background-color 0.2s ease;
        pointer-events: auto;
        position: relative;
        z-index: 1;
    }

    .filters-header-mobile * {
        pointer-events: none; /* Prevent child elements from blocking clicks */
    }

    .filter-label-mobile {
        color: var(--text-body-primary-weak, #4B5563);
        text-align: center;
        /* Body M bold */
        font-family: var(--type-font-family-font-family-2, "Open Sans");
        font-size: var(--fontsize-body-Body-M, 14px);
        font-style: normal;
        font-weight: 700;
        line-height: var(--line-height-body-M, 22px); /* 157.143% */
        margin: 0;
    }

    .filter-icon-mobile {
        display: flex;
        width: 18px;
        height: 18px;
        padding: 1px;
        justify-content: center;
        align-items: center;
        aspect-ratio: 1/1;
        flex-shrink: 0;
    }

    .filter-icon-mobile svg,
    .filter-icon-mobile img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
}

/* Hide mobile filter header on desktop */
@media (min-width: 768px) {
    .filters-header-mobile {
        display: none !important;
    }

    .selected-filters-mobile-wrapper {
        display: none !important;
    }
}

/* Mobile Selected Filters Carousel - Hidden by default */
.selected-filters-mobile-wrapper {
    display: none;
}

/* Mobile Selected Filters Carousel - Only visible on mobile */
@media (max-width: 767px) {
    .selected-filters-mobile-wrapper[style*="display: block"] {
        display: block !important;
        margin-top: 12px;
        width: 100%;
        order: -1; /* Show before Filter/Sort wrapper */
    }
}

.selected-filters-list-mobile {
    display: flex;
    gap: 8px;
    min-height: 32px; /* Ensure it has height even when empty */
}

@media (max-width: 767px) {
    .selected-filters-list-mobile {
        display: flex;
        padding: var(--spacing-3xs, 4px) var(--sizing-component-xs, 8px);
        align-items: center;
        gap: 2px;
        align-self: stretch;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }

    .selected-filters-list-mobile::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
}

.selected-filters-list-mobile .filter-badge {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm, 10px);
    background: var(--color-blue-bendera-MY-100, #E9EEF7);
    display: flex;
    padding: var(--spacing-4xs, 2px) var(--sizing-component-xs, 8px);
    justify-content: space-between;
    align-items: center;
    width: fit-content;
    white-space: nowrap;
    flex-shrink: 0;
}

.selected-filters-list-mobile .filter-badge .filter-label {
    flex: 1;
    color: var(--text-body-primary, #222);
    /* Body M */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontSize-12, 14px);
    font-style: normal;
    font-weight: 400;
    line-height: var(--line-height-body-M, 22px); /* 157.143% */
}

.selected-filters-list-mobile .filter-badge .btn-remove {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0 0 0 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.selected-filters-list-mobile .filter-badge .btn-remove:before {
    content: '×';
    font-size: 20px;
    line-height: 1;
    color: #6B7280;
}

.selected-filters-list-mobile .filter-badge .btn-remove:hover:before {
    color: #111827;
}

/* Owl Carousel Customization for Mobile Filters */
.selected-filters-list-mobile.owl-carousel {
    display: block;
    width: 100%;
    z-index: 1;
}

.selected-filters-list-mobile.owl-carousel .owl-stage-outer {
    position: relative;
    overflow: hidden;
    /* Fix for some browsers clipping shadows */
    padding: 2px 0;
    margin: -2px 0;
}

.selected-filters-list-mobile.owl-carousel .owl-stage {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
}

.selected-filters-list-mobile.owl-carousel .owl-item {
    display: flex;
    width: auto !important;
    flex-shrink: 0;
    float: left; /* Fallback */
}

/* Ensure mobile specific carousel styles */
@media (max-width: 767px) {
    .selected-filters-list-mobile.owl-carousel {
        /* Disable native scroll since Owl handles it */
        overflow: hidden;
        touch-action: pan-y; /* Allow vertical scroll of page, but Owl handles horizontal */
    }

    .selected-filters-list-mobile.owl-carousel .owl-stage-outer {
        overflow: hidden !important;
    }
}

/* Hide on desktop */
@media (min-width: 768px) {
    .selected-filters-mobile-wrapper {
        display: none !important;
    }
}

/* Mobile Filter Modal - Bootstrap Modal Full Screen on Mobile */
#mobileFilterModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    margin-left: 0 !important;
    width: 100%;
    height: 100%;
    z-index: 1050;
    overflow: hidden;
}

#mobileFilterModal.show {
    display: block !important;
}

#mobileFilterModal .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
}

#mobileFilterModal .modal-content {
    height: 100%;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
}

#mobileFilterModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

#mobileFilterModal .modal-title {
    margin: 0;
    color: var(--text-body-primary, #222);
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-Body-XL, 18px);
    font-style: normal;
    font-weight: 700;
    line-height: var(--line-height-body-XL, 32px);
}

#mobileFilterModal .modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 20px;
    -webkit-overflow-scrolling: touch;
}

#mobileFilterModal .modal-body .listings-filters {
    padding: 20px 0;
}

#mobileFilterModal .modal-body .filters-header {
    display: none; /* Hide desktop header in mobile modal */
}

#mobileFilterModal .modal-body .filters-header-mobile {
    display: none !important; /* Hide mobile button in modal */
}

#mobileFilterModal .modal-body .selected-filters-section {
    padding: 20px 0 24px 0;
    border-bottom: 1px solid #E5E7EB;
    margin-bottom: 0;
}

#mobileFilterModal .modal-body .filter-section {
    padding: 24px 0;
    border-bottom: 1px solid #E5E7EB;
    border-top: none;
}

#mobileFilterModal .modal-body .filter-section:last-of-type {
    border-bottom: none;
}

/* Force show city filter when state is selected */
#mobileFilterModal #citySelectContainer[data-show="true"],
#mobileFilterModal #citySelectContainer.show-city-filter {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#mobileFilterModal .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    flex-shrink: 0;
    background: #FFFFFF;
}

.btn-clear-all-mobile {
    background: transparent;
    border: none;
    color: var(--text-button-tertiary, #4847EB);
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-Body-L, 16px);
    font-style: normal;
    font-weight: 600;
    line-height: var(--line-height-body-L, 24px); /* 150% */
    padding: 0;
    cursor: pointer;
    text-align: center;
    transition: color 0.2s;
}

.btn-show-results-mobile {
    border-radius: var(--border-radius-round, 999px);
    background: var(--surface-tertiary, #4847EB);
    box-shadow: 0 2px 6px 0 rgba(45, 35, 61, 0.15);
    height: 42px;
    min-width: 100px;
    padding: 10px var(--sizing-component-lg, 20px);
    justify-content: center;
    align-items: center;
    border: none;
    color: #FFFFFF;
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-show-results-mobile:hover {
    background: #3D3CD9;
}

.btn-show-results-mobile:active {
    background: #2E2DB8;
}

/* Mobile Filter Modal - Full Screen on Mobile */
@media (max-width: 767px) {
    #mobileFilterModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100vh;
    }

    #mobileFilterModal .modal-content {
        height: 100vh;
        border-radius: 0;
    }
}

/* Hide modal on desktop */
@media (min-width: 768px) {
    #mobileFilterModal {
        display: none !important;
    }
}

/* Mobile Filter Button Styles */
@media (max-width: 767px) {
    .filters-header-mobile {
        cursor: pointer;
    }

    .filters-header-mobile:active {
        opacity: 0.8;
    }
}

/* Selected Filters Section */
.selected-filters-section {
    display: flex;
    padding: var(--spacing-md, 20px) var(--spacing-sm, 16px);
    flex-direction: column;
    align-items: flex-start;
    gap: 11px;
    align-self: stretch;
}

.selected-filters-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selected-filters-list .filter-badge {
    border-radius: var(--border-radius-sm, 10px);
    background: var(--color-blue-bendera-my-100, #E9EEF7);
    display: flex;
    padding: var(--spacing-4xs, 2px) var(--sizing-component-xs, 8px);
    justify-content: space-between;
    align-items: center;
    width: fit-content;
}

.selected-filters-list .filter-badge .filter-label {
    flex: 1;
}

.selected-filters-list .filter-badge .btn-remove {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0 0 0 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.selected-filters-list .filter-badge .btn-remove:before {
    content: '×';
    font-size: 20px;
    line-height: 1;
    color: #6B7280;
}

.selected-filters-list .filter-badge .btn-remove:hover:before {
    color: #111827;
}

.btn-clear-all {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    color: #2563EB;
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-clear-all:hover {
    color: #1D4ED8;
    text-decoration: underline;
}

/* Filter Sections */
.filter-section {
    border-top: 1px solid var(--border-tertiary, #D1D5DB);
    display: flex;
    padding: var(--spacing-md, 20px) var(--spacing-sm, 16px);
    flex-direction: column;
    gap: var(--spacing-x, 12px);
    align-self: stretch;
}

.filter-section:first-of-type {
    padding-top: 20px;
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-title {
    align-self: stretch;
    color: var(--text-body-primary, #222);

    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-Body-L, 16px);
    font-style: normal;
    font-weight: 700;
    line-height: var(--line-height-body-L, 24px); /* 150% */
}

/* Filter Fields */
.filter-field {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--general-sm-2, 4px);
}

.filter-field:last-child {
    margin-bottom: 0;
}

.filter-field label {
    display: flex;
    align-items: center;
    gap: var(--general-sm-2, 4px);
    flex: 1 0 0;
    color: var(--text-body-primary, #222);

    /* Body M */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontSize-12, 14px);
    font-style: normal;
    font-weight: 400;
    line-height: var(--line-height-body-M, 22px); /* 157.143% */

    margin-bottom: 8px;
    padding: var(--gap-sm, 0);
}

.filter-field label strong {
    font-weight: 600;
    color: #111827;
}

.filter-select {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: #FFFFFF;
    color: #111827;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 4L10 8L6 12' stroke='%231E2939' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

.filter-select:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-select:hover {
    border-color: #9CA3AF;
}

.location-title {
    color: var(--text-body-primary, #222);
    /* Body M */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontSize-12, 14px);
    font-style: normal;
    font-weight: 400;
    line-height: var(--line-height-body-M, 22px); /* 157.143% */
    display: flex;
    align-items: center;
    gap: 4px;
}

.location-title .help-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    cursor: help;
}

/* Range Slider */
.filter-range {
    width: 100%;
    height: 4px;
    background: var(--color-blue-bendera-my-100, #E9EEF7);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.filter-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #2563EB;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.filter-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #2563EB;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.filter-range::-webkit-slider-thumb:hover {
    background: #1D4ED8;
}

.filter-range::-moz-range-thumb:hover {
    background: #1D4ED8;
}

/* Categories List */
.categories-filter-list {
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.categories-filter-list::-webkit-scrollbar {
    width: 6px;
}

.categories-filter-list::-webkit-scrollbar-track {
    background: transparent;
}

.categories-filter-list::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.categories-filter-list::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

.category-filter-item {
    color: var(--text-body-primary, #222);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    align-self: stretch;
    cursor: pointer;
    /* Body M */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-12, 14px);
    font-style: normal;
    font-weight: 400;
    line-height: var(--line-height-body-m, 22px); /* 157.143% */
}

.category-filter-item:hover .category-label {
    color: #111827;
}

.custom-checkbox-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Default state: show off, hide on logic handled by sibling selector */
.category-checkbox:checked + .custom-checkbox-icon .checkbox-off {
    display: none !important;
}

.category-checkbox:checked + .custom-checkbox-icon .checkbox-on {
    display: block !important;
}

.category-label {
    color: var(--text-body-primary, #222);

    /* Body M */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-12, 14px);
    font-style: normal;
    font-weight: 400;
    line-height: var(--line-height-body-m, 22px); /* 157.143% */
}

.category-checkbox:checked + .category-label {
    color: #111827;
    font-weight: 500;
}

/* Results Header with Category */
.listings-toolbar .results-count h6 {
    color: #1E2939;
    font-family: var(--font-family-inter);
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
    letter-spacing: -0.312px;
}

.listings-toolbar .results-count strong {
    font-weight: 700;
}

/* Sort By Styling */
.sort-by-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-by-wrapper label {
    color: var(--text-body-secondary, #6B7280);

    /* Body M */
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: var(--fontsize-body-body-m, 14px);
    font-style: normal;
    font-weight: 400;
    line-height: var(--line-height-body-m, 22px); /* 157.143% */
}

/* Responsive */
@media (max-width: 768px) {
    .selected-filters-section {
        padding: 12px 0;
    }

    .filter-section {
        padding: 12px 0;
    }

    .categories-filter-list {
        max-height: 200px;
    }
}

/* Mobile Sort Dropdown Styling - Only for max-width 767px */
@media (max-width: 767px) {
    /* Hide "Sort by:" label on mobile */
    .sort-by-wrapper label {
        display: none;
    }

    /* Style sort dropdown wrapper to match image */
    .sort-dropdown-wrapper {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        background: #FFFFFF;
        cursor: pointer;
        min-width: fit-content;
        transition: border-color 0.2s ease;
    }

    .sort-dropdown-wrapper:hover {
        border-color: #D1D5DB;
    }

    /* Style the select to be invisible but functional */
    .sort-dropdown-wrapper select#filter_order {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        cursor: pointer;
        z-index: 2;
        border: none;
        background: transparent;
        padding: 10px 35px 10px 10px !important;
        margin: 0;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        font-size: 14px;
    }

    /* Style the "Relevance" label */
    .sort-label-mobile {
        color: var(--text-body-primary, #222);
        text-align: center;
        font-family: var(--type-font-family-font-family-2, "Open Sans");
        font-size: var(--fontsize-body-body-m, 14px);
        font-style: normal;
        font-weight: 600;
        line-height: var(--line-height-body-m, 22px); /* 157.143% */
        pointer-events: none;
        z-index: 1;
        white-space: nowrap;
    }

    /* Update wrapper to remove default select styling */
    .listings-ordering-controls {
        display: inline-flex;
    }

    /* Ensure the wrapper doesn't have extra padding */
    .sort-dropdown-wrapper .form-select {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hide default select styling on mobile */
    .sort-dropdown-wrapper .form-select-sm {
        padding: 0;
        margin: 0;
    }
}

/* Desktop: Hide mobile label but show chevron, restore original select styling */
@media (min-width: 768px) {
    .sort-label-mobile, .sort-chevron-mobile {
        display: none !important;
    }

    .sort-dropdown-wrapper {
        display: block;
        position: relative;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        cursor: default;
    }

    .sort-dropdown-wrapper select#filter_order {
        position: static !important;
        opacity: 1 !important;
        width: auto;
        height: auto;
        padding: 10px 35px 10px 10px;
        margin: 0;
        border: 1px solid rgba(0, 0, 0, 0.20);
        border-radius: 6px;
        background-color: #fff;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        font-size: 16px;
        min-width: 200px;
    }

    .sort-dropdown-wrapper .form-select {
        margin: 0;
        padding: 10px 35px 10px 10px;
    }
}

/* Style the chevron icon */
.sort-chevron-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    flex-shrink: 0;
}

.sort-chevron-mobile svg {
    width: 18px;
    height: 18px;
}

.listing-item-tags-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    z-index: 2;
}

.listing-item-tags-overlay .listing-tag {
    display: inline-flex;
    padding: 4px 8px;
    align-items: center;
    border-radius: 4px;
    background: rgba(233, 238, 247, 0.95);
    color: #030264;
    font-family: var(--type-font-family-font-family-2, "Open Sans");
    font-size: 11px;
    font-style: normal;
    font-weight: 600;
    line-height: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
}
