/* =========================================================
   CATEGORY / ALL PRODUCTS
   ========================================================= */

/* ----- Toolbar (sort, view mode, limit, compare) ----- */
.category-products .toolbar {
    border-bottom: 1px solid #eee;
    padding: 10px 0 12px;
    margin-bottom: 20px;
}

.category-products .sorter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    font-size: 13px;
}

/* sort, limit, pager */
.category-products .sort-by,
.category-products .limiter,
.category-products .pager {
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-products .sort-by label,
.category-products .limiter label {
    margin: 0;
    font-weight: 600;
}

/* sort bên trái, các phần khác dồn về bên phải */
.category-products .sort-by {
    margin-right: auto;
}

.category-products .sorter select {
    height: 32px;
    padding: 4px 8px;
    font-size: 13px;
}

/* ----- View mode (grid / list) ----- */
.category-products .view-mode {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-products .view-mode .switcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 3px;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    text-decoration: none;
    padding: 0;
    cursor: pointer;
}

.category-products .view-mode .switcher i {
    font-size: 14px;
}

.category-products .view-mode .switcher.active {
    background-color: #c60b23;
    border-color: #c60b23;
    color: #fff;
}

/* ----- Wrapper chung cho 2 kiểu hiển thị ----- */
.products-display {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* class JS dùng để ẩn */
.products-display--hidden,
.category-products .products-display--hidden {
    display: none !important;
}

/* Responsive toolbar */
@media (max-width: 767px) {
    .category-products .sorter {
        align-items: flex-start;
    }

    .category-products .sort-by {
        width: 100%;
        margin-right: 0;
    }
}

/* =========================================================
   GRID VIEW (products-grid)
   ========================================================= */

.category-products .products-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
    padding: 0;
    list-style: none;
}

.category-products .products-grid > li.item {
    padding: 0 10px 30px;
}

/* 4 cột */
.category-products .products-grid.columns4 > li.item {
    width: 25%;
}

/* 3 cột */
.category-products .products-grid.columns3 > li.item {
    width: 33.3333%;
}

/* 2 cột */
.category-products .products-grid.columns2 > li.item {
    width: 50%;
}

/* 1 cột / fallback */
.category-products .products-grid.columns1 > li.item {
    width: 100%;
}

/* Tablet: giảm bớt cột */
@media (max-width: 991px) {
    .category-products .products-grid.columns4 > li.item,
    .category-products .products-grid.columns3 > li.item {
        width: 33.3333%;
    }
}

/* Mobile: 2 cột */
@media (max-width: 767px) {
    .category-products .products-grid.columns4 > li.item,
    .category-products .products-grid.columns3 > li.item,
    .category-products .products-grid.columns2 > li.item {
        width: 50%;
    }
}

/* Rất nhỏ: 1 cột */
@media (max-width: 479px) {
    .category-products .products-grid > li.item {
        width: 100%;
    }
}

/* =========================================================
   LIST VIEW (products-list)
   ========================================================= */

.category-products .products-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-products .products-list > li.item {
    padding: 18px 0;
    border-bottom: 1px solid #eee;
}

.category-products .products-list > li.item.last {
    border-bottom: none;
}

/* Card chung trong list */
.category-products .products-list .item-area {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
}

/* Reset float / width cũ (nếu theme có) */
.category-products .products-list .product-image-area,
.category-products .products-list .details-area {
    float: none;
    width: auto;
}

/* Ảnh bên trái */
.category-products .products-list .product-image-area {
    flex: 0 0 220px;
    max-width: 220px;
    margin-right: 20px;
    margin-bottom: 0;
}

.category-products .products-list .product-image-area .product-image,
.category-products .products-list .product-image-area img {
    width: 100%;
    height: auto;
    display: block;
}

/* Nội dung bên phải */
.category-products .products-list .details-area {
    flex: 1 1 auto;
    min-width: 0;
}

.category-products .products-list .product-name {
    font-size: 20px;
    margin: 0 0 6px;
}

.category-products .products-list .product-name a {
    color: #2c1545;
}

.category-products .products-list .product-name a:hover {
    text-decoration: underline;
}

/* Rating + mô tả ngắn */
.category-products .products-list .ratings {
    margin-bottom: 6px;
}

.category-products .products-list .short-desc {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
}

/* Giá + nút */
.category-products .products-list .action-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

.category-products .products-list .price-box {
    margin-right: 10px;
}

.category-products .products-list .price-box .regular-price .price,
.category-products .products-list .price-box .special-price .price {
    font-size: 18px;
    font-weight: 700;
}

/* Nút mua + wishlist + so sánh */
.category-products .products-list .actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-products .products-list .actions .addtocart {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #c60b23;
    border-radius: 3px;
    color: #fff;
    font-size: 13px;
    text-transform: uppercase;
}

.category-products .products-list .actions .addtocart:hover {
    background: #a4081d;
    color: #fff;
}

.category-products .products-list .actions .addtowishlist,
.category-products .products-list .actions .comparelink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 3px;
    border: 1px solid #ddd;
    color: #555;
}

.category-products .products-list .actions .addtowishlist:hover,
.category-products .products-list .actions .comparelink:hover {
    background: #f5f5f5;
}

/* Responsive list: ảnh trên, nội dung dưới khi nhỏ */
@media (max-width: 767px) {
    .category-products .products-list .item-area {
        flex-direction: column;
    }

    .category-products .products-list .product-image-area {
        flex: 0 0 auto;
        max-width: 260px;
        margin-left:auto;
        margin-right: auto;
        margin-bottom: 12px;
    }
}
