/**
 * Pantry Items Styles
 * Brand filtering and pantry-specific styling
 */

/* Container wrapper for both filter sections - matches Set Menu page styling */
.bb-filters-container {
    position: relative;
    border-radius: 8px;
    background: #fff7ca;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-bottom: 20px;
}

/* Brand filtering tiles */
.bb-brand-filter-scroll {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    margin: 0;
    padding: 0;
    scrollbar-width: none;         /* Firefox */
    -ms-overflow-style: none;      /* IE/Edge */
    height: auto;
    max-height: none;
    min-height: 160px;
}
.bb-brand-filter-scroll::-webkit-scrollbar {
    display: none;
}

.bb-brand-filter {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    justify-content: flex-start;
}

.bb-tile {
    background-color: #fff;
    flex: 0 0 auto;
    width: 100px;
    max-width: 100px;
    min-width: 90px;
    min-height: 120px;
    height: auto;
    border-radius: 12px;
    text-align: center;
    padding: 10px 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.bb-tile:hover,
.bb-tile.active {
    background: #a87abb;
    color: #32244e;
    border-color: #a87abb;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.bb-tile img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 6px;
    border-radius: 6px;
    flex-shrink: 0;
}

.bb-tile span {
    font-size: 13px;
    line-height: 1.2;
    word-wrap: break-word;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Product category tiles */
.bb-category-section {
    margin-top: 20px;
    margin-left: 0;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
}

.bb-filter-heading {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5em;
    color: #32244e;
    text-align: left;
}

.bb-category-tiles {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 10px;
    justify-content: flex-start;
    padding-bottom: 10px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.bb-category-tiles::-webkit-scrollbar {
    display: none;              /* Hide scrollbar (Chrome/Safari) */
}

.bb-category-tile {
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 14px;
    color: #32244e;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    min-width: 100px;
    max-width: 150px;
    text-align: center;
}
.bb-category-tile:hover,
.bb-category-tile.active {
    background: #a87abb;
    color: #32244e;
    border-color: #a87abb;
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Product grid container - Match Set Menu styling */
.bb-pantry-products-container {
    position: relative;
    border-radius: 8px;
    background: #fff7ca;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 10px;
    margin-top: 20px;
}

/* Product grid enhancements for pantry items - Match Set Menu styling */
.woocommerce.archive.product-category-pantry-item ul.products,
.bb-pantry-products-container ul.products {
    gap: 20px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

/* Product tile styling with higher specificity instead of !important */
body.woocommerce.archive.product-category-pantry-item ul.products li.product,
body .bb-pantry-products-container ul.products li.product {
    background: #fff7ca;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

body.woocommerce.archive.product-category-pantry-item ul.products li.product:hover,
body .bb-pantry-products-container ul.products li.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: #CB6CE6;
}

/* Reset overlay buttons on images to default positioning */
.woocommerce.archive.product-category-pantry-item .product .woocommerce-loop-product__link .button,
.woocommerce.archive.product-category-pantry-item .product img ~ .button,
.woocommerce.archive.product-category-pantry-item .product .astra-shop-thumbnail-wrap .button,
.bb-pantry-products-container .product .woocommerce-loop-product__link .button,
.bb-pantry-products-container .product img ~ .button,
.bb-pantry-products-container .product .astra-shop-thumbnail-wrap .button {
    position: absolute;
    width: auto;
    margin: 0;
    padding: 0.5em 1em;
}

/* Target only buttons in product footer/actions area - higher specificity */
body.woocommerce.archive.product-category-pantry-item ul.products li.product > .button,
body.woocommerce.archive.product-category-pantry-item ul.products li.product > a.button,
.bb-pantry-products-container ul.products li.product > .button,
.bb-pantry-products-container ul.products li.product > a.button {
    margin-top: auto;
    width: 100%;
    background: #CB6CE6;
    color: white;
    border: 2px solid #CB6CE6;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
}

body.woocommerce.archive.product-category-pantry-item ul.products li.product > .button:hover,
body.woocommerce.archive.product-category-pantry-item ul.products li.product > a.button:hover,
.bb-pantry-products-container ul.products li.product > .button:hover,
.bb-pantry-products-container ul.products li.product > a.button:hover {
    background: #a87abb;
    border-color: #a87abb;
    text-decoration: none;
}

/* View Cart link after adding to cart */
body.woocommerce.archive.product-category-pantry-item ul.products li.product .added_to_cart,
.bb-pantry-products-container ul.products li.product .added_to_cart {
    display: inline-block;
    width: auto;
    margin-top: 0.5em;
    padding: 0.5em 1em;
    font-size: 0.875em;
}

/* Mobile responsive for pantry */
@media (max-width: 768px) {
    .bb-brand-filter {
        gap: 10px;
        padding: 0 5px;
    }
    
    .bb-tile {
        min-width: 80px;
        width: 80px;
        max-width: 80px;
        min-height: 100px;
        padding: 8px 4px;
    }
    
    .bb-tile img {
        width: 50px;
        height: 25px;
        margin-bottom: 4px;
    }
    
    .bb-tile span {
        font-size: 12px;
    }
    
    .bb-category-tiles {
        gap: 8px;
        padding-bottom: 8px;
    }
    
    .bb-category-tile {
        padding: 5px 10px;
        font-size: 13px;
        min-width: 80px;
        max-width: 120px;
    }
    
    .woocommerce.archive.product-category-pantry-item ul.products {
        gap: 15px;
        margin: 15px 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .woocommerce.archive.product-category-pantry-item .product {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .bb-tile {
        min-width: 70px;
        width: 70px;
        max-width: 70px;
        min-height: 90px;
        padding: 6px 3px;
    }
    
    .bb-tile img {
        width: 45px;
        height: 22.5px;
        margin-bottom: 3px;
    }
    
    .bb-tile span {
        font-size: 11px;
    }
    
    .bb-category-tile {
        padding: 4px 8px;
        font-size: 12px;
        min-width: 70px;
        max-width: 100px;
    }
    
    .woocommerce.archive.product-category-pantry-item ul.products {
        gap: 10px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}