/* ================================================
   JW Product Filter — filter.css v4
   ================================================ */

/* ── Clearfix on WooCommerce container ─────────── */
.woocommerce-page .woocommerce::after,
body.woocommerce .woocommerce::after,
.woocommerce::after {
    content: "";
    display: table;
    clear: both;
}

/* ── Sidebar: floats left ──────────────────────── */
.jwf-sidebar {
    float: left;
    width: 220px;
    box-sizing: border-box;
    padding-right: 30px;
}

/* ── Products col: BFC beside float ───────────── */
.jwf-products-col {
    overflow: hidden;
    min-width: 0;
    box-sizing: border-box;
}

/* ── Toolbar ───────────────────────────────────── */
.jwf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── FIX: WooCommerce ghost ::before on ul.products ─
   WooCommerce adds a clearfix ::before that creates
   an empty "ghost" first item. Neutralize it.        */
.jwf-products-col ul.products::before {
    display: none !important;
    content: none !important;
}

/* ── Products grid: 4 columns, equal row height ── */
.jwf-products-col ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 24px 16px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: none !important;
    list-style: none !important;
    align-items: stretch !important; /* equal height per row */
}

@media (max-width: 1300px) {
    .jwf-products-col ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 960px) {
    .jwf-products-col ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/*
 * WooCommerce product card HTML structure:
 * <li.product>
 *   <a.woocommerce-loop-product__link>   ← contains image, category, title, price
 *     <img>
 *     <span.woocommerce-loop-category__title>Category</span>
 *     <h2.woocommerce-loop-product__title>Title</h2>
 *     <span.price>$450</span>
 *   </a>
 *   <a.button.add_to_cart_button>ADD TO CART</a>  ← SIBLING of the link
 * </li>
 *
 * Strategy:
 * - li.product = flex column
 * - a.link    = flex:1 column (takes all space above button)
 * - img       = fixed square, flex-shrink:0
 * - title     = flex:1 inside link (stretches, aligns price+button)
 * - price     = flex-shrink:0
 * - button    = flex-shrink:0, sits below the link block
 */

/* ── Card container ──────────────────────────── */
.jwf-products-col ul.products li.product {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff;
    display: flex !important;
    flex-direction: column !important;
    width: auto !important;
    float: none !important;
    clear: none !important;
}

/* ── Link block (image + meta + title + price) ── */
.jwf-products-col ul.products li.product a.woocommerce-loop-product__link {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    text-decoration: none !important;
    color: inherit !important;
    padding: 0 !important;
}

/* ── Product image ───────────────────────────── */
.jwf-products-col ul.products li.product img {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    background: #f5f2ee !important;
    padding: 14px !important;
    display: block !important;
    flex-shrink: 0 !important;
    transition: opacity .22s !important;
    border: none !important;
    margin: 0 !important;
    height: auto !important;
    box-sizing: border-box !important;
}
.jwf-products-col ul.products li.product:hover img {
    opacity: .82 !important;
}

/* ── Category label ──────────────────────────── */
.jwf-products-col ul.products li.product .woocommerce-loop-category__title {
    font-size: 10px !important;
    letter-spacing: .12em !important;
    text-transform: uppercase !important;
    color: #b5935a !important;
    margin: 12px 0 0 !important;
    padding: 0 !important;
    font-weight: 400 !important;
    font-family: inherit !important;
    display: block !important;
    text-align: left !important;
}

/* ── Title — grows to fill remaining space ───── */
.jwf-products-col ul.products li.product .woocommerce-loop-product__title {
    flex: 1 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    color: #1a1a1a !important;
    margin: 6px 0 8px !important;
    padding: 0 !important;
    font-family: inherit !important;
    display: block !important;
    text-align: left !important;
}

/* ── Price ───────────────────────────────────── */
.jwf-products-col ul.products li.product .price {
    font-size: 14px !important;
    color: #3a3028 !important;
    font-weight: 500 !important;
    font-family: inherit !important;
    margin: 0 0 10px !important;
    padding: 0 !important;
    display: block !important;
    flex-shrink: 0 !important;
    text-align: left !important;
}
.jwf-products-col ul.products li.product .price ins {
    text-decoration: none !important;
    font-weight: 500 !important;
}
.jwf-products-col ul.products li.product .price del {
    opacity: .45 !important;
    font-size: 11px !important;
    margin-right: 4px !important;
}

/* ── Dimensions (fetched from product description) ──── */
.jwf-products-col ul.products li.product .jwf-card-dimensions {
    font-size: 10.5px !important;
    color: #8a8378 !important;
    letter-spacing: .03em !important;
    margin: -4px 0 10px !important;
    padding: 0 !important;
    font-family: inherit !important;
    display: block !important;
    flex-shrink: 0 !important;
    text-align: left !important;
}

/* ── Add to cart button ──────────────────────── */
.jwf-products-col ul.products li.product .button,
.jwf-products-col ul.products li.product .add_to_cart_button,
.jwf-products-col ul.products li.product a.button {
    display: block !important;
    width: 100% !important;
    padding: 13px 10px !important;
    background: #1a1a1a !important;
    color: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    font-family: inherit !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    letter-spacing: .18em !important;
    text-transform: uppercase !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: background .2s !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}
.jwf-products-col ul.products li.product .button:hover,
.jwf-products-col ul.products li.product .add_to_cart_button:hover,
.jwf-products-col ul.products li.product a.button:hover {
    background: #b5935a !important;
    color: #fff !important;
}

/* ── Loading overlay ───────────────────────────── */
.jwf-products-col { position: relative; }
.jwf-loading {
    position: absolute; inset: 0;
    background: rgba(255,255,255,.7); z-index: 10;
    display: flex; align-items: flex-start;
    justify-content: center; padding-top: 80px;
    pointer-events: none;
}
.jwf-spinner {
    width: 30px; height: 30px;
    border: 2px solid #e0d8ce;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: jwf-spin .7s linear infinite;
}
@keyframes jwf-spin { to { transform: rotate(360deg); } }

.jwf-no-results {
    font-size: 14px; color: #888; letter-spacing: .06em;
    padding: 60px 0; text-align: center;
    width: 100%; font-family: inherit;
}

/* ── Result count + ordering ───────────────────── */
.woocommerce-result-count {
    font-size: 12px; letter-spacing: .06em;
    color: #888; margin: 0; font-family: inherit;
}
.woocommerce-ordering { margin-bottom: 0 !important; }
.woocommerce-ordering select {
    font-family: inherit; font-size: 11px; letter-spacing: .06em;
    border: 1px solid #d8d0c6; padding: 7px 28px 7px 10px;
    -webkit-appearance: none; appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 10px;
}

/* ── Filter panel title (desktop) ─────────────── */
.jwf-panel-title-desk {
    font-size: 11px; font-weight: 700; letter-spacing: .28em;
    text-transform: uppercase; color: #1a1a1a;
    padding-bottom: 14px; border-bottom: 2px solid #1a1a1a;
    margin-bottom: 2px; font-family: inherit;
}

/* ── Panel ─────────────────────────────────────── */
.jwf-panel { background: #fff; }
.jwf-panel-header { display: none; }
.jwf-mob-trigger { display: none; }
.jwf-mob-apply {
    display: none; position: fixed;
    bottom: 0; left: 0; width: 100%;
    background: #1a1a1a; color: #fff; border: none; padding: 16px;
    font-family: inherit; font-size: 11px; font-weight: 700;
    letter-spacing: .2em; text-transform: uppercase; cursor: pointer; z-index: 2001;
}
.jwf-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 1998;
}
.jwf-overlay.is-open { display: block; }

/* ── Sections ──────────────────────────────────── */
.jwf-section { border-bottom: 1px solid #e8e2d9; }
.jwf-section-header {
    width: 100%; display: flex; align-items: center;
    justify-content: space-between; padding: 13px 0;
    background: none; border: none; cursor: pointer;
    font-family: inherit; font-size: 9.5px; font-weight: 700;
    letter-spacing: .22em; text-transform: uppercase;
    color: #1a1a1a; text-align: left; transition: color .15s;
}
.jwf-section-header:hover { color: #b5935a; }
.jwf-chevron { flex-shrink: 0; transition: transform .22s; opacity: .6; }
.jwf-section-header.is-open .jwf-chevron { transform: rotate(180deg); }
.jwf-section-body { display: none; padding-bottom: 12px; }
.jwf-section-body.is-open { display: block; }

/* ── Category links ────────────────────────────── */
.jwf-cat-link {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 2px; font-size: 12px; color: #3a3028;
    text-decoration: none; transition: color .14s; line-height: 1.3;
    font-family: inherit;
}
.jwf-cat-link:hover { color: #b5935a; }
.jwf-cat-link.is-active { color: #1a1a1a; font-weight: 600; }
.jwf-cat-link.is-active .jwf-cat-dot { background: #1a1a1a; border-color: #1a1a1a; }
.jwf-cat-dot {
    width: 10px; height: 10px; flex-shrink: 0;
    border: 1px solid #ccc; border-radius: 2px; transition: all .14s;
}
.jwf-cat-count { font-size: 9.5px; color: #bbb; font-weight: 400; margin-left: auto; }

/* ── Search input ──────────────────────────────── */
.jwf-search-input {
    width: 100%; border: 1px solid #e0d8ce; padding: 5px 8px;
    margin-bottom: 8px; font-family: inherit; font-size: 11px;
    outline: none; color: #3a3028; letter-spacing: .04em; box-sizing: border-box;
}
.jwf-search-input:focus { border-color: #b5935a; }

/* ── Checkbox list ─────────────────────────────── */
.jwf-checkbox-list {
    display: flex; flex-direction: column; gap: 1px;
    max-height: 220px; overflow-y: auto;
}
.jwf-checkbox-list::-webkit-scrollbar { width: 3px; }
.jwf-checkbox-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.jwf-checkbox-row {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 3px; cursor: pointer; font-size: 12px;
    color: #3a3028; border-radius: 2px; transition: background .12s;
    user-select: none; font-family: inherit;
}
.jwf-checkbox-row:hover { background: #faf6ee; }
.jwf-checkbox-row.is-checked { color: #1a1a1a; font-weight: 600; }
.jwf-checkbox-row input[type="checkbox"] { display: none; }

.jwf-custom-cb {
    width: 12px; height: 12px; flex-shrink: 0;
    border: 1px solid #ccc; border-radius: 2px;
    position: relative; transition: all .14s;
}
.jwf-checkbox-row.is-checked .jwf-custom-cb {
    background: #1a1a1a; border-color: #1a1a1a;
}
.jwf-checkbox-row.is-checked .jwf-custom-cb::after {
    content: "";
    position: absolute; left: 3px; top: 1px;
    width: 4px; height: 7px;
    border: 1.5px solid #fff; border-top: none; border-left: none;
    transform: rotate(40deg);
}
.jwf-cb-text { flex: 1; }
.jwf-cb-count { font-size: 9.5px; color: #bbb; font-weight: 400; }

/* ── Color swatch ──────────────────────────────── */
.jwf-color-swatch {
    width: 13px; height: 13px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,.12); flex-shrink: 0;
}

/* ── Subsection label ──────────────────────────── */
.jwf-subsection-label {
    font-size: 9px; font-weight: 700; letter-spacing: .18em;
    text-transform: uppercase; color: #aaa;
    margin-bottom: 5px; margin-top: 6px; font-family: inherit;
}

/* ── Active filter tags ────────────────────────── */
.jwf-active-wrap {
    padding: 10px 8px; background: #faf7f2;
    margin-top: 8px; border-radius: 2px;
}
.jwf-active-label {
    font-size: 9px; letter-spacing: .15em; font-family: inherit;
    text-transform: uppercase; color: #aaa; margin-bottom: 6px;
}
.jwf-active-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.jwf-active-tag {
    display: inline-flex; align-items: center; gap: 5px;
    background: #fff; border: 1px solid #d8d0c6;
    padding: 3px 8px; font-size: 10px; color: #3a3028;
    letter-spacing: .04em; font-family: inherit;
}
.jwf-tag-remove {
    background: none; border: none; padding: 0;
    cursor: pointer; color: #bbb; font-size: 11px; line-height: 1;
}
.jwf-tag-remove:hover { color: #c0392b; }
.jwf-clear-all {
    font-size: 9.5px; color: #b5935a; background: none; border: none;
    cursor: pointer; letter-spacing: .12em; text-transform: uppercase;
    padding: 0; text-decoration: none; font-family: inherit;
}
.jwf-clear-all:hover { text-decoration: underline; }

/* ── Active dot ────────────────────────────────── */
.jwf-active-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #b5935a; display: inline-block;
    margin-left: 3px; vertical-align: middle;
}

/* ================================================
   MOBILE ≤ 768px
   ================================================ */
@media (max-width: 768px) {
    .jwf-sidebar { float: none; width: 100%; padding-right: 0; }
    .jwf-products-col { overflow: visible; }
    .jwf-mob-trigger {
        display: flex; align-items: center; gap: 9px;
        background: #fff; border: 1.5px solid #1a1a1a;
        padding: 9px 18px; font-family: inherit;
        font-size: 11px; font-weight: 700; letter-spacing: .18em;
        text-transform: uppercase; cursor: pointer; color: #1a1a1a;
        margin-bottom: 16px; width: 100%;
    }
    .jwf-panel {
        position: fixed; left: 0; bottom: 0; width: 100%;
        max-height: 88vh; overflow-y: auto;
        z-index: 1999; background: #fff;
        border-top: 2px solid #1a1a1a; border-radius: 18px 18px 0 0;
        padding: 0 20px 100px;
        transform: translateY(100%);
        transition: transform .35s cubic-bezier(.22,1,.36,1);
        box-shadow: 0 -8px 40px rgba(0,0,0,.15);
    }
    .jwf-panel.is-open { transform: translateY(0); }
    .jwf-panel-header {
        display: flex; align-items: center; justify-content: space-between;
        padding: 16px 0 12px; border-bottom: 1px solid #e8e0d5;
        position: sticky; top: 0; background: #fff; z-index: 10;
    }
    .jwf-panel-title {
        font-family: inherit; font-size: 12px; font-weight: 700;
        letter-spacing: .2em; text-transform: uppercase; color: #1a1a1a;
    }
    .jwf-panel-close {
        background: none; border: none; font-size: 20px;
        cursor: pointer; color: #1a1a1a; padding: 4px; line-height: 1;
    }
    .jwf-panel-title-desk { display: none; }
    .jwf-mob-apply { display: block; }
    .jwf-checkbox-list { max-height: none; overflow-y: visible; }
    .jwf-products-col ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px 10px !important;
    }
}
@media (min-width: 769px) {
    .jwf-panel-header, .jwf-mob-apply,
    .jwf-overlay, .jwf-mob-trigger { display: none !important; }
}

/* ================================================
   SORT & PRICE RANGE
   ================================================ */

/* ── Sort list ─────────────────────────────────── */
.jwf-sort-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.jwf-sort-btn {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    color: #3a3028;
    text-align: left;
    border-radius: 2px;
    transition: background .12s, color .12s;
    letter-spacing: .02em;
}
.jwf-sort-btn:hover { background: #faf6ee; color: #b5935a; }
.jwf-sort-btn.is-active {
    color: #1a1a1a;
    font-weight: 600;
}
.jwf-sort-btn.is-active::before {
    content: "✓ ";
    color: #b5935a;
    font-weight: 700;
}

/* ── Price range slider ────────────────────────── */
.jwf-price-wrap {
    padding: 4px 0 8px;
    user-select: none;
}

.jwf-price-display {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    font-family: inherit;
}
.jwf-price-sep { color: #bbb; font-weight: 300; }

/* Track container */
.jwf-slider-track {
    position: relative;
    height: 3px;
    background: #e0d8ce;
    border-radius: 2px;
    margin: 0 6px 18px;
}

/* Filled range between handles */
.jwf-slider-range {
    position: absolute;
    height: 100%;
    background: #1a1a1a;
    border-radius: 2px;
    left: 0;
    width: 100%;
}

/* Hide default range styling */
.jwf-range {
    position: absolute;
    top: -6px;
    width: calc(100% + 12px);
    left: -6px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    pointer-events: none;
    outline: none;
    margin: 0;
}

/* Thumb */
.jwf-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    cursor: pointer;
    pointer-events: all;
    transition: background .15s, transform .15s;
}
.jwf-range::-webkit-slider-thumb:hover {
    background: #b5935a;
    transform: scale(1.15);
}
.jwf-range::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    cursor: pointer;
    pointer-events: all;
}
.jwf-range::-moz-range-thumb:hover { background: #b5935a; }
.jwf-range::-ms-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #1a1a1a;
    cursor: pointer;
}
