/* ===============================
   KITO CATEGORY FULL CONTAINER
   Bỏ column_left / column_right ở trang danh mục
   ================================ */

.kito-category-container {
    clear: both;
}

.kito-category-container *,
.kito-category-container *:before,
.kito-category-container *:after {
    box-sizing: border-box;
}

/* Tiêu đề danh mục */
.kito-category-heading {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 10px 10px;
    box-sizing: border-box;
}

.kito-category-heading h1 {
    color: #0b7f13;
    font-size: 26px;
    line-height: 1.3;
    font-weight: bold;
    text-transform: uppercase;
    margin: 0;
}

.kito-category-short-desc {
    color: #555555;
    font-size: 15px;
    line-height: 1.6;
    margin-top: 10px;
}

.kito-category-short-desc p {
    margin: 0 0 8px 0;
}

/* Full row */
.kito-category-full-row {
    margin-left: -15px;
    margin-right: -15px;
}

/* Content full 100% */
.kito-category-content {
    width: 100%;
    max-width: 100%;
    float: none;
    box-sizing: border-box;
}

/* Inner thay cho container lồng container */
.kito-category-inner {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}

/* Nếu code/theme cũ còn container bên trong content */
.kito-category-content > .row > .container {
    width: 100%;
    max-width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

/* Danh mục con */
.kito-category-sub-row {
    margin-left: -15px;
    margin-right: -15px;
}

.kito-category-content .cate_c {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Sort */
.kito-category-sort-row {
    margin-left: -15px;
    margin-right: -15px;
}

.kito-category-content .cate_c_sort {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Product grid */
.kito-category-product-row {
    margin-left: -10px;
    margin-right: -10px;
}

.kito-category-product-row:before,
.kito-category-product-row:after {
    content: "";
    display: table;
    clear: both;
}

.kito-category-product-row .product-layout {
    box-sizing: border-box;
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 22px;
    float: left;
}

/* Product thumb full */
.kito-category-product-row .product-thumb {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;

}

/* Ảnh sản phẩm */
.kito-category-product-row .product-thumb .image img {
    max-width: 100%;
    height: auto;
}

/* Ép tên sản phẩm hiển thị */
.kito-category-product-row .pro_name,
.kito-category-product-row .pro_name h4,
.kito-category-product-row .pro_name h4 a {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.kito-category-product-row .pro_name h4 {
    min-height: 42px;
    margin: 8px 0 6px 0;
    line-height: 1.4;
}

.kito-category-product-row .pro_name h4 a {
    color: #222222;
    font-size: 14px;
    text-decoration: none;
}

.kito-category-product-row .pro_name h4 a:hover {
    color: #0b7f13;
    text-decoration: none;
}

/* Desktop lớn: 4 sản phẩm / hàng */
@media (min-width: 1200px) {
    .kito-category-product-row .product-layout {
        width: 25%;
    }
}

/* Desktop nhỏ: 4 sản phẩm / hàng */
@media (min-width: 992px) and (max-width: 1199px) {
    .kito-category-product-row .product-layout {
        width: 25%;
    }
}

/* Tablet: 3 sản phẩm / hàng */
@media (min-width: 768px) and (max-width: 991px) {
    .kito-category-product-row .product-layout {
        width: 33.333333%;
    }

    .kito-category-heading h1 {
        font-size: 22px;
    }
}

/* Mobile: 2 sản phẩm / hàng */
@media (max-width: 767px) {
    .kito-category-container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .kito-category-heading {
        padding: 13px 12px;
        margin-bottom: 14px;
    }

    .kito-category-heading h1 {
        font-size: 20px;
    }

    .kito-category-short-desc {
        font-size: 14px;
    }

    .kito-category-full-row,
    .kito-category-sub-row,
    .kito-category-sort-row {
        margin-left: -10px;
        margin-right: -10px;
    }

    .kito-category-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .kito-category-inner,
    .kito-category-content > .row > .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .kito-category-product-row {
        margin-left: -5px;
        margin-right: -5px;
    }

    .kito-category-product-row .product-layout {
        width: 50%;
        padding-left: 5px;
        padding-right: 5px;
        margin-bottom: 12px;
    }

    .kito-category-product-row .pro_name h4 {
        min-height: 40px;
    }

    .kito-category-product-row .pro_name h4 a {
        font-size: 13px;
        line-height: 1.35;
    }
}
/* ================================
   FIX HIỂN THỊ TITLE SẢN PHẨM CATEGORY
   ================================ */

.kito-category-product-row .product-thumb .caption,
.kito-category-product-row .product-thumb .caption .pro_name,
.kito-category-product-row .product-thumb .caption .pro_name h4,
.kito-category-product-row .product-thumb .caption .pro_name h4 a {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    
    overflow: visible !important;
    position: static !important;
    clip: auto !important;
    transform: none !important;
}

/* Caption phải có khoảng hiển thị */
.kito-category-product-row .product-thumb .caption {
    padding: 8px 8px 10px 8px !important;
    background: #ffffff !important;
    text-align: left !important;
}

/* Box tên sản phẩm */
.kito-category-product-row .product-thumb .caption .pro_name {
    width: 100% !important;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    height: 55px;
}

/* H4 tên sản phẩm */
.kito-category-product-row .product-thumb .caption .pro_name h4 {
    margin: 0 0 6px 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

/* Link title sản phẩm */
.kito-category-product-row .product-thumb .caption .pro_name h4 a {
    color: #222222 !important;
    font-size: 14px !important;
    
    line-height: 1.4 !important;
    text-decoration: none !important;
    word-break: break-word !important;
}

.kito-category-product-row .product-thumb .caption .pro_name h4 a:hover {
    color: #0b7f13 !important;
    text-decoration: none !important;
}
/* Mobile rất nhỏ: nếu sản phẩm bị chật, mở đoạn này */
/*
@media (max-width: 420px) {
    .kito-category-product-row .product-layout {
        width: 100%;
    }
}
*/
.pro_name h4 {
    margin: 0; /* bỏ margin mặc định */
}

.pro_name h4 a {
    display: block;            /* chiếm toàn bộ chiều rộng */
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4em;
    color: #222;
    text-decoration: none;
    max-height: 2.8em;        /* 2 dòng, 1.4em x 2 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;     /* giới hạn 2 dòng */
    -webkit-box-orient: vertical;
    word-wrap: break-word;      /* xuống dòng khi cần */
}

.pro_name h4 a:hover {
    color: #4CAF50;
    text-decoration: underline;
}

/* Responsive: điện thoại */
@media (max-width: 480px) {
    .pro_name h4 a {
        -webkit-line-clamp: 3; /* cho phép 3 dòng trên mobile */
        max-height: 4.2em;
    }
}
.pro_name {
    margin-top: 10px; /* tạo khoảng cách 10px so với ảnh */
}

.pro_name h4 a {
    display: block;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4em;
    color: #222;
    text-decoration: none;
    max-height: 2.8em;          /* 2 dòng */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

.pro_name h4 a:hover {
    color: #4CAF50;
    text-decoration: underline;
}

.kito-category-heading {        
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background-color: #ffffff;
}

.kito-category-heading h1 {
    font-size: 26px;
    color: #2a7f1b; /* xanh KITO */
    font-weight: bold;
    line-height: 1.2;
}

.kito-category-short-desc p {
    font-size: 14px;
    color: #555555;
    margin: 0;
    line-height: 1.5;
}

#content .product-layout + .clearfix {
    display: none !important;
}
/* ================================
   

/* ===============================
   KITO - Sort Box Category
   Tối ưu box sắp xếp sản phẩm
================================ */

.kito-category-sort-row {
    width: 100%;
    margin: 0 0 12px 0;
    padding: 0;
    background: transparent;
}

.kito-category-sort-row .kito-category-inner {
    width: 100%;
    margin: 0;
    padding: 0;
}

.kito-category-sort-row .cate_c_sort {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 7px 10px;
    border: 1px solid #edf0f3;
    overflow: hidden;
}

/* Reset ul/li cũ */
.kito-category-sort-row .search_sort {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.kito-category-sort-row .search_sort li,
.kito-category-sort-row .search_sort li.fl {
    float: none !important;
    display: inline-flex !important;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Link sort */
.kito-category-sort-row .search_sort li a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 28px;
    padding: 0 10px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    color: #637083 !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 28px !important;
    text-decoration: none !important;
    white-space: nowrap;
}

/* Dấu chấm phân cách */
.kito-category-sort-row .search_sort li:not(:last-child) a::after {
    content: "";
    width: 3px;
    height: 3px;
    margin-left: 12px;
    border-radius: 50%;
    background: #c7ced8;
    flex: 0 0 auto;
}

/* Hover */
.kito-category-sort-row .search_sort li a:hover {
    color: #0072bc !important;
}

/* Mục đang chọn */
.kito-category-sort-row .search_sort li a.sort_hover {
    color: #0072bc !important;
    font-weight: 500 !important;
}

/* Ẩn khối grid/list cũ nếu không dùng */
.kito-category-sort-row .btn-group.hidden-xs {
    display: none !important;
}

/* ================================
   Mobile
================================ */

@media (max-width: 850px) {
    .kito-category-sort-row {
        margin: 0 0 10px 0;
    }

    .kito-category-sort-row .cate_c_sort {
        padding: 7px 8px;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .kito-category-sort-row .cate_c_sort::-webkit-scrollbar {
        display: none;
    }

    .kito-category-sort-row .search_sort {
        flex-wrap: nowrap !important;
        width: max-content;
        min-width: max-content;
        white-space: nowrap;
    }

    .kito-category-sort-row .search_sort li {
        flex: 0 0 auto !important;
    }

    .kito-category-sort-row .search_sort li a {
        min-height: 26px;
        padding: 0 8px !important;
        font-size: 12px !important;
        line-height: 26px !important;
    }

    .kito-category-sort-row .search_sort li:not(:last-child) a::after {
        margin-left: 10px;
    }
}
/* ================================
   

/* ===============================
   KITO - Fix ảnh trong mô tả danh mục
   Chống tràn khung desktop/mobile
================================ */

/* Box mô tả danh mục */
.des_cate,
.kito-category-seo-box,
.kito-seo-intro,
.category-description {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Ảnh trong mô tả danh mục */
.des_cate img,
.kito-category-seo-box img,
.kito-seo-intro img,
.category-description img {
    display: block;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    margin: 14px auto;
    object-fit: contain;
    box-sizing: border-box;
}

/* Ảnh nằm trong thẻ p căn giữa */
.des_cate p img,
.kito-category-seo-box p img,
.kito-seo-intro p img,
.category-description p img {
    display: block;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    margin-left: auto;
    margin-right: auto;
}

/* Fix trường hợp CKEditor chèn style width cứng */
.des_cate img[style],
.kito-category-seo-box img[style],
.kito-seo-intro img[style],
.category-description img[style] {
    max-width: 100% !important;
    height: auto !important;
}

/* Fix thẻ figure nếu có */
.des_cate figure,
.kito-category-seo-box figure,
.kito-seo-intro figure,
.category-description figure {
    max-width: 100% !important;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.des_cate figure img,
.kito-category-seo-box figure img,
.kito-seo-intro figure img,
.category-description figure img {
    max-width: 100% !important;
    height: auto !important;
}

/* Mobile */
@media (max-width: 850px) {
    .des_cate,
    .kito-category-seo-box,
    .kito-seo-intro,
    .category-description {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .des_cate img,
    .kito-category-seo-box img,
    .kito-seo-intro img,
    .category-description img {
        display: block;
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
        margin: 10px auto;
        object-fit: contain;
    }
}

/* Mobile nhỏ */
@media (max-width: 480px) {
    .des_cate img,
    .kito-category-seo-box img,
    .kito-seo-intro img,
    .category-description img {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
    }
}
