/**
 * Custom Search Results - Clean, responsive design.
 * Aligned to theme's 1600px wideSize.
 */

.circulate-search-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.wp-block-search__inside-wrapper{
    display: flex;
}

.circulate-search-bar {
    margin: 30px auto 60px auto !important;
}

.circulate-products-area p:empty {
    margin: 0 !important;
}

/* ----- Toolbar (Hide Filter / Sort / Result Count) ----- */
.circulate-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    border-top: 1px solid var(--wp--preset--color--gray-100, #e5e5e5);
    padding: 18px 0;
    margin-bottom: 30px;
}

.circulate-toolbar p:empty {
    display: none;
}

.circulate-toolbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-family: var(--wp--preset--font-family--dmsans) !important;
}

.circulate-toolbar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-right: 20px;
    border-right: 1px solid var(--wp--preset--color--gray-100, #e5e5e5);
    background: transparent;
    border-top: 0;
    border-left: 0;
    border-bottom: 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--wp--preset--color--contrast, #111);
    text-transform: capitalize;
    font-size: 14px;
    font-family: var(--wp--preset--font-family--dmsans) !important;
}

.circulate-toolbar-toggle:hover {
    opacity: 0.7;
}

.circulate-toolbar-toggle svg {
    width: 16px;
    height: 16px;
}

.circulate-sort-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.circulate-sort-form .orderby {
    border: none;
    background: transparent;
    color: var(--wp--preset--color--fq-text, #666);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 0;
}

.circulate-results-count {
    font-size: 14px;
    color: var(--wp--preset--color--fq-text, #666);
}

/* ----- Layout (Sidebar + Products) ----- */
.circulate-layout {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    position: relative;
}

.circulate-filter-sidebar {
    flex: 0 0 300px;
    border-right: 1px solid var(--wp--preset--color--gray-100, #e5e5e5);
    padding-right: 32px;
    transition: opacity 0.2s ease;
}

.circulate-products-area {
    flex: 1 1 auto;
    min-width: 0;
}

.circulate-layout.sidebar-hidden .circulate-filter-sidebar {
    display: none;
}

/* ----- Filters ----- */
.circulate-filters-form {
    display: block;
}

.circulate-filters-form > h2 {
    margin: 0 0 24px;
    font-size: 24px;
    font-weight: 500;
}

.circulate-filter-group {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--wp--preset--color--gray-100, #e5e5e5);
}

.circulate-filter-group:last-child {
    border-bottom: 0;
}

.circulate-filter-group h3 {
    font-size: 19px;
    font-weight: 400;
    text-transform: capitalize;
    margin: 0 0 16px;
    font-family: var(--wp--preset--font-family--fraunces);
}

.circulate-filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.circulate-filter-list li {
    margin: 0 0 10px;
}

.circulate-filter-list label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    transition: color 0.15s ease;
    font-weight: 400;
}

.circulate-filter-list label:hover {
    color: var(--wp--preset--color--contrast, #111);
}

.circulate-filter-list .label-text {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
}

.circulate-filter-list .label-count {
    color: #999;
    font-size: 13px;
    flex: 0 0 auto;
}

.circulate-filter-list input[type="checkbox"] {
    width: 18.5px;
    height: 18.5px;
    margin: 0;
    accent-color: var(--wp--preset--color--contrast, #111);
    cursor: pointer;
}

/* Active filter chips */
.circulate-active-filters {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--wp--preset--color--gray-100, #e5e5e5);
}

.circulate-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f5f5f5;
    padding: 5px 12px;
    border-radius: 3px;
    margin: 0 6px 6px 0;
    font-size: 13px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.circulate-active-chip:hover {
    background: #e8e8e8;
}

.circulate-active-chip .chip-x {
    font-size: 16px;
    line-height: 1;
}

.circulate-clear-all {
    display: inline-block;
    font-size: 13px;
    text-decoration: underline;
    margin-top: 6px;
    color: var(--wp--preset--color--contrast, #111);
}

/* Price filter — dual range slider */
.circulate-price-slider-wrap {
    position: relative;
    height: 24px;
    margin: 8px 0 20px;
}

.circulate-price-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    height: 2px;
    background: var(--wp--preset--color--gray-100, #ddd);
    border-radius: 2px;
    pointer-events: none;
    z-index: 1;
}

.circulate-price-range-fill {
    position: absolute;
    height: 100%;
    background: var(--wp--preset--color--contrast, #111);
    border-radius: 2px;
}

/* Both range inputs stacked on the same track */
.circulate-range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 100%;
    height: 2px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 2;
    margin: 0;
    padding: 0;
    outline: none;
}

/* Thumb — Webkit */
.circulate-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid var(--wp--preset--color--contrast, #111);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    transition: box-shadow 0.15s ease;
}

.circulate-range::-webkit-slider-thumb:hover,
.circulate-range::-webkit-slider-thumb:active {
    box-shadow: 0 0 0 4px rgba(0,0,0,0.08);
}

/* Thumb — Firefox */
.circulate-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid var(--wp--preset--color--contrast, #111);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* Price text inputs below the slider */
.circulate-price-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.circulate-price-input-wrap {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    border: 1px solid var(--wp--preset--color--gray-100, #ddd);
    border-radius: 4px;
    padding: 0 10px;
    height: 38px;
    gap: 4px;
}

.price-currency {
    font-size: 13px;
    color: var(--wp--preset--color--fq-text, #888);
    flex: 0 0 auto;
    line-height: 1;
}

.circulate-price-input {
    flex: 1 1 auto;
    width: 100%;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--wp--preset--color--contrast, #111);
    background: transparent;
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0;
}

.circulate-price-input::-webkit-outer-spin-button,
.circulate-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ----- Products area / Loading state ----- */
.circulate-products-area {
    transition: opacity 0.2s ease;
    position: relative;
}

.circulate-products-area.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

.circulate-loader {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border: 3px solid var(--wp--preset--color--gray-100, #e5e5e5);
    border-top-color: var(--wp--preset--color--contrast, #111);
    border-radius: 50%;
    animation: circulate-spin 0.7s linear infinite;
    pointer-events: none;
    opacity: 0;
    z-index: 5;
    transition: opacity 0.2s ease;
}

.circulate-products-area.is-loading .circulate-loader {
    opacity: 1;
}

@keyframes circulate-spin {
    to { transform: translateX(-50%) rotate(360deg); }
}

/* ----- No results ----- */
.circulate-no-results {
    padding: 60px 20px;
    text-align: center;
}

.circulate-no-results p:first-child {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.circulate-no-results a {
    text-decoration: underline;
    color: var(--wp--preset--color--contrast, #111);
}

/* ----- Pagination ----- */
.circulate-pagination {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--wp--preset--color--gray-100, #e5e5e5);
    text-align: center;
}

.circulate-pagination .page-numbers {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.circulate-pagination .page-numbers li {
    margin: 0;
}

.circulate-pagination .page-numbers a,
.circulate-pagination .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 26px;
    border: none;
    background: none;
    text-decoration: none;
    color: var(--wp--preset--color--contrast, #111);
    font-size: 15px;
    border-radius: 0;
    transition: all 0.15s ease;
}



.prev.page-numbers,
.next.page-numbers{
    display: flex!important;
    width: 100%!important;
}

.prev.page-numbers:hover,
.next.page-numbers:hover{
    border: none!important;
}



.circulate-pagination .page-numbers .current {
    background: none;
    color: var(--wp--preset--color--contrast, #111);
    font-weight: 500;
    border-bottom: 2px solid var(--wp--preset--color--contrast, #111);
}

.circulate-pagination .page-numbers .dots {
    border: none;
}

/* ----- Responsive ----- */
@media (max-width: 900px) {
    .circulate-layout {
        flex-direction: column;
        gap: 20px;
    }

    .circulate-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Hide desktop sidebar on mobile */
    .circulate-filter-sidebar {
        position: fixed;
        inset: 0;
        z-index: 99999;
        flex: none;
        border-right: 0;
        padding-right: 0;
        padding-bottom: 0;
        background: transparent;
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    /* Overlay backdrop */
    .circulate-filter-sidebar::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    /* Filter dialog (slides up from bottom) */
    .circulate-filter-sidebar .circulate-filters-form {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 95vh;
        background: var(--wp--preset--color--base, #fff);
        padding: 0 24px 24px;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    }

    /* Mobile filter header (close handle + title) */
    .circulate-mobile-filter-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        background: var(--wp--preset--color--base, #fff);
        padding: 20px 0 16px;
        border-bottom: 1px solid var(--wp--preset--color--gray-100, #e5e5e5);
        margin-bottom: 20px;
        z-index: 2;
    }

    .circulate-mobile-filter-header h3 {
        font-size: 18px;
        font-weight: 600;
        margin: 0;
    }

    .circulate-mobile-filter-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: transparent;
        border: none;
        cursor: pointer;
        font-size: 24px;
        color: var(--wp--preset--color--contrast, #111);
        padding: 0;
    }

    /* Open state */
    .circulate-filter-sidebar.mobile-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .circulate-filter-sidebar.mobile-open::before {
        opacity: 1;
    }

    .circulate-filter-sidebar.mobile-open .circulate-filters-form {
        transform: translateY(0);
    }

    /* Override sidebar-hidden on mobile — filter toggle opens popup instead */
    .circulate-layout.sidebar-hidden .circulate-filter-sidebar {
        display: block;
    }

    /* Change toolbar toggle to "Filter" button style on mobile */
    .circulate-toolbar-toggle {
        border-right: 0 !important;
        padding-right: 0 !important;
    }

    .circulate-toolbar-toggle .toggle-label {
        font-size: 14px;
    }
}

/* Desktop: hide mobile filter header */
@media (min-width: 901px) {
    .circulate-mobile-filter-header {
        display: none;
    }
}
