.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); border-top: 1px solid #e9e9e9; border-left: 1px solid #e9e9e9; }
.cat-card { padding: 20px; border-right: 1px solid #e9e9e9; border-bottom: 1px solid #e9e9e9; background: #fff; display: flex; flex-direction: column; }
.cat-img { height: 150px; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; }
.cat-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cat-title { font-size: 16px; margin: 0 0 10px 0; font-weight: normal; }
.cat-title a { color: #3e77aa; text-decoration: none; }
.cat-title a:hover { color: #f84147; text-decoration: underline; }
.cat-subs { list-style: none; padding: 0; margin: 0; }
.cat-subs li { margin-bottom: 8px; font-size: 13px; }
.cat-subs li a { color: #3e77aa; text-decoration: none; }
.cat-subs li a:hover { color: #f84147; text-decoration: underline; }

.shop-layout { display: flex; gap: 30px; align-items: flex-start; }
.shop-sidebar { width: 260px; flex-shrink: 0; }
.shop-content { flex-grow: 1; min-width: 0; }

.woocommerce ul.products { display: grid !important; grid-template-columns: repeat(5, 1fr) !important; gap: 15px !important; margin: 20px 0 !important; padding: 0 !important; list-style: none !important; clear: both; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none !important; }

.shop-header-row { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 20px; margin-bottom: 25px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.shop-title-group h1.page-title { margin: 0 0 5px 0 !important; font-size: 28px; font-weight: bold; color: #000; }
.shop-result-count { font-size: 14px; color: #666; }
.shop-toolbar { display: flex; align-items: center; justify-content: flex-end !important; gap: 15px; margin-bottom: 0 !important; border-bottom: none !important; padding: 0 !important; }

.view-switcher { display: flex; gap: 5px; }
.view-btn { width: 38px; height: 38px; background: #fff; border: 1px solid #e9e9e9; color: #ccc; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 2px; }
.view-btn.active { border-color: #00a046 !important; color: #00a046 !important; }

.woocommerce-ordering { margin: 0 !important; float: none !important; }
.woocommerce-ordering select { height: 38px;width: 250px; border: 1px solid #e9e9e9 !important; background: #fff !important; padding: 0 10px !important; color: #333; font-size: 14px; border-radius: 2px !important; }
.woocommerce-ordering select:hover { border-color: #d2d2d2 !important; }
.shop-content > .woocommerce-ordering:last-of-type { display: none; }

ul.products.list-view { grid-template-columns: 1fr !important; gap: 10px !important; }
ul.products.list-view li.product { flex-direction: row !important; align-items: stretch !important; padding: 15px !important; min-height: 150px; padding-bottom: 15px !important; }
ul.products.list-view li.product .woocommerce-loop-product__link img { max-height: 130px !important; width: auto !important; }
ul.products.list-view li.product .woocommerce-loop-product__title { min-height: 0 !important; margin-top: 5px !important; font-size: 16px !important; }
ul.products.list-view li.product .rating-actions-row { margin-top: 10px !important; justify-content: flex-start !important; gap: 15px; }
ul.products.list-view li.product .price { position: relative !important; bottom: auto !important; left: auto !important; margin-top: 20px !important; font-size: 26px !important; }
ul.products.list-view li.product .button { bottom: 15px !important; right: 15px !important; }


/* ======= ФІКС ДЛЯ БЛОКІВ WOOCOMMERCE (Новинки в кошику) ======= */
.wc-block-grid__products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 15px !important;
    padding: 0 !important;
    list-style: none !important;
    margin-top: 30px !important;
}

.wc-block-grid.has-4-columns .wc-block-grid__product,
.wc-block-grid__product {
    max-width: 100% !important; 
    width: 100% !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    background: #fff !important;
    border: 1px solid #e9e9e9 !important;
    border-radius: 4px !important;
    padding: 15px !important;
    padding-bottom: 45px !important;
    margin: 0 !important;
    position: relative !important;
    transition: all 0.5s ease !important; 
    box-sizing: border-box !important;
    text-align: left !important;
}

.wc-block-grid__product:hover {
    transform: scale(1.03) translateY(-5px) !important;
    border-color: #00a046 !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15), inset 0 0 0 1px #00a046 !important; 
    outline: none !important;
    z-index: 10 !important;
}

.wc-block-grid__product-link {
    text-decoration: none !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
}

.wc-block-grid__product-image {
    width: 100% !important;
    margin: 0 0 15px 0 !important;
}

.wc-block-grid__product-image img {
    max-height: 180px !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: contain !important;
}

.wc-block-grid__product-title {
    font-size: 14px !important;
    color: #333 !important;
    font-weight: normal !important;
    line-height: 1.4 !important;
    margin: 0 0 5px 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 4 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important; /* Фікс злипання тексту */
}

/* Ціна та кнопка */
.wc-block-grid__product-price {
    position: absolute !important;
    bottom: 10px !important;
    left: 15px !important;
    font-size: 20px !important;
    font-weight: bold !important;
    color: #000 !important;
    margin: 0 !important;
}

.wc-block-grid__product-add-to-cart {
    position: absolute !important;
    bottom: 12px !important;
    right: 15px !important;
    margin: 0 !important;
    width: 36px !important;
    height: 36px !important;
}

.wc-block-grid__product-add-to-cart .wp-block-button__link {
    background: transparent !important;
    color: #00a046 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    font-size: 0 !important; 
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0 !important;
    min-width: 0 !important;
}

.wc-block-grid__product-add-to-cart .wp-block-button__link::before {
    content: '🛒' !important;
    font-size: 26px !important;
    display: block !important;
}

/* Адаптивність */
@media (max-width: 992px) { .wc-block-grid__products { grid-template-columns: repeat(3, 1fr) !important; } }
@media (max-width: 768px) { .wc-block-grid__products { grid-template-columns: repeat(2, 1fr) !important; } }

@media (max-width: 1200px) { .woocommerce ul.products { grid-template-columns: repeat(4, 1fr) !important; } }
@media (max-width: 992px) { .woocommerce ul.products { grid-template-columns: repeat(3, 1fr) !important; } }
@media (max-width: 768px) {
    .shop-layout { flex-direction: column; }
    .shop-sidebar { width: 100%; margin-bottom: 20px; }
    .shop-header-row { flex-direction: column; align-items: flex-start; gap: 15px; width: 100%; }
    .shop-toolbar { width: 100%; justify-content: space-between !important; }

    .woocommerce ul.products { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    
    .woocommerce ul.products li.product {
        padding: 10px !important;
        padding-bottom: 60px !important; /* Місце для ціни та кнопки */
    }
    
    .woocommerce ul.products li.product .woocommerce-loop-product__title { 
        font-size: 13px !important; 
        margin-bottom: 10px !important;
    }

    .rating-actions-row { 
        flex-direction: row !important; 
        flex-wrap: wrap !important;
        height: auto !important; 
        gap: 5px !important; 
        margin-bottom: 10px !important;
    }

    /* Жорстко фіксуємо ціну та кнопку внизу картки */
    .woocommerce ul.products li.product .price { 
        font-size: 18px !important; 
        position: absolute !important;
        left: 10px !important; 
        bottom: 15px !important; 
        margin: 0 !important;
    }
    
    .woocommerce ul.products li.product .button {
        position: absolute !important;
        right: 10px !important;
        bottom: 10px !important;
        width: 36px !important;
        height: 36px !important;
        margin: 0 !important;
    }
}
@media (max-width: 600px) {
    ul.products.list-view li.product { flex-direction: column !important; }
    ul.products.list-view li.product .woocommerce-loop-product__link { width: 100% !important; margin-right: 0 !important; }
}