.archive .tfcl-advanced-search-wrap {
    margin-bottom: 30px;
}

/* Hidden by dependency engine */
.tfcl-dep-hidden {
    display: none !important;
}

.archive .tfcl-advanced-search-wrap.map-header {
    margin-top: -50px;
}

.archive.filter-search-map .page-header {
    display: none;
}

.archive.filter-search-map #themesflat-content {
    padding-top: 0px;
    padding-bottom: 0px;
}

.archive .tfcl-taxonomy-archive-header {
    display: flex;
    justify-content: space-between;
    flex-basis: auto;
    flex-grow: 1;
    flex-shrink: 1;
    align-self: auto;
    margin-bottom: 30px;
}

.archive .tfcl-sort-by-options>label {
    font-weight: 400;
    color: #818181;
    font-size: 0.9375rem;
    padding: 0;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.archive #tfcl-sort-by-options+.nice-select {
    margin: 0;
    padding: 0;
    border: none;
    border: 1px solid #EDEDED;
    padding: 9px 17px;
    border-radius: 10px;
}

.archive #tfcl-sort-by-options+.nice-select .current {
    font-size: 16px;
    font-weight: 500;
    line-height: 22.4px;
    color: #24272C;
    font-family: 'Outfit';
}

.archive #tfcl-sort-by-options+.nice-select .current::after {
    font-weight: 700;
    font-size: 15px;
    margin-left: 14px;
}

.archive .btn-display-listing-grid,
.archive .btn-display-listing-list {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #EDEDED;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #B6B6B6 !important;
    font-size: 22px;
}

.archive .btn-display-listing-grid.active,
.archive .btn-display-listing-list.active,
.archive .btn-display-listing-grid:hover,
.archive .btn-display-listing-list:hover {
    background: var(--theme-primary-color);
    border-color: var(--theme-primary-color);
    color: #fff !important;
}

.archive .pagination-wrap .tfcl-pagination {
    justify-content: center !important;
    gap: 10px;
}

.archive .wrap-listing {
    position: relative;
}

.tfcl-taxonomy-archive-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tfcl-taxonomy-archive-header {
    align-items: center;
}

.tfcl-taxonomy-archive-header .tfcl-sort-by-options .nice-select {
    margin: 0;
    padding: 0;
    border: none;
}

.tfcl-taxonomy-archive-header .tfcl-sort-by-options .nice-select .current {
    color: #0D0E0F;
    font-family: "DM Sans";
    font-size: 18px;
    font-weight: 500;
    text-transform: capitalize;
}

/* Mobile filter modal (slides from right) */
body .search-listing-form.mobile-filter-active,
body .tfcl_sidebar.mobile-filter-active,
.archive .search-listing-form.mobile-filter-active,
.archive .tfcl_sidebar.mobile-filter-active {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: 85%;
    max-width: 420px;
    height: 100vh !important;
    background: #fff !important;
    z-index: 1000000 !important;
    overflow-y: auto !important;
    /* box-shadow: -2px 0 8px rgba(0,0,0,.35); */
    animation: slideInRight .3s ease forwards;
    padding: 24px 16px !important;
    box-sizing: border-box;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Dark backdrop when filter is open via the dedicated mobile popup */
body.filter-popup-open.tfcl-mobile-filter-active.tfcl-mobile-filter-popup-open::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .6);
    z-index: 999999;
    pointer-events: none;
}

body.filter-popup-open.tfcl-mobile-filter-active .select2-container--open,
body.filter-popup-open.tfcl-mobile-filter-active .select2-container--open .select2-dropdown,
.tf-search-wrap .select2-container--open,
.tf-search-wrap .select2-container--open .select2-dropdown {
    /* let select2 handle naturally */
}

/* Ensure Select2 container in mobile popup has proper z-index */
.tfcl-mobile-filter-popup .select2-container {
    /* let select2 handle naturally */
}

.tfcl-mobile-filter-popup .select2-container--open {
    /* let select2 handle naturally */
}

.tfcl-mobile-filter-popup .select2-dropdown {
    /* let select2 handle naturally */
}

/* Slightly offset open dropdowns in the mobile popup so the first option
   is not visually tucked under the fixed header (e.g. for "Тип кузова"). */
.tfcl-mobile-filter-popup .select2-container--open .select2-dropdown {
    margin-top: 6px !important;
}

/* CRITICAL: Allow Select2 dropdown to overflow popup content */
.tfcl-mobile-filter-popup .select2-dropdown {
    /* let select2 handle naturally */
}

/* Ensure Select2 dropdown is not clipped */
.tfcl-mobile-filter-popup-content {
    overflow: visible !important;
}

.tfcl-mobile-filter-popup-body {
    overflow-y: auto !important;
    overflow-x: visible !important;
}

/* Ensure dropdown lists appear above modal */
.search-listing-form.mobile-filter-active .nice-select .list,
.tfcl_sidebar.mobile-filter-active .nice-select .list {
    z-index: 1000001;
}

/* Hide sidebar container on desktop but show when modal active */
/* Sidebar container: visible by default on desktop only */
@media only screen and (min-width: 992px) {
    .sidebar-archive {
        display: block !important;
    }

    /* CRITICAL: Ensure sidebar and filters are visible on desktop */
    /* Override any dependency-based hiding for sidebar-archive on desktop */
    .sidebar-archive,
    .sidebar-archive.tfcl-hidden,
    .sidebar-archive.tfcl-deps-hidden,
    .sidebar-archive[data-deps-controlled="true"],
    #taxonomy-filter-sidebar,
    #taxonomy-filter-sidebar.tfcl-hidden,
    #taxonomy-filter-sidebar.tfcl-deps-hidden,
    #taxonomy-filter-sidebar[data-deps-controlled="true"],
    .tfcl_sidebar,
    .tfcl_sidebar.tfcl-hidden,
    .tfcl_sidebar.tfcl-deps-hidden,
    form.tfcl-my-listing-search,
    form#tfcl-my-listing-search,
    .tfcl-my-listing-search {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .archive .sidebar-archive,
    .archive .sidebar-archive.tfcl-hidden,
    .archive .sidebar-archive.tfcl-deps-hidden,
    .archive .sidebar-archive[data-deps-controlled="true"],
    .archive .sidebar-archive .tfcl_sidebar,
    .archive .sidebar-archive #taxonomy-filter-sidebar,
    .archive .group-filter-listing .tfcl_sidebar,
    .archive .group-filter-listing .tfcl-sidebar,
    .archive .group-filter-listing .listing-sidebar,
    .archive .group-filter-listing form.search-listing-form,
    .archive .group-filter-listing form#tfcl-my-listing-search {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin: inherit !important;
        padding: inherit !important;
    }

    /* Ensure filter fields are visible on desktop */
    .archive .sidebar-archive .form-group,
    .archive .sidebar-archive .form-item,
    .archive .sidebar-archive .tfcl-field,
    .archive .sidebar-archive select,
    .archive .sidebar-archive input {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* When mobile popup is active we explicitly show */
.sidebar-archive.mobile-filter-sidebar-active {
    display: block !important;
}


/* Only block scrolling on mobile devices, not desktop */
@media only screen and (max-width: 991px) {
    body.filter-popup-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* original rules kept but media query removed for wider applicability */
/* === Previous mobile-specific section starts === */
/* LEGACY MOBILE FILTER RULES DISABLED

  
    left: auto !important;
    right: 0 !important;
    width: 90vw !important;
    max-width: 420px;
    background: #fff !important;
    padding: 24px 16px !important;
    color: #0d0e0f !important;
  }

    background: initial !important;
    color: inherit !important;
  }
*/

form.search-listing-form.mobile-filter-active {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: 90vw !important;
    max-width: 420px;
    height: 100vh !important;
    background: #fff !important;
    /* ensure panel is opaque above backdrop */
    z-index: 1000001 !important;
    /* higher than body::before backdrop */
    overflow-y: auto !important;
    padding: 24px 16px !important;
    box-sizing: border-box !important;
    /* box-shadow: -2px 0 8px rgba(0,0,0,.35); */
}

form.search-listing-form.mobile-filter-active .mobile-filter-close,
.tfcl_sidebar.mobile-filter-active .mobile-filter-close {
    display: block !important;
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: #fff;
    background: #444;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 40px;
    z-index: 1000000;
    cursor: pointer;
}

.archive .tfcl-taxonomy-archive-header {
    flex-wrap: wrap;
    gap: 10px;
}

/* Mobile Filter Button Styles */
.filter-popup {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: var(--theme-primary-color, #007cba);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Desktop: never show the mobile-only filter trigger button */
@media only screen and (min-width: 992px) {

    a.filter-popup.enable-mobile,
    .filter-popup.enable-mobile,
    .tf-search-more-btn.filter-popup.enable-mobile {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

.filter-popup:hover {
    background: var(--theme-primary-color-hover, #005a87);
}

.filter-popup svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Hide search form by default on mobile - stronger selectors */
@media only screen and (max-width: 991px) {

    /* Hide fields flagged as mobile-hidden via settings */
    .tfcl-hidden-mobile {
        display: none !important;
    }

    /* Ensure container does not break sticky */
    .archive .group-filter-listing,
    .tfcl-my-listing-search .group-filter-listing,
    .listing-list-wrap .group-filter-listing,
    .group-filter-listing {
        overflow: visible !important;
        position: static !important;
        /* Changed from relative to static to allow sticky children */
        display: flex !important;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    /* Make the column and/or toolbar itself aligned for sticky layout (actual sticky position is handled below
       by selectors that explicitly exclude .tfcl-toolbar-fixed) */
    .archive .group-filter-listing .col-md-4,
    .archive .group-filter-listing .col-md-7,
    .archive .group-filter-listing .col-md-8,
    .archive .group-filter-listing .col-lg-4,
    .archive .group-filter-listing .col-xl-4,
    .archive .group-filter-listing .toolbar-search-list,
    .archive .group-filter-listing .toolbar-search-list.col-md-4,
    .archive .group-filter-listing .toolbar-search-list.col-md-7,
    .archive .group-filter-listing .toolbar-search-list.col-md-8,
    /* Top-layout toolbar inside the first row of the archive search form */
    .archive .tfcl-my-listing-search>.row .toolbar-search-list,
    /* Catalog page selectors (without .archive class) - more general selectors */
    .tfcl-my-listing-search .group-filter-listing .toolbar-search-list,
    .tfcl-my-listing-search .group-filter-listing .toolbar-search-list[class*="col-"],
    .tfcl-my-listing-search .group-filter-listing>.toolbar-search-list,
    .listing-list-wrap .group-filter-listing .toolbar-search-list,
    .listing-list-wrap .group-filter-listing .toolbar-search-list[class*="col-"],
    /* Even more general - any toolbar-search-list inside group-filter-listing */
    .group-filter-listing .toolbar-search-list {
        align-self: flex-start;
        /* in case of flex rows */
        margin-bottom: 0 !important;
    }

    .archive .group-filter-listing .toolbar-search-list,
    .archive .group-filter-listing .tfcl-stuck,
    /* Top-layout toolbar inside the first row of the archive search form */
    .archive .tfcl-my-listing-search>.row .toolbar-search-list,
    .tfcl-my-listing-search .group-filter-listing .toolbar-search-list,
    .tfcl-my-listing-search .group-filter-listing .tfcl-stuck,
    .listing-list-wrap .group-filter-listing .toolbar-search-list,
    /* More general selector for catalog page */
    .group-filter-listing .toolbar-search-list {
        background: #fff !important;
        /* force solid white background for sticky toolbar */
        backdrop-filter: blur(6px);
        padding: 8px 12px !important;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        margin-top: 0 !important;
        margin-bottom: 10px !important;
    }

    /* Hide filters in page flow on mobile; show only when popup is open (scoped to group-filter-listing to avoid collateral) */
    .archive:not(.filter-popup-open) .group-filter-listing .tfcl_sidebar,
    .archive:not(.filter-popup-open) .group-filter-listing .tfcl-sidebar,
    .archive:not(.filter-popup-open) .group-filter-listing .listing-sidebar,
    .archive:not(.filter-popup-open) .group-filter-listing .sidebar-archive,
    .archive:not(.filter-popup-open) .group-filter-listing form.search-listing-form,
    .archive:not(.filter-popup-open) .group-filter-listing form#tfcl-my-listing-search,
    .archive:not(.filter-popup-open) .group-filter-listing .tfcl-my-listing-search,
    .archive:not(.filter-popup-open) .group-filter-listing .search-filter-wrap {
        display: none !important;
    }

    /* Stronger rule for generic sidebar-archive and standalone search forms anywhere on archive */
    .archive:not(.filter-popup-open) .sidebar-archive {
        display: none !important;
    }

    .archive:not(.filter-popup-open) form#tfcl-my-listing-search {
        display: none !important;
    }

    /* Hide form content but keep toolbar with filter button visible */
    .archive:not(.filter-popup-open) .tfcl-my-listing-search {
        display: block !important;
    }

    .archive:not(.filter-popup-open) .tfcl-my-listing-search>.group-card-item-listing,
    .archive:not(.filter-popup-open) .tfcl-my-listing-search>.overlay-filter-tab,
    .archive:not(.filter-popup-open) .tfcl-my-listing-search>.pagination-wrap {
        display: none !important;
    }

    /* Ensure toolbar row is visible */
    .archive:not(.filter-popup-open) .tfcl-my-listing-search .group-filter-listing,
    .archive:not(.filter-popup-open) .tfcl-my-listing-search>.row:has(.group-filter-listing) {
        display: flex !important;
    }

    /* When popup is active, explicitly show the sidebar container */
    .archive .sidebar-archive.mobile-filter-sidebar-active {
        display: block !important;
    }

    .archive .group-filter-listing .tfcl_sidebar.mobile-filter-active,
    .archive .group-filter-listing .tfcl-sidebar.mobile-filter-active,
    .archive .group-filter-listing form.search-listing-form.mobile-filter-active,
    .archive .group-filter-listing .listing-sidebar.mobile-filter-active {
        display: block !important;
    }

    /* Fallback for header height var */
    :root {
        --tfcl-sticky-header-height: var(--tfcl-sticky-header-height, 70px);
    }

    /* HIDE all filters inside main archive form, except the top toolbar row (.group-filter-listing) */
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .form-group.form-item,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .tfcl-year-range-picker,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .search-filter-wrap,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .search-filter-inner,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .search-form-content,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .filter-sidebar-left,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .filter-sidebar-right,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .tfcl-slider-range-mileage-wrap,
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .form-item {
        display: none !important;
    }

    /* Keep only the toolbar row visible */
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search .group-filter-listing {
        display: flex !important;
    }

    /* As a safety net: hide all direct children of the form except the toolbar row */
    .archive:not(.filter-popup-open) form.tfcl-my-listing-search>*:not(.group-filter-listing) {
        display: none !important;
    }

    /* Ensure toolbar stays sticky - general selector for all pages */
    .archive .group-filter-listing .toolbar-search-list:not(.tfcl-toolbar-fixed),
    /* Top-layout toolbar inside the first row of the archive search form */
    .archive .tfcl-my-listing-search>.row .toolbar-search-list:not(.tfcl-toolbar-fixed),
    .tfcl-my-listing-search .group-filter-listing .toolbar-search-list:not(.tfcl-toolbar-fixed),
    .listing-list-wrap .group-filter-listing .toolbar-search-list:not(.tfcl-toolbar-fixed),
    .group-filter-listing .toolbar-search-list:not(.tfcl-toolbar-fixed) {
        position: sticky !important;
    }

    /* Fixed toolbar when scrolled - applied via JavaScript - HIGHER SPECIFICITY */
    .archive .group-filter-listing .toolbar-search-list.tfcl-toolbar-fixed {
        position: fixed !important;
        top: var(--tfcl-sticky-header-height, 4rem) !important;
        z-index: 1000 !important;
        /* above listing cards and floating buttons, below mobile popups */
        background: #fff !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        padding: 8px 12px !important;
        border-radius: 12px;
        margin: 0 !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        transform: translateZ(0);
        /* Force hardware acceleration */
        -webkit-transform: translateZ(0);
    }

    .tfcl-my-listing-search .toolbar-search-list.tfcl-toolbar-fixed {
        position: fixed !important;
        top: var(--header-sticky, 3rem) !important;
        z-index: 1000 !important;
        /* generic catalog/homepage toolbar */
    }

    /* Homepage only: adjust the fixed toolbar according to the header */
    body.home .tfcl-my-listing-search .toolbar-search-list.tfcl-toolbar-fixed {
        top: var(--header-sticky, 3rem) !important;
    }

    /* Add proper spacing after sticky toolbar to prevent content jumping */
    .archive .group-filter-listing+.group-card-item-listing,
    .archive .group-filter-listing+.row.group-card-item-listing,
    .tfcl-my-listing-search .group-filter-listing+.group-card-item-listing,
    .tfcl-my-listing-search .group-filter-listing+.row.group-card-item-listing,
    .listing-list-wrap .group-filter-listing+.group-card-item-listing,
    .listing-list-wrap .group-filter-listing+.row.group-card-item-listing {
        margin-top: 10px;
    }

    /* Reserve space when toolbar becomes fixed to prevent content jump */
    .group-filter-listing:has(.toolbar-search-list.tfcl-toolbar-fixed) {
        min-height: 60px;
    }

    /* Smooth scrolling for better UX */
    html {
        scroll-behavior: smooth;
    }

    /* Ensure results container has scroll margin for sticky headers */
    .group-card-item-listing,
    .tfcl-table-content {
        scroll-margin-top: calc(var(--tfcl-sticky-header-height, 70px) + 80px);
    }

    /* Homepage: only account for sticky header and toolbar, not the filter form (which is not sticky) */
    body.home .group-card-item-listing {
        scroll-margin-top: calc(var(--tfcl-sticky-header-height, 70px) + 80px);
    }

    /* When popup is open we still want the form-in-flow hidden; popup uses sidebar markup */

    body.filter-popup-open .archive .toolbar-search-list {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .archive .filter-popup.enable-mobile,
    .archive .tf-search-more-btn.filter-popup.enable-mobile {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 140px;
        padding: 12px 18px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
        border-radius: 999px;
        background: var(--theme-primary-color, #007cba);
        color: #fff !important;
        text-decoration: none;
        cursor: pointer;
    }

    .archive .toolbar-search-list .filter-popup.enable-mobile,
    .archive .toolbar-search-list .tf-search-more-btn.filter-popup.enable-mobile {
        display: inline-flex !important;
    }

    /* Previously there were overrides here that disabled sticky/fixed toolbar on the homepage.
       They have been removed so that the catalog page (often set as the front page) can still
       use the sticky sorting toolbar behavior. */

    /* CRITICAL: Hide old sidebar on mobile - prevent it from opening */
    #taxonomy-filter-sidebar.tfcl_sidebar,
    #taxonomy-filter-sidebar.tfcl_sidebar.mobile-filter-active {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: fixed !important;
        left: -9999px !important;
        pointer-events: none !important;
    }

    /* CRITICAL: Hide toolbar elements from main page when popup is open */
    body.tfcl-mobile-filter-popup-open .toolbar-search-list:not(.tfcl-mobile-filter-popup .toolbar-search-list),
    body.tfcl-mobile-filter-popup-open .btn-display-listing-grid:not(.tfcl-mobile-filter-popup .btn-display-listing-grid),
    body.tfcl-mobile-filter-popup-open .btn-display-listing-list:not(.tfcl-mobile-filter-popup .btn-display-listing-list),
    body.tfcl-mobile-filter-popup-open select[name="sortby"]:not(.tfcl-mobile-filter-popup select[name="sortby"]),
    body.tfcl-mobile-filter-popup-open #listing_order_by:not(.tfcl-mobile-filter-popup #listing_order_by),
    body.tfcl-mobile-filter-popup-open .filter-popup:not(.tfcl-mobile-filter-popup .filter-popup):not(.enable-mobile),
    body.tfcl-mobile-filter-popup-open .group-filter-listing:not(.tfcl-mobile-filter-popup .group-filter-listing),
    body.tfcl-mobile-filter-popup-open .condition-tab-wrap:not(.tfcl-mobile-filter-popup .condition-tab-wrap),
    body.tfcl-mobile-filter-popup-open .tf-control-layout:not(.tfcl-mobile-filter-popup .tf-control-layout) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
    }

    /* New mobile filter popup */
    .tfcl-mobile-filter-popup {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 1000000 !important;
        display: none;
        visibility: hidden;
        opacity: 0;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .tfcl-mobile-filter-popup[style*="display: block"],
    .tfcl-mobile-filter-popup.show,
    .tfcl-mobile-filter-popup.show.tfcl-mobile-filter-popup {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure fields explicitly hidden with style attribute stay hidden inside popup */
    .tfcl-mobile-filter-popup.show [style*="display: none"],
    .tfcl-mobile-filter-popup.show [style*="display: none !important"] {
        display: none !important;
    }

    .tfcl-mobile-filter-popup.show [style*="visibility: hidden"],
    .tfcl-mobile-filter-popup.show [style*="visibility: hidden !important"] {
        visibility: hidden !important;
    }

    .tfcl-mobile-filter-popup-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 1;
    }

    .tfcl-mobile-filter-popup-content {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 90%;
        max-width: 420px;
        height: 100% !important;
        background: #fff;
        z-index: 2;
        display: flex;
        flex-direction: column;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.35);
        animation: slideInRight 0.3s ease;
        overflow: visible;
        /* Allow Select2 dropdowns to overflow */
        box-sizing: border-box;
    }

    /* Ensure popup body can scroll but allows Select2 dropdown to overflow */
    .tfcl-mobile-filter-popup-body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        /* Prevent horizontal overflow that could cover header/footer */
        padding-top: 0 !important;
        /* No top padding here - will be set in media query */
        padding-bottom: 100px !important;
        /* Space for fixed footer button */
    }


    @keyframes slideInRight {
        from {
            transform: translateX(100%);
        }

        to {
            transform: translateX(0);
        }
    }

    .tfcl-mobile-filter-popup-header {
        padding: 20px;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
        position: relative;
        z-index: 100 !important;
        background: #fff !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    /* Hide toolbar elements in header and everywhere in popup - MAXIMUM SPECIFICITY */
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .toolbar-search-list,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .btn-display-listing-grid,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .btn-display-listing-list,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .filter-popup:not(.tfcl-mobile-filter-popup),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .tf-search-more-btn:not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .wrap-reset-filter,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .btn-condition-filter,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header select[name="sortby"],
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header #listing_order_by,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .group-filter-listing,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .condition-tab-wrap,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .tf-control-layout,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-header .tf-search-condition-tab,
    /* Also hide in body and everywhere */
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .toolbar-search-list,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .btn-display-listing-grid,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .btn-display-listing-list,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .filter-popup:not(.tfcl-mobile-filter-popup),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .tf-search-more-btn:not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .wrap-reset-filter,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .btn-condition-filter,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body select[name="sortby"],
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body #listing_order_by,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .group-filter-listing,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .condition-tab-wrap,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .tf-control-layout,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-mobile-filter-popup-body .tf-search-condition-tab {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
        clip: rect(0, 0, 0, 0) !important;
        max-height: 0 !important;
        max-width: 0 !important;
        min-height: 0 !important;
        min-width: 0 !important;
        line-height: 0 !important;
        font-size: 0 !important;
    }

    .tfcl-mobile-filter-popup-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 16px 20px !important;
        border-bottom: 1px solid #e5e7eb !important;
        flex-shrink: 0 !important;
        position: relative !important;
    }

    /* CRITICAL: Hide ALL filter fields from header - only show h3 and close button */
    .tfcl-mobile-filter-popup-header .tfcl-field,
    .tfcl-mobile-filter-popup-header .form-group,
    .tfcl-mobile-filter-popup-header .form-item,
    .tfcl-mobile-filter-popup-header .listing-select-meta-box-wrap,
    .tfcl-mobile-filter-popup-header select,
    .tfcl-mobile-filter-popup-header input,
    .tfcl-mobile-filter-popup-header label:not(h3),
    .tfcl-mobile-filter-popup-header>*:not(h3):not(.tfcl-mobile-filter-popup-close) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
    }

    /* CRITICAL: Prevent first field from appearing in header area - even if it has position absolute */
    .tfcl-mobile-filter-popup-content .tfcl-field:first-child,
    .tfcl-mobile-filter-popup-body .tfcl-field:first-child,
    .tfcl-mobile-filter-popup-body .form-group:first-child,
    .tfcl-mobile-filter-popup-body .form-item:first-child {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        margin-top: 20px !important;
        /* Space to prevent overlap with header */
        margin-bottom: 20px !important;
    }

    /* Ensure first field in body is not positioned absolutely near header */
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-body,
    .tfcl-mobile-filter-popup-body .tfcl-field:first-of-type {
        position: relative !important;
        top: 0 !important;
        margin-top: 4rem !important;
        z-index: 1 !important;
    }

    /* On taxonomy archives (.archive), reduce the extra offset so the gap is smaller */
    .archive .tfcl-mobile-filter-popup-body .tfcl-field-listing-body,
    .archive .tfcl-mobile-filter-popup-body .tfcl-field:first-of-type {
        margin-top: 16px !important;
    }

    /*
     * HOME HEADER FILTER (Elementor widget .tf-search-wrap)
     * On the homepage we never want the "body type" field container
     * to flash into view when other filters (price/year/etc.) change.
     * We hide the wrapper entirely inside the header search widget.
     */
    body.home .tf-search-wrap .tfcl-field-listing-body {
        position: relative !important;
    }

    /* На головній сторінці підтип у хедерному віджеті має бути прихований,
       доки не буде вибраний реальний body. data-tfcl-body-empty="1" виставляє JS. */
    body.home .tf-search-wrap[data-tfcl-body-empty="1"] .subtype-field-wrapper,
    body.home .tf-search-wrap[data-tfcl-body-empty="1"] .tfcl-field-listing-subtype {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .tfcl-mobile-filter-popup-header h3 {
        margin: 0 !important;
        font-size: 20px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        flex: 1 !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .tfcl-mobile-filter-popup-close {
        background: none;
        border: none;
        font-size: 32px;
        color: #6b7280;
        cursor: pointer;
        padding: 0;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background 0.2s ease;
    }

    .tfcl-mobile-filter-popup-close:hover {
        background: rgba(0, 0, 0, 0.1);
    }

    /* Keep close button always clickable above popup content */
    .tfcl-mobile-filter-popup .tfcl-mobile-filter-popup-header {
        z-index: 1000002 !important;
    }

    .tfcl-mobile-filter-popup .tfcl-mobile-filter-popup-header .tfcl-mobile-filter-popup-close {
        pointer-events: auto !important;
        touch-action: manipulation !important;
        position: relative !important;
        z-index: 1000003 !important;
        -webkit-tap-highlight-color: transparent;
    }

    .tfcl-mobile-filter-popup-body {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding-left: 20px !important;
        padding-right: 20px !important;
        padding-top: 0 !important;
        /* No top padding - header is separate and won't overlap */
        padding-bottom: 100px !important;
        /* Space to prevent overlap with footer */
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        position: relative !important;
    }

    /* CRITICAL: Body must contain all children */
    .tfcl-mobile-filter-popup-body {
        position: relative !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* CRITICAL: Prevent fields from overflowing body */
    .tfcl-mobile-filter-popup-body * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* CRITICAL: Hide fields with dependencies that are not visible */
    .tfcl-mobile-filter-popup-body .tfcl-field.tfcl-deps-hidden,
    .tfcl-mobile-filter-popup-body .tfcl-field.tfcl-hidden.tfcl-deps-hidden,
    .tfcl-mobile-filter-popup-body .form-group.tfcl-deps-hidden,
    .tfcl-mobile-filter-popup-body .form-item.tfcl-deps-hidden,
    .tfcl-mobile-filter-popup-body .listing-select-meta-box-wrap.tfcl-deps-hidden {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        max-height: 0 !important;
        max-width: 0 !important;
        min-height: 0 !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
    }

    /* Ensure fields respect body padding and positioning - ONLY for visible fields */
    .tfcl-mobile-filter-popup-body .tfcl-field:not(.tfcl-deps-hidden):not([style*="display: none"]),
    .tfcl-mobile-filter-popup-body .form-group:not(.tfcl-deps-hidden):not([style*="display: none"]),
    .tfcl-mobile-filter-popup-body .form-item:not(.tfcl-deps-hidden):not([style*="display: none"]),
    .tfcl-mobile-filter-popup-body .listing-select-meta-box-wrap:not(.tfcl-deps-hidden):not([style*="display: none"]) {
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        position: relative !important;
        left: 0 !important;
        right: auto !important;
        transform: none !important;
        float: none !important;
        clear: both !important;
    }

    /* Ensure all direct children of body are contained - EXCEPT hidden fields */
    .tfcl-mobile-filter-popup-body>*:not(.tfcl-deps-hidden):not([style*="display: none"]) {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        position: relative !important;
        left: 0 !important;
        right: auto !important;
        box-sizing: border-box !important;
    }

    /* Hide direct children of body that are hidden */
    .tfcl-mobile-filter-popup-body>.tfcl-deps-hidden,
    .tfcl-mobile-filter-popup-body>[style*="display: none"] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        max-height: 0 !important;
        max-width: 0 !important;
        min-height: 0 !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
    }

    /* CRITICAL: Ensure body starts AFTER header - prevent any overlap */
    .tfcl-mobile-filter-popup-content {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
    }

    .tfcl-mobile-filter-popup-header {
        flex-shrink: 0 !important;
        order: 1 !important;
    }

    .tfcl-mobile-filter-popup-body {
        flex: 1 1 auto !important;
        order: 2 !important;
        min-height: 0 !important;
        position: relative !important;
        z-index: 1 !important;
        padding-top: 0 !important;
        /* No top padding here - will be set in media query */
        padding-bottom: 100px !important;
        /* Space to prevent overlap with footer */
    }

    /* Ensure filter fields don't have high z-index that would overlap header/footer */
    .tfcl-mobile-filter-popup-body .tfcl-field,
    .tfcl-mobile-filter-popup-body .form-group,
    .tfcl-mobile-filter-popup-body .form-item {
        position: relative !important;
        z-index: auto !important;
    }

    /* Exception for Select2 dropdowns which need higher z-index */
    .tfcl-mobile-filter-popup-body .select2-container--open,
    .tfcl-mobile-filter-popup-body .select2-dropdown {
        z-index: 1000002 !important;
    }

    .tfcl-mobile-filter-popup-footer {
        flex-shrink: 0 !important;
        order: 3 !important;
    }

    .tfcl-mobile-filter-section {
        margin-bottom: 24px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .tfcl-mobile-filter-section:last-child {
        margin-bottom: 0;
    }

    /* Ensure form inside popup has full width and proper alignment */
    .tfcl-mobile-filter-popup-body .search-listing-form {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        display: block !important;
    }

    .tfcl-mobile-filter-popup-footer {
        position: sticky !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 16px 20px;
        background: #fff !important;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        flex-shrink: 0;
        z-index: 100 !important;
        width: 100%;
        margin-top: auto;
    }

    .tfcl-mobile-filter-popup-footer .tfcl-mobile-filter-apply-btn {
        width: 100%;
        padding: 16px 20px;
        background: var(--theme-primary-color, #ff6b35) !important;
        color: #fff;
        font-size: 16px;
        font-weight: 600;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: background 0.2s ease;
        position: relative;
        /* Ensure button stays in footer */
    }

    .tfcl-mobile-filter-popup-footer .tfcl-mobile-filter-apply-btn:hover {
        background: var(--theme-primary-color-hover, #e55a2b) !important;
    }

    .tfcl-mobile-filter-popup-footer .tfcl-mobile-filter-apply-btn:active {
        transform: scale(0.98);
    }

    /* Hide toolbar and other non-filter elements inside mobile popup - VERY AGGRESSIVE */
    /* This rule applies to ALL toolbar elements anywhere in the popup - MAXIMUM SPECIFICITY */
    /* Rules without .show class for cases where popup is shown via style attribute */
    .tfcl-mobile-filter-popup[style*="display: block"] .toolbar-search-list,
    .tfcl-mobile-filter-popup[style*="display: block"] .btn-display-listing-grid,
    .tfcl-mobile-filter-popup[style*="display: block"] .btn-display-listing-list,
    .tfcl-mobile-filter-popup[style*="display: block"] .filter-popup:not(.tfcl-mobile-filter-popup),
    .tfcl-mobile-filter-popup[style*="display: block"] .tf-search-more-btn:not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup[style*="display: block"] .wrap-reset-filter,
    .tfcl-mobile-filter-popup[style*="display: block"] .btn-condition-filter,
    .tfcl-mobile-filter-popup[style*="display: block"] select[name="sortby"],
    .tfcl-mobile-filter-popup[style*="display: block"] #listing_order_by,
    .tfcl-mobile-filter-popup[style*="display: block"] .group-filter-listing,
    .tfcl-mobile-filter-popup[style*="display: block"] .condition-tab-wrap,
    .tfcl-mobile-filter-popup[style*="display: block"] .tf-control-layout,
    .tfcl-mobile-filter-popup[style*="display: block"] .tf-search-condition-tab,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .toolbar-search-list,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .btn-display-listing-grid,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .btn-display-listing-list,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .filter-popup:not(.tfcl-mobile-filter-popup),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tf-search-more-btn:not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .wrap-reset-filter,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .btn-condition-filter,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show select[name="sortby"],
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show #listing_order_by,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .form-group:has(.btn-display-listing-grid),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .form-group:has(.btn-display-listing-list),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .form-group:has(select[name="sortby"]),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .form-group:has(#listing_order_by),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .inner:has(.btn-display-listing-grid),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .inner:has(.btn-display-listing-list),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .row.group-filter-listing,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .group-filter-listing,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .condition-tab-wrap,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tf-control-layout,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tf-search-condition-tab,
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .col-md-5:has(.condition-tab-wrap),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .col-md-6:has(.condition-tab-wrap),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .col-md-7:has(.toolbar-search-list),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .col-md-8:has(.toolbar-search-list),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .row:has(.group-filter-listing),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .row:has(.toolbar-search-list),
    /* Also target any container that might wrap toolbar elements */
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-field:has(.btn-display-listing-grid),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-field:has(.btn-display-listing-list),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-field:has(.toolbar-search-list),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .tfcl-field:has(select[name="sortby"]),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .search-listing-form:has(.btn-display-listing-grid),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .search-listing-form:has(.btn-display-listing-list),
    .tfcl-mobile-filter-popup.tfcl-mobile-filter-popup.show .search-listing-form:has(.toolbar-search-list) {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
        clip: rect(0, 0, 0, 0) !important;
        max-height: 0 !important;
        max-width: 0 !important;
        min-height: 0 !important;
        min-width: 0 !important;
        line-height: 0 !important;
        font-size: 0 !important;
    }

    /* Hide any select/dropdown in header that might be "Тип" or toolbar elements */
    .tfcl-mobile-filter-popup-header select:not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup-header .nice-select:not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup-header .form-group:has(select),
    .tfcl-mobile-filter-popup-header .form-group:has(.nice-select),
    .tfcl-mobile-filter-popup-header .form-group:has(.btn-display-listing-grid),
    .tfcl-mobile-filter-popup-header .form-group:has(.btn-display-listing-list),
    .tfcl-mobile-filter-popup-header .form-group:has(select[name="sortby"]),
    .tfcl-mobile-filter-popup-header .form-group:has(#listing_order_by),
    .tfcl-mobile-filter-popup-header .inner,
    .tfcl-mobile-filter-popup-header .row,
    .tfcl-mobile-filter-popup-header .col-md-4,
    .tfcl-mobile-filter-popup-header .col-md-5,
    .tfcl-mobile-filter-popup-header .col-md-6,
    .tfcl-mobile-filter-popup-header .col-md-7,
    .tfcl-mobile-filter-popup-header .col-md-8 {
        display: none !important;
    }

    /* Ensure header only contains title and close button - MAXIMUM SPECIFICITY */
    .tfcl-mobile-filter-popup-header>*:not(h3):not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup-header .toolbar-search-list,
    .tfcl-mobile-filter-popup-header .btn-display-listing-grid,
    .tfcl-mobile-filter-popup-header .btn-display-listing-list,
    .tfcl-mobile-filter-popup-header .filter-popup,
    .tfcl-mobile-filter-popup-header .tf-search-more-btn:not(.tfcl-mobile-filter-popup-close),
    .tfcl-mobile-filter-popup-header select[name="sortby"],
    .tfcl-mobile-filter-popup-header #listing_order_by,
    .tfcl-mobile-filter-popup-header .form-group,
    .tfcl-mobile-filter-popup-header .inner,
    .tfcl-mobile-filter-popup-header .row,
    .tfcl-mobile-filter-popup-header .col-md-4,
    .tfcl-mobile-filter-popup-header .col-md-5,
    .tfcl-mobile-filter-popup-header .col-md-6,
    .tfcl-mobile-filter-popup-header .col-md-7,
    .tfcl-mobile-filter-popup-header .col-md-8,
    .tfcl-mobile-filter-popup-header .group-filter-listing,
    .tfcl-mobile-filter-popup-header .condition-tab-wrap,
    .tfcl-mobile-filter-popup-header .tf-control-layout,
    .tfcl-mobile-filter-popup-header .tf-search-condition-tab {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
    }

    /* Force header to only show h3 and close button */
    .tfcl-mobile-filter-popup-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .tfcl-mobile-filter-popup-header h3 {
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 1 auto !important;
    }

    .tfcl-mobile-filter-popup-header .tfcl-mobile-filter-popup-close {
        flex: 0 0 auto !important;
        margin-left: auto !important;
    }

    body.tfcl-mobile-filter-popup-open {
        overflow: hidden;
    }

    /* Style fields inside popup */
    /* Apply margin-bottom to last visible field (set via JavaScript) */
    .tfcl-mobile-filter-popup-body .tfcl-field.tfcl-last-visible-field {
        margin-bottom: 7rem !important;
    }

    /* Fallback: if JavaScript doesn't run, use last-child but exclude hidden fields */
    .tfcl-mobile-filter-popup-body .tfcl-field:not(.tfcl-deps-hidden):not([style*="display: none"]):last-child {
        margin-bottom: 7rem !important;
    }

    @supports (-webkit-touch-callout: none) {
        .tfcl-mobile-filter-popup-body .tfcl-field.tfcl-last-visible-field {
            margin-bottom: calc(7rem + env(safe-area-inset-bottom, 0px)) !important;
        }

        .tfcl-mobile-filter-popup-body .tfcl-field:not(.tfcl-deps-hidden):not([style*="display: none"]):last-child {
            margin-bottom: calc(7rem + env(safe-area-inset-bottom, 0px)) !important;
        }
    }

    .tfcl-mobile-filter-popup-body .form-group,
    .tfcl-mobile-filter-popup-body .form-item {
        margin-bottom: 16px;
    }

    .tfcl-mobile-filter-popup-body label,
    .tfcl-mobile-filter-popup-body .form-group label,
    .tfcl-mobile-filter-popup-body .form-item label,
    .tfcl-mobile-filter-popup-body .tfcl-field label {
        display: block !important;
        margin-bottom: 8px;
        margin-top: 0 !important;
        padding-top: 0 !important;
        font-weight: 500;
        color: #1f2937;
        font-size: 14px;
        visibility: visible !important;
        opacity: 1 !important;
        line-height: 1.4 !important;
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
    }

    .tfcl-mobile-filter-popup-body select,
    .tfcl-mobile-filter-popup-body input[type="text"],
    .tfcl-mobile-filter-popup-body input[type="number"] {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        font-size: 16px;
        background: #fff;
    }

    .tfcl-mobile-filter-popup-body select:focus,
    .tfcl-mobile-filter-popup-body input[type="text"]:focus,
    .tfcl-mobile-filter-popup-body input[type="number"]:focus {
        outline: none;
        border-color: var(--theme-primary-color, #ff6b35);
        box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
    }

    /* Select2 styles inside popup */
    .tfcl-mobile-filter-popup-body .select2-container {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .tfcl-mobile-filter-popup-body .select2-container .select2-selection {
        width: 100% !important;
        padding: 12px 16px;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        font-size: 16px;
        background: #fff;
        box-sizing: border-box !important;
    }

    .tfcl-mobile-filter-popup-body .select2-container--default .select2-selection--single {
        height: auto !important;
        min-height: 48px;
    }

    .tfcl-mobile-filter-popup-body .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 24px;
        padding-left: 0;
        padding-right: 0;
    }

    .tfcl-mobile-filter-popup-body .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 46px;
        right: 8px;
    }

    /* CRITICAL: Ensure group-two-input displays correctly in popup - MAXIMUM SPECIFICITY */
    .tfcl-mobile-filter-popup-body .group-two-input,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-price .group-two-input,
    .tfcl-mobile-filter-popup-body .form-item .group-two-input {
        display: flex !important;
        gap: 12px !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        min-height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        position: relative !important;
        z-index: 1 !important;
    }

    /* CRITICAL: Ensure form-group containers inside group-two-input are visible and properly sized */
    .tfcl-mobile-filter-popup-body .group-two-input .form-group,
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-6,
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-12 {
        flex: 1 !important;
        margin-bottom: 0 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        position: relative !important;
        z-index: 1 !important;
        pointer-events: auto !important;
    }

    /* CRITICAL: Prevent col-md-12 from overlaying price inputs */
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-12 {
        pointer-events: none !important;
    }

    .tfcl-mobile-filter-popup-body .group-two-input .col-md-12 .form-group,
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-12 input {
        pointer-events: auto !important;
    }

    /* CRITICAL: Ensure input fields are visible and interactive */
    .tfcl-mobile-filter-popup-body .group-two-input input[type="number"],
    .tfcl-mobile-filter-popup-body .group-two-input input[type="text"],
    .tfcl-mobile-filter-popup-body .group-two-input select,
    .tfcl-mobile-filter-popup-body .group-two-input .form-group input[type="number"],
    .tfcl-mobile-filter-popup-body .group-two-input .form-group input[type="text"],
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-6 input[type="number"],
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-6 input[type="text"],
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-12 input[type="number"],
    .tfcl-mobile-filter-popup-body .group-two-input .col-md-12 input[type="text"] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 40px !important;
        margin: 0 !important;
        padding: 8px 12px !important;
        box-sizing: border-box !important;
        pointer-events: auto !important;
        -webkit-user-select: auto !important;
        -moz-user-select: auto !important;
        user-select: auto !important;
        cursor: text !important;
        position: relative !important;
        z-index: 2 !important;
    }

    /* Ensure inputs are not disabled or readonly */
    .tfcl-mobile-filter-popup-body .group-two-input input[type="number"]:disabled,
    .tfcl-mobile-filter-popup-body .group-two-input input[type="text"]:disabled,
    .tfcl-mobile-filter-popup-body .group-two-input select:disabled {
        pointer-events: none !important;
        opacity: 0.6 !important;
    }

    .tfcl-mobile-filter-popup-body .group-two-input input[type="number"]:not(:disabled),
    .tfcl-mobile-filter-popup-body .group-two-input input[type="text"]:not(:disabled),
    .tfcl-mobile-filter-popup-body .group-two-input select:not(:disabled) {
        pointer-events: auto !important;
        opacity: 1 !important;
    }

    /* CRITICAL: Ensure price field container is visible */
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-price,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-price .form-group,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-price .form-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        position: relative !important;
        z-index: 1 !important;
    }

    /* Ensure label is visible */
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-price label {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-bottom: 10px !important;
    }

    /* Ensure engine_power field and label are visible ONLY when not hidden by dependencies */
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power:not(.tfcl-deps-hidden):not(.tfcl-hidden):not([style*="display: none"]),
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power:not(.tfcl-deps-hidden):not(.tfcl-hidden):not([style*="display: none"]) .form-group,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power:not(.tfcl-deps-hidden):not(.tfcl-hidden):not([style*="display: none"]) .form-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure engine_power label is visible - all possible locations */
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power label,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power .form-group label,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power .form-item label,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power .listing-select-meta-box-wrap label,
    .tfcl-mobile-filter-popup-body .tfcl-field-listing-engine_power>label,
    /* Also ensure label is visible in generic fields with selectdiv */
    .tfcl-mobile-filter-popup-body .tfcl-field .form-group label,
    .tfcl-mobile-filter-popup-body .tfcl-field .form-item label,
    .tfcl-mobile-filter-popup-body .tfcl-field .listing-select-meta-box-wrap label {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-bottom: 8px !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
        font-weight: 500 !important;
        color: #1f2937 !important;
        font-size: 14px !important;
        line-height: 1.4 !important;
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
        height: auto !important;
        width: auto !important;
    }

    /* Ensure all fields are visible and properly styled in popup */
    .tfcl-mobile-filter-popup-body .tfcl-field {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        flex-basis: 100% !important;
        min-height: 40px !important;
        box-sizing: border-box !important;
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        overflow: visible !important;
        float: none !important;
        clear: both !important;
    }

    /* Ensure first field has space to prevent overlap with header */
    .tfcl-mobile-filter-popup-body .tfcl-field:first-child {
        margin-top: 4rem !important;
        /* Space to prevent overlap with header */
        padding-top: 0 !important;
    }

    .tfcl-mobile-filter-popup-body .tfcl-field:first-child label {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .tfcl-mobile-filter-popup-body .tfcl-field .form-group,
    .tfcl-mobile-filter-popup-body .tfcl-field .form-item,
    .tfcl-mobile-filter-popup-body .tfcl-field .listing-select-meta-box-wrap {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        min-height: 40px !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        float: none !important;
        clear: both !important;
    }

    /* Fix price slider and other range sliders in mobile popup */
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-price-wrap,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-year-wrap,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-mileage-wrap,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-door-wrap {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        margin: 20px 0 !important;
        overflow: visible !important;
    }

    .tfcl-mobile-filter-popup-body .tfcl-slider-range-price-wrap .range-slider,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-year-wrap .range-slider,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-mileage-wrap .range-slider,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-door-wrap .range-slider {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 10px !important;
        overflow: visible !important;
    }

    .tfcl-mobile-filter-popup-body .tfcl-slider-range-price-wrap label,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-year-wrap label,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-mileage-wrap label,
    .tfcl-mobile-filter-popup-body .tfcl-slider-range-door-wrap label {
        display: block !important;
        margin-bottom: 12px !important;
        font-weight: 500 !important;
        color: #1f2937 !important;
        font-size: 14px !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    /* Ensure slider container doesn't get cut off */
    .tfcl-mobile-filter-popup-body .tfcl-field:has(.tfcl-slider-range-price-wrap),
    .tfcl-mobile-filter-popup-body .tfcl-field:has(.tfcl-slider-range-year-wrap),
    .tfcl-mobile-filter-popup-body .tfcl-field:has(.tfcl-slider-range-mileage-wrap),
    .tfcl-mobile-filter-popup-body .tfcl-field:has(.tfcl-slider-range-door-wrap) {
        overflow: visible !important;
        padding-bottom: 20px !important;
    }

    /* Fix header to prevent text truncation */
    .tfcl-mobile-filter-popup-header {
        min-height: 60px !important;
        flex-wrap: nowrap !important;
    }

    .tfcl-mobile-filter-popup-header h3 {
        flex: 1 !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    /* Ensure popup body has proper padding and doesn't cut off content */
    .tfcl-mobile-filter-popup-body {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }

    /* Fix any text truncation in form elements */
    .tfcl-mobile-filter-popup-body .form-control,
    .tfcl-mobile-filter-popup-body .nice-select .current,
    .tfcl-mobile-filter-popup-body select {
        white-space: normal !important;
        text-overflow: clip !important;
        overflow: visible !important;
    }

    /* Hide desktop-only elements in popup */
    .tfcl-mobile-filter-popup-body .tfcl-hidden-mobile {
        display: none !important;
    }

    /* Ensure proper spacing between sections */
    .tfcl-mobile-filter-section+.tfcl-mobile-filter-section {
        margin-top: 24px;
        padding-top: 24px;
        border-top: 1px solid #e5e7eb;
    }

    /* Apply button should be fixed at bottom of screen on mobile */
    .mobile-filter-apply-btn {
        display: block !important;
        width: 100% !important;
        padding: 16px 20px !important;
        margin: 0 !important;
        background: var(--theme-primary-color, #007cba) !important;
        color: #fff !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        border: none !important;
        border-radius: 0 !important;
        cursor: pointer !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
        transition: background 0.2s ease !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000001 !important;
    }

    /* Ensure button is fixed even if it's inside a form */
    body.filter-popup-open .mobile-filter-apply-btn,
    body.tfcl-mobile-filter-active .mobile-filter-apply-btn,
    .search-listing-form.mobile-filter-active .mobile-filter-apply-btn,
    .tfcl_sidebar.mobile-filter-active .mobile-filter-apply-btn,
    .mobile-filter-fields .mobile-filter-apply-btn,
    .search-more-options.mobile .mobile-filter-apply-btn {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 1000001 !important;
    }

    .mobile-filter-apply-btn:hover {
        background: var(--theme-primary-color-hover, #006ba1) !important;
    }

    .mobile-filter-apply-btn:active {
        transform: scale(0.98) !important;
    }

    .mobile-filter-close {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 50%;
        font-size: 28px;
        line-height: 1;
        color: #333;
        cursor: pointer;
        z-index: 1001;
        transition: background 0.2s ease;
    }

    .mobile-filter-close:hover {
        background: rgba(0, 0, 0, 0.2);
    }

    /* Add padding to filter form to make room for fixed apply button */
    .search-listing-form.mobile-filter-active,
    .tfcl_sidebar.mobile-filter-active {
        padding-bottom: 80px !important;
    }

    .archive .filter-popup.enable-mobile svg {
        width: 18px;
        height: 18px;
    }

    .archive .filter-popup.enable-mobile span,
    .archive .filter-popup.enable-mobile i {
        pointer-events: none;
    }

    /* Restrict to archive pages - MOBILE ONLY */
    /* CRITICAL: These rules should ONLY apply on mobile, not desktop */
    /* Hide filters on mobile by default, show only when popup is active */
    .archive:not(.filter-popup-open) .search-listing-form:not(.mobile-filter-active),
    .archive:not(.filter-popup-open) .listing-sidebar:not(.mobile-filter-active),
    .archive:not(.filter-popup-open) .tfcl_sidebar:not(.mobile-filter-active) {
        display: none !important;
    }

    /* When mobile filter is active, show it as a slide-in panel */
    .archive .search-listing-form.mobile-filter-active,
    .archive .listing-sidebar.mobile-filter-active,
    .archive .tfcl_sidebar.mobile-filter-active {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 90vw !important;
        max-width: 420px !important;
        height: 100vh !important;
        z-index: 99999 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        background: #fff !important;
        padding: 24px 16px !important;
        /* box-shadow: -2px 0 8px rgba(0,0,0,.35) !important; */
        animation: fadeIn 0.3s ease !important;
    }

    /* Show search form when active - stronger selectors */
    .archive .search-listing-form.mobile-filter-active,
    .archive .listing-sidebar.mobile-filter-active,
    .archive .tfcl_sidebar.mobile-filter-active {
        display: block !important;
        animation: fadeIn 0.3s ease !important;
        right: 0 !important;
        left: auto !important;
        width: 90vw !important;
        max-width: 420px;
        background: #fff !important;
        padding: 24px 16px !important;
        /* box-shadow: -2px 0 8px rgba(0,0,0,.35); */
    }

    /* If wrapper is active, make sure inner form is visible (override default hidden form rule) */
    .archive .tfcl_sidebar.mobile-filter-active .search-listing-form,
    .archive .listing-sidebar.mobile-filter-active .search-listing-form,
    .archive .mobile-filter-active .search-listing-form {
        display: block !important;
        position: static !important;
        right: auto !important;
        left: auto !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    /* Force inner content to be visible when active */
    .archive .search-listing-form.mobile-filter-active .search-filter-inner,
    .archive .tfcl_sidebar.mobile-filter-active .search-filter-inner,
    .archive .mobile-filter-active .search-filter-inner,
    .archive .search-listing-form.mobile-filter-active .search-form-content,
    .archive .tfcl_sidebar.mobile-filter-active .search-form-content,
    .archive .mobile-filter-active .search-form-content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .archive .search-listing-form.mobile-filter-active .form-group,
    .archive .search-listing-form.mobile-filter-active .form-item,
    .archive .tfcl_sidebar.mobile-filter-active .form-group,
    .archive .tfcl_sidebar.mobile-filter-active .form-item {
        display: block !important;
    }
}

/* end mobile filter scope */


.archive .search-listing-form.mobile-filter-active .tfcl-advanced-search-wrap {
    background: white !important;
    margin: 20px !important;
    border-radius: 12px !important;
    padding: 20px !important;
    max-height: calc(100vh - 40px) !important;
    position: relative !important;
    display: block !important;
}

/* Add close button - stronger selectors */
body .search-listing-form.mobile-filter-active .search-form-content::before,
body .listing-sidebar.mobile-filter-active>div::before,
body .tfcl_sidebar.mobile-filter-active>div::before,
.archive .search-listing-form.mobile-filter-active .search-form-content::before,
.archive .listing-sidebar.mobile-filter-active>div::before,
.archive .tfcl_sidebar.mobile-filter-active>div::before,
body .search-listing-form.mobile-filter-active .tfcl-advanced-search-wrap::before,
.archive .search-listing-form.mobile-filter-active .tfcl-advanced-search-wrap::before {
    content: "✕" !important;
    position: absolute !important;
    top: 15px !important;
    right: 20px !important;
    font-size: 24px !important;
    color: #666 !important;
    cursor: pointer !important;
    z-index: 10 !important;
    width: 30px !important;
    height: 30px !important;
    display: none !important;
    pointer-events: none !important;
    /* hidden old cross */
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: #f5f5f5 !important;
}

/* Prevent body scroll when filter is open */
body.filter-popup-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Make filter form fields more mobile-friendly */
.search-listing-form.mobile-filter-active .form-group,
.search-listing-form.mobile-filter-active .form-item,
.listing-sidebar.mobile-filter-active .form-group,
.listing-sidebar.mobile-filter-active .form-item,
.tfcl_sidebar.mobile-filter-active .form-group,
.tfcl_sidebar.mobile-filter-active .form-item {
    margin-bottom: 20px;
}

.search-listing-form.mobile-filter-active input,
.search-listing-form.mobile-filter-active select,
.listing-sidebar.mobile-filter-active input,
.listing-sidebar.mobile-filter-active select,
.tfcl_sidebar.mobile-filter-active input,
.tfcl_sidebar.mobile-filter-active select {
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
}

/* Advanced search: make year lists two-row tall on desktop (homepage + others) */
@media only screen and (min-width: 992px) {
    .tfcl-advanced-search-wrap .tfcl-year-range-picker__grid {
        grid-auto-rows: 32px !important;
        max-height: calc(32px * 2 + 6px + 12px) !important;
        /* 2 rows + grid gap + inner padding */
        overflow-y: auto !important;
        gap: 6px !important;
        padding: 6px !important;
    }

    .tfcl-advanced-search-wrap .tfcl-year-range-picker__option {
        height: 32px !important;
        padding: 0 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Catalog (archive) page: force 1-column year lists in sidebar on desktop */
@media only screen and (min-width: 992px) {
    .archive .tfcl-year-range-picker__grid {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
        max-height: 240px !important;
    }

    .archive .tfcl-year-range-picker__option {
        font-size: 13px !important;
        padding: 0 6px !important;
        height: 32px !important;
    }
}

/* Elementor/homepage: prevent squashed UI for price and labels */
.tfcl-advanced-search-wrap .tfcl-field .form-group label,
.search-listing-form .tfcl-field .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.tfcl-advanced-search-wrap .tfcl-field .group-two-input,
.search-listing-form .tfcl-field .group-two-input {
    display: flex;
    gap: 8px;
}

.tfcl-advanced-search-wrap .tfcl-field .group-two-input .form-group,
.search-listing-form .tfcl-field .group-two-input .form-group {
    flex: 1 1 0;
}

/* Desktop: prevent squashed filters in Elementor top row (style1/style2/etc.) */
@media only screen and (min-width: 992px) {
    .tf-search-wrap .tfcl-search-form-top.desktop {
        display: flex;
        gap: 12px;
        align-items: stretch;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field {
        flex: 1 1 0;
        min-width: 180px;
        overflow: visible;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field .form-group,
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field .form-item {
        width: 100%;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .wrap-search-form-btn {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Ensure select controls stretch to full column width */
    .tf-search-wrap .tfcl-search-form-top.desktop .select2-container,
    .tf-search-wrap .tfcl-search-form-top.desktop .nice-select,
    .tf-search-wrap .tfcl-search-form-top.desktop select.search-field,
    .tf-search-wrap .tfcl-search-form-top.desktop input.search-field,
    .tf-search-wrap .tfcl-search-form-top.desktop input[type="number"].search-field {
        width: 100% !important;
    }

    /* Show labels above fields */
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field .form-group label {
        display: block;
        margin-bottom: 6px;
        font-weight: 500;
    }

    /* Ensure year input fields are visible */
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-from,
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-to {
        display: flex !important;
        flex-direction: column;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-from .form-item,
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-to .form-item {
        width: 100%;
        margin: 0;
    }
}

/* Mobile filter Select2 dropdown positioning */
@media (max-width: 991px) {

    /* Ensure Select2 dropdown appears above mobile filter and map popup filter */
    body.filter-popup-open .select2-container--open .select2-dropdown,
    body.filter-search-map .select2-container--open .select2-dropdown {
        position: absolute !important;
    }

    .tfcl-mobile-filter-popup-body .select2-container--open,
    .tfcl-mobile-filter-popup-body .select2-dropdown {
        /* Default z-index handled by select2 */
    }

    /* CRITICAL: Ensure Select2 dropdown on homepage/archive is above sticky toolbar (z-index: 1000) */
    /* Note: Select2 dropdown is rendered in body, not inside the form, so we need global selector */
    .select2-container--open .select2-dropdown {
        z-index: 1002 !important;
        position: absolute !important;
    }

    /* Also ensure the Select2 container itself has proper z-index */
    .select2-container--open {
        z-index: 1002 !important;
    }

    /* Hide sidebar on mobile when NOT active as popup */
    .sidebar-archive:not(.mobile-filter-sidebar-active) {
        display: none !important;
    }

    /* Select2 container in mobile filter */
    body.filter-popup-open .select2-container,
    body.tfcl-mobile-filter-popup-open .select2-container,
    .tfcl-mobile-filter-popup-open .select2-container--open,
    .filter-popup-open .select2-container--open,
    body.tfcl-mobile-filter-popup-open .select2-container--open .select2-dropdown {
        /* let select2 handle naturally */
    }

    body.tfcl-mobile-filter-popup-open>.select2-container {
        position: absolute !important;
    }

    /* Ensure year range fields display in one row on mobile, like price fields */
    .search-listing-form .tfcl-field-listing-year-range .group-two-input,
    .tfcl-search-form-top.mobile .tfcl-field-listing-year-range .group-two-input {
body.filter-popup-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Make filter form fields more mobile-friendly */
.search-listing-form.mobile-filter-active .form-group,
.search-listing-form.mobile-filter-active .form-item,
.listing-sidebar.mobile-filter-active .form-group,
.listing-sidebar.mobile-filter-active .form-item,
.tfcl_sidebar.mobile-filter-active .form-group,
.tfcl_sidebar.mobile-filter-active .form-item {
    margin-bottom: 20px;
}

.search-listing-form.mobile-filter-active input,
.search-listing-form.mobile-filter-active select,
.listing-sidebar.mobile-filter-active input,
.listing-sidebar.mobile-filter-active select,
.tfcl_sidebar.mobile-filter-active input,
.tfcl_sidebar.mobile-filter-active select {
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
}

/* Advanced search: make year lists two-row tall on desktop (homepage + others) */
@media only screen and (min-width: 992px) {
    .tfcl-advanced-search-wrap .tfcl-year-range-picker__grid {
        grid-auto-rows: 32px !important;
        max-height: calc(32px * 2 + 6px + 12px) !important;
        /* 2 rows + grid gap + inner padding */
        overflow-y: auto !important;
        gap: 6px !important;
        padding: 6px !important;
    }

    .tfcl-advanced-search-wrap .tfcl-year-range-picker__option {
        height: 32px !important;
        padding: 0 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Catalog (archive) page: force 1-column year lists in sidebar on desktop */
@media only screen and (min-width: 992px) {
    .archive .tfcl-year-range-picker__grid {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
        max-height: 240px !important;
    }

    .archive .tfcl-year-range-picker__option {
        font-size: 13px !important;
        padding: 0 6px !important;
        height: 32px !important;
    }
}

/* Elementor/homepage: prevent squashed UI for price and labels */
.tfcl-advanced-search-wrap .tfcl-field .form-group label,
.search-listing-form .tfcl-field .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.tfcl-advanced-search-wrap .tfcl-field .group-two-input,
.search-listing-form .tfcl-field .group-two-input {
    display: flex;
    gap: 8px;
}

.tfcl-advanced-search-wrap .tfcl-field .group-two-input .form-group,
.search-listing-form .tfcl-field .group-two-input .form-group {
    flex: 1 1 0;
}

/* Desktop: prevent squashed filters in Elementor top row (style1/style2/etc.) */
@media only screen and (min-width: 992px) {
    .tf-search-wrap .tfcl-search-form-top.desktop {
        display: flex;
        gap: 12px;
        align-items: stretch;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field {
        flex: 1 1 0;
        min-width: 180px;
        overflow: visible;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field .form-group,
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field .form-item {
        width: 100%;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .wrap-search-form-btn {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* Ensure select controls stretch to full column width */
    .tf-search-wrap .tfcl-search-form-top.desktop .select2-container,
    .tf-search-wrap .tfcl-search-form-top.desktop .nice-select,
    .tf-search-wrap .tfcl-search-form-top.desktop select.search-field,
    .tf-search-wrap .tfcl-search-form-top.desktop input.search-field,
    .tf-search-wrap .tfcl-search-form-top.desktop input[type="number"].search-field {
        width: 100% !important;
    }

    /* Show labels above fields */
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field .form-group label {
        display: block;
        margin-bottom: 6px;
        font-weight: 500;
    }

    /* Ensure year input fields are visible */
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-from,
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-to {
        display: flex !important;
        flex-direction: column;
    }

    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-from .form-item,
    .tf-search-wrap .tfcl-search-form-top.desktop .tfcl-field-listing-year-to .form-item {
        width: 100%;
        margin: 0;
    }
}

/* Mobile filter Select2 dropdown positioning */
@media (max-width: 991px) {

    /* Ensure Select2 dropdown appears above mobile filter and map popup filter */
    body.filter-popup-open .select2-container--open .select2-dropdown,
    body.filter-search-map .select2-container--open .select2-dropdown {
        position: absolute !important;
    }

    .tfcl-mobile-filter-popup-body .select2-container--open,
    .tfcl-mobile-filter-popup-body .select2-dropdown {
        /* Default z-index handled by select2 */
    }

    /* CRITICAL: Ensure Select2 dropdown on homepage/archive is above sticky toolbar (z-index: 1000) */
    /* Note: Select2 dropdown is rendered in body, not inside the form, so we need global selector */
    .select2-container--open .select2-dropdown {
        z-index: 1002 !important;
        position: absolute !important;
    }

    /* Also ensure the Select2 container itself has proper z-index */
    .select2-container--open {
        z-index: 1002 !important;
    }

    /* Hide sidebar on mobile when NOT active as popup */
    .sidebar-archive:not(.mobile-filter-sidebar-active) {
        display: none !important;
    }

    /* Select2 container in mobile filter */
    body.filter-popup-open .select2-container,
    body.tfcl-mobile-filter-popup-open .select2-container,
    .tfcl-mobile-filter-popup-open .select2-container--open,
    .filter-popup-open .select2-container--open,
    body.tfcl-mobile-filter-popup-open .select2-container--open .select2-dropdown {
        /* let select2 handle naturally */
    }

    body.tfcl-mobile-filter-popup-open>.select2-container {
        position: absolute !important;
    }

    /* Ensure year range fields display in one row on mobile, like price fields */
    .search-listing-form .tfcl-field-listing-year-range .group-two-input,
    .tfcl-search-form-top.mobile .tfcl-field-listing-year-range .group-two-input {
        display: flex !important;
        gap: 8px;
    }

    .search-listing-form .tfcl-field-listing-year-range .group-two-input .form-group,
    .tfcl-search-form-top.mobile .tfcl-field-listing-year-range .group-two-input .form-group {
        flex: 1 1 0;
        min-width: 0;
    }

    .search-listing-form .tfcl-field-listing-year-range .group-two-input .col-md-6,
    .tfcl-search-form-top.mobile .tfcl-field-listing-year-range .group-two-input .col-md-6 {
        flex: 1 1 0;
        max-width: none;
        width: auto;
    }
}

    /* ========================================
     Homepage Compact Sticky Toolbar
     Styled to match catalog page toolbar
     ======================================== */
    .tfcl-homepage-compact-toolbar {
        position: fixed;
        top: var(--tfcl-sticky-header-height, 70px);
        left: 0;
        right: 0;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 8px 12px;
        margin: 0 10px;
        width: calc(100% - 20px);
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        border-radius: 12px;
        transform: translateY(-120%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        box-sizing: border-box;
    }

    @media only screen and (min-width: 992px) {
        .tfcl-homepage-compact-toolbar {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }
    }

    .tfcl-homepage-compact-toolbar.visible {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .tfcl-compact-sort-wrap {
        flex: 1;
        min-width: 0;
    }

    .tfcl-compact-sort-wrap select.tfcl-compact-sort {
        width: 100%;
        padding: 10px 35px 10px 12px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        font-size: 14px;
        background: #fff;
        cursor: pointer;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
    }

    /* Style filter button to match catalog page exactly */
    .tfcl-compact-filter-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 15px;
        background: var(--theme-primary-color, #F7941D);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.3s ease;
    }

    .tfcl-compact-filter-btn:hover {
        background: var(--theme-primary-color-hover, #e6850f);
    }

    .tfcl-compact-filter-btn svg {
        flex-shrink: 0;
        width: 16px;
        height: 16px;
        fill: currentColor;
    }

    /* Hide compact toolbar when filter popup is open */
    body.filter-popup-open .tfcl-homepage-compact-toolbar,
    body.tfcl-mobile-filter-popup-open .tfcl-homepage-compact-toolbar {
        display: none !important;
    }

    /* Smooth transitions for homepage elements when compact toolbar activates */
    body.home .tf-search-wrap,
    body.home .toolbar-search-list,
    /* Hide old filter block on homepage when compact toolbar is visible */
    body.home.tfcl-compact-toolbar-active .tf-search-wrap {
        position: relative !important;
    }

    /* Hide the original toolbar on homepage when compact toolbar is visible */
    body.home.tfcl-compact-toolbar-active .listing-list-wrap .toolbar-search-list,
    body.home.tfcl-compact-toolbar-active .listing-list-wrap .group-filter-listing {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Smooth scroll margin for content when compact toolbar appears */
    body.home.tfcl-compact-toolbar-active .group-card-item-listing {
        scroll-margin-top: calc(var(--tfcl-sticky-header-height, 70px) + 60px);
        transition: scroll-margin-top 0.3s ease;
    }
