/* ================================================================
   Product Filter Widget — product-filter.css
   ================================================================ */

/* ── Widget shell ───────────────────────────────────────────── */
.pfw-widget {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    width: 100%;
    position: relative;
    padding-left: 24px;
    box-sizing: border-box;
}

/* ── Mobile toggle (hidden on desktop) ─────────────────────── */
.pfw-mobile-toggle {
    display: none;
}

/* ── Filter panel ───────────────────────────────────────────── */
.pfw-filter {
    width: 20vw;
    flex-shrink: 0;
    position: sticky;
    top: 0px;               /* adjust if you have a fixed header */
    max-height: 100vh;
    overflow-y: auto;
    padding-right: 20px;
    box-sizing: border-box;
}

.pfw-filter-group {
    margin-bottom: 24px;
}

.pfw-filter-group-label {
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.pfw-filter-options {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pfw-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.pfw-filter-option input[type="checkbox"] {
    cursor: pointer;
    accent-color: #26733E;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.pfw-option-label {
    line-height: 1.3;
}

.pfw-clear-filters {
    margin-top: 16px;
    padding: 8px 14px;
    border: 1px solid #26733E;
    background: transparent;
    color: #26733E;
    cursor: pointer;
    width: 100%;
}

.pfw-clear-filters:hover {
    background: #26733E;
    color: #fff;
}

/* ── Products panel ─────────────────────────────────────────── */
.pfw-widget ul.products.pfw-products {
    width: 70vw;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-column-gap: 0px;
    grid-row-gap: 30px;
    place-items: start center; /* start = tops align, no stretching */
    align-items: start;
}

/* ── Product card ───────────────────────────────────────────── */
.pfw-widget ul.products li.pfw-product-card {
    width: 20vw;
    height: auto;               /* no fixed height — content drives it */
    display: flex;
    flex-direction: column;
    overflow: hidden;           /* nothing bleeds out */
    box-sizing: border-box;
}

.pfw-widget ul.products li.pfw-product-card > a {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    flex: 1 1 auto;
}

/* Fixed-height image box — all cards get the same image height */
.pfw-widget ul.products li.pfw-product-card img {
    width: 100%;
    height: 220px;              /* uniform image height across all cards */
    object-fit: contain;
    object-position: center;
    display: block;
    flex-shrink: 0;
}

.pfw-widget ul.products li.pfw-product-card .info {
    padding: 10px 15px;
    color: #26733E;
    flex: 1 1 auto;             /* absorbs leftover space so button stays at bottom */
    box-sizing: border-box;
}

.pfw-widget ul.products li.pfw-product-card .info a {
    color: #26733E;
    text-decoration: none;
}

.pfw-widget ul.products li.pfw-product-card .add-to-cart {
    padding: 10px 15px;
    flex-shrink: 0;             /* never squished */
    box-sizing: border-box;
}

/* High-specificity rule to beat WooCommerce/Elementor button overrides */
.pfw-widget ul.products li.pfw-product-card .add-to-cart button,
.pfw-widget ul.products li.pfw-product-card .add-to-cart a.button,
.pfw-widget ul.products li.pfw-product-card .add-to-cart .button {
    padding: 10px 15px !important;
    border: none !important;
    border-radius: 0 !important;
    color: #fff !important;
    background-color: #26733E !important;
    cursor: pointer;
    display: inline-block;
    box-shadow: none !important;
}

.pfw-widget ul.products li.pfw-product-card .add-to-cart button:hover,
.pfw-widget ul.products li.pfw-product-card .add-to-cart a.button:hover,
.pfw-widget ul.products li.pfw-product-card .add-to-cart .button:hover {
    background-color: rgb(7, 78, 7) !important;
    color: #fff !important;
}

/* ── No-results / empty states ──────────────────────────────── */
.pfw-no-products,
.pfw-no-filters {
    color: #888;
    padding: 16px 0;
}

/* ================================================================
   RESPONSIVE — small screens (≤ 768 px)
   ================================================================ */
@media (max-width: 768px) {

    /* Remove desktop side padding on mobile */
    .pfw-widget {
        flex-direction: column;
        padding-left: 0;
    }

    /* Mobile toggle button — forced green, beats any theme override */
    .pfw-widget .pfw-mobile-toggle,
    .pfw-widget button.pfw-mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 90vw;
        padding: 12px 16px;
        background: #26733E !important;
        background-color: #26733E !important;
        color: #fff !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        cursor: pointer;
        margin-bottom: 0;
        box-sizing: border-box;
        position: relative;
        left: 5vw;
        right: 5vw;
        z-index: 20;
    }

    .pfw-widget .pfw-mobile-toggle:hover,
    .pfw-widget button.pfw-mobile-toggle:hover {
        background-color: rgb(7, 78, 7) !important;
    }

    .pfw-toggle-icon {
        font-size: 0.75rem;
        transition: transform 0.2s;
        color: #fff;
    }

    /* Filter panel — slides down over products */
    .pfw-filter {
        width: 90vw;
        position: absolute;
        top: 45px;
        left: 5vw;
        right: 5vw;
        z-index: 10;
        max-height: 0;
        overflow: hidden;
        background: #fff;
        border: 1px solid #ddd;
        border-top: none;
        padding: 0 16px;
        box-sizing: border-box;
        transition: max-height 0.3s ease, padding 0.3s ease;
        /* explicitly cancel sticky from desktop */
        position: absolute;
    }

    .pfw-filter.pfw-filter--open {
        max-height: 70vh;
        overflow-y: auto;
        padding: 16px;
    }

    /* Products: 2-column grid, full width */
    .pfw-widget ul.products.pfw-products {
        width: 90vw;
        grid-template-columns: repeat(2, 1fr);
        margin-top: 8px;
        margin-left: 5vw;
    }

    /* Card: auto height, narrower image on mobile */
    .pfw-widget ul.products li.pfw-product-card {
        width: 45vw;
        height: auto;
    }

    .pfw-widget ul.products li.pfw-product-card img {
        height: 160px;          /* shorter image on smaller cards */
    }
}

/* Very narrow */
@media (max-width: 420px) {
    .pfw-widget ul.products li.pfw-product-card img {
        height: 130px;
    }
}

.pfw-widget ul.products.pfw-products > li:first-child {
    grid-column: 1 !important;
}