/* Frozberries Shop Grid 1.0.0 - shop, category, brand and search pages only. */

/* ---------- Compact page header (was 193px tall, 44px title) ---------- */
.fb-shop-header:not(.fb-has-banner) {
    padding: 22px 28px !important;
    margin-bottom: 18px !important;
    border-radius: 16px !important;
    box-shadow: none !important;
}
.fb-shop-header:not(.fb-has-banner)::after { font-size: 110px !important; bottom: -28px !important; }
.fb-shop-header:not(.fb-has-banner) h1 {
    font-size: 32px !important;
    line-height: 1.15 !important;
    margin: 0 0 8px !important;
}
.fb-shop-header .fb-crumbs { font-size: 13px !important; }

/* ---------- Chips row, quick filters, count ---------- */
.fzsg-bar { margin: 0 0 14px; }
.fzsg-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 10px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.fzsg-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 6px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #1f2937 !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none !important;
    white-space: nowrap;
    transition: border-color .15s, box-shadow .15s;
}
.fzsg-chip:not(:has(img)) { padding-left: 14px; }
.fzsg-chip:hover { border-color: #C40044; box-shadow: 0 2px 8px rgba(196, 0, 68, .12); }
.fzsg-chip.is-active { border-color: #C40044; background: #fff1f5; color: #C40044 !important; }
.fzsg-chip-img { width: 30px !important; height: 30px !important; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.fzsg-chip-count { color: #6b7280; font-size: 12px; font-weight: 500; }

.fzsg-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.fzsg-pill {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #1f2937 !important;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
}
.fzsg-pill:hover { background: #e5e7eb; }
.fzsg-pill.is-active { background: #1f2937; color: #fff !important; }
.fzsg-count { margin-left: auto; color: #6b7280; font-size: 14px; }

/* ---------- Product grid ---------- */
ul.products.products-container:not(.list) {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin: 0 0 24px !important;
    padding: 0 !important;
}
ul.products.products-container:not(.list)::before,
ul.products.products-container:not(.list)::after { display: none !important; }
ul.products.products-container:not(.list) > li.product-col {
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: none !important;
}

/* ---------- Product card ---------- */
ul.products:not(.list) li.product-col .product-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 12px;
    padding: 10px 12px 12px;
    overflow: hidden;
    transition: box-shadow .2s, border-color .2s;
}
ul.products:not(.list) li.product-col .product-inner:hover { border-color: #dcdcdc; box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }

ul.products:not(.list) li.product-col .product-image {
    margin: 0 0 8px !important;
    border-radius: 8px;
    background: #fff;
}
ul.products:not(.list) li.product-col .product-image img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}
ul.products:not(.list) li.product-col .product-image .labels .onsale {
    font-size: 11px !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
}

ul.products:not(.list) li.product-col .product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    text-align: left !important;
}
/* Every category the product is in, above its name: not needed on a card. */
ul.products:not(.list) li.product-col .category-list { display: none !important; }

ul.products:not(.list) li.product-col .product-loop-title {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 0 10px !important;
}
body ul.products:not(.list) li.product-col .woocommerce-loop-product__title {
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.35 !important;
    color: #1f2937 !important;
    margin: 0 0 6px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    height: 2.7em !important; /* exactly two lines: everything below lines up across a row */
    white-space: normal !important;
}
/* Price above the name, like Woolworths: prices line up across a row.
   "body" outranks the child theme's `.woocommerce ul.products li.product .price
   { margin-top: auto !important }`, which pushed in-stock prices to the bottom. */
body ul.products:not(.list) li.product-col .price {
    order: -1;
    margin-top: 0 !important;
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    margin-bottom: 4px !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #111827 !important;
}
ul.products:not(.list) li.product-col .price ins { order: -1; text-decoration: none; color: #C40044 !important; }
ul.products:not(.list) li.product-col .price del { font-size: 13px !important; font-weight: 400 !important; color: #9ca3af !important; }

/* Quantity + Add pushed to the bottom so every card lines up. */
ul.products:not(.list) li.product-col .ezq-wrapper,
ul.products:not(.list) li.product-col .add-links-wrap { margin-top: auto !important; }
ul.products:not(.list) li.product-col .ezq-wrapper { display: flex !important; gap: 8px; align-items: stretch; flex-wrap: wrap; }
ul.products:not(.list) li.product-col .ezq-wrapper .add_to_cart_button,
ul.products:not(.list) li.product-col .ezq-wrapper .button {
    flex: 1 1 100%;
    min-height: 40px;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

/* ---------- Tablet: 3 to 4 columns ---------- */
@media (max-width: 991px) {
    ul.products.products-container:not(.list) { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
}

/* ---------- Phones: always 2 columns, like Woolworths ---------- */
@media (max-width: 575px) {
    .fb-shop-header:not(.fb-has-banner) { padding: 16px 18px !important; margin-bottom: 12px !important; }
    .fb-shop-header:not(.fb-has-banner) h1 { font-size: 24px !important; }
    .fzsg-chip { font-size: 13px; }
    .fzsg-pill { height: 32px; padding: 0 12px; font-size: 13px; }
    .fzsg-count { font-size: 13px; }

    ul.products.products-container:not(.list) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    ul.products:not(.list) li.product-col .product-inner { padding: 8px 8px 10px; border-radius: 10px; }
    ul.products:not(.list) li.product-col .woocommerce-loop-product__title { font-size: 13px !important; }
    ul.products:not(.list) li.product-col .price { font-size: 17px !important; }
}

/* =========================================================================
   1.1.0 - Desktop: filters open as a slide-over drawer, not a column
   Porto's "Filters" switch slid the category sidebar in beside the grid and
   squeezed it to 4-5 products a row, and remembered "open" in a cookie so it
   stayed that way on every page. Woolworths keeps the grid full width and
   opens filters over the page. The sidebar keeps all Porto/YITH filter markup
   and behaviour; only where it sits changes. Phones/tablets: untouched (Porto
   already uses its own off-canvas panel below 992px).
   ========================================================================= */
@media (min-width: 992px) {
    /* 6 a row from 1200px (Woolworths shows 5-6), 5 below. */
    ul.products.products-container:not(.list) { grid-template-columns: repeat(5, minmax(0, 1fr)); }

    #main .porto-products-filter-body > .main-content {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        left: auto !important;
        transform: none !important;
    }
    #main .porto-products-filter-body > .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 360px !important;
        max-width: 88vw !important;
        flex: none !important;
        margin: 0 !important;
        padding: 56px 20px 32px !important;
        background: #fff;
        overflow-y: auto !important;
        z-index: 100001;
        box-shadow: 6px 0 32px rgba(17, 24, 39, .22);
        transform: translateX(-105%);
        visibility: hidden;
        transition: transform .25s ease, visibility 0s linear .25s;
    }
    #main .porto-products-filter-body.opened > .sidebar {
        transform: none;
        visibility: visible;
        transition: transform .25s ease;
    }
    /* Porto's sticky-sidebar wrapper sets its own fixed/top/width inline. */
    #main .porto-products-filter-body > .sidebar [data-plugin-sticky],
    #main .porto-products-filter-body > .sidebar .sidebar-content,
    #main .porto-products-filter-body > .sidebar .sticky-wrapper,
    #main .porto-products-filter-body > .sidebar .theiaStickySidebar {
        position: static !important;
        top: auto !important;
        width: auto !important;
        transform: none !important;
        height: auto !important;
    }
    /* No flash of the drawer while Porto re-opens it from its cookie. */
    body:not(.fzsg-ready) #main .porto-products-filter-body > .sidebar { visibility: hidden !important; transition: none !important; }
}
.fzsg-filter-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #111827;
    font-size: 22px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.fzsg-filter-close:hover { background: #e5e7eb; }
.fzsg-filter-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .45);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility 0s linear .2s;
}
body.fzsg-filters-open .fzsg-filter-backdrop { opacity: 1; visibility: visible; transition: opacity .2s ease; }
body.fzsg-filters-open { overflow: hidden; }
@media (max-width: 991px) { .fzsg-filter-close, .fzsg-filter-backdrop { display: none !important; } }
@media (min-width: 1200px) {
    ul.products.products-container:not(.list) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
