/* Somogro Bazar Custom
   Category & Product Grid + Overlay Qty + Emoji Cart
   Brand color: #4169e1
*/

/* ===== CATEGORY GRID ===== */

.sb-category-grid ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 5px !important;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 768px) {
    .sb-category-grid ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .sb-category-grid ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

.sb-category-grid ul.products li.product-category {
    position: relative;
    overflow: hidden;
    margin: 0 !important;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    background: #ffffff;
}

.sb-category-grid ul.products li.product-category img {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 140px;
    object-fit: cover;
}

/* Bottom full-width blue title bar */
.sb-category-grid ul.products li.product-category .woocommerce-loop-category__title {
    position: relative !important;
    background: #4169e1 !important;
    color: #ffffff !important;
    width: 100% !important;
    display: block !important;
    text-align: center !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    border-radius: 0 0 14px 14px !important;
    transform: none !important;
    bottom: 0 !important;
    left: 0 !important;
    white-space: nowrap;
    font-weight: 600;
    font-size: 14px !important;
}

@media (max-width: 480px) {
    .sb-category-grid ul.products li.product-category img {
        height: 85px !important;
    }
    .sb-category-grid ul.products li.product-category .woocommerce-loop-category__title {
        font-size: 12px !important;
        padding: 4px 0 !important;
    }
}

/* Hide category product count text */
.sb-category-grid ul.products li.product-category .count {
    display: none !important;
}

/* ===== PRODUCT GRID ===== */

.sb-product-grid ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 5px !important;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sb-product-grid ul.products li.product {
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    background: #ffffff;
}

.sb-product-grid ul.products li.product img {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 160px;
    object-fit: cover;
    display: block !important;
}

@media (max-width: 480px) {
    .sb-product-grid ul.products li.product img {
        height: 120px !important;
    }
}

/* Title & price compact */
.sb-product-grid ul.products li.product .woocommerce-loop-product__title {
    font-size: 14px;
    font-weight: 600;
    margin: 6px 6px 4px !important;
    line-height: 1.3;
}

.sb-product-grid ul.products li.product .price {
    margin: 0 6px 6px !important;
    font-weight: 700;
    color: #4169e1;
}

/* Hide original WooCommerce add to cart button */
.sb-product-grid ul.products li.product .button {
    display: none !important;
}

/* Emoji cart icon top-right on image */
.sb-cart-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #4169e1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 60;
    cursor: pointer;
}

/* Overlay qty bar on top of image (full width) */
.sb-qty-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100% !important;
    background: rgba(65,105,225,0.92) !important;
    color: #fff !important;
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    z-index: 50;
}

.sb-qty-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #4169e1 !important;
    font-size: 22px !important;
    border: none !important;
    font-weight: 700 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-qty-label {
    font-size: 16px !important;
    font-weight: 700 !important;
}
/* ================= CART ICON ================= */
.sb-cart-icon {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: #4169e1 !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    cursor: pointer;
    z-index: 999 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22) !important;
}

/* ================= QTY OVERLAY BAR ================= */
.sb-qty-overlay {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: rgba(65,105,225,0.95) !important;
    display: none !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 8px 10px !important;
    min-height: 44px !important;
    z-index: 998 !important;
}

/* Button style */
.sb-qty-btn {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #4169e1 !important;
    font-size: 22px !important;
    border: none !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Label text */
.sb-qty-label {
    flex: 1 !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #fff !important;
}

/* ================= MOBILE FIX ================= */
@media (max-width: 768px) {

    .sb-cart-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 18px !important;
        top: 6px !important;
        right: 6px !important;
    }

    .sb-qty-overlay {
        padding: 6px 8px !important;
        min-height: 40px !important;
    }

    .sb-qty-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 18px !important;
    }

    .sb-qty-label {
        font-size: 14px !important;
    }
}
