/*
Theme Name: Flatsome Child
Description: This is a child theme for Flatsome Theme
Author: UX Themes
Template: flatsome
Version: 3.0
*/

/*************** ADD CUSTOM CSS HERE.   ***************/
body, 
#wrapper, 
.page-wrapper, 
.woocommerce-archive, 
.cat-page-wrap,
#content.blog-wrapper {
    background-color: #ffffff !important;
}
/* Danh mục */
/* 1. Tạo điểm tựa định vị cho khung chứa ảnh sản phẩm */
.product-small.col .product-small.box .box-image {
    position: relative !important;
}

/* 2. Định dạng nhãn danh mục màu hồng nằm đè lên góc trên ảnh */
.product-small.col .product-small.box .custom-cat-badge,
.product-small.col .product-small.box .badge-container + .custom-cat-badge,
.product-small.col .product-small.box .box-image .custom-cat-badge {
    position: absolute !important;
    bottom: 380px !important;
    left: 12px !important;
    background-color: #e91e63 !important; /* Màu hồng đúng mẫu */
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
    z-index: 99 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}
/* Sản phẩm */
.product-small.col {
    display: flex !important;
}
.product-small.col > .col-inner {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

/* 2. Khung box sản phẩm (giữ nguyên style gốc, thêm flex dọc) */
.product-small.col .product-small.box {
    background: #ffffff !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.3s ease !important;
    padding: 10px !important;

    /* Phần thêm mới: box giãn hết chiều cao cột */
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    height: 100% !important;
}

.product-small.col .product-small.box:hover {
    border-color: #008542 !important;
    box-shadow: 0 4px 12px rgba(0, 133, 66, 0.08) !important;
}

/* 3. Phần chữ trong box: chiếm hết chỗ còn lại để nút dồn xuống đáy */
.product-small.col .product-small.box .box-text.box-text-products {
    background: #ffffff !important;
    text-align: left !important;
    padding: 12px 5px 5px 5px !important;

    /* Phần thêm mới */
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
}

/* 4. Tên sản phẩm: tối đa 2 dòng, luôn chiếm đủ chiều cao 2 dòng */
.product-small.col .box-text .product-title,
.product-small.col .box-text .product-title a,
.product-small.col .box-text .woocommerce-loop-product__title,
.product-small.col .box-text .woocommerce-loop-product__title a {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.35 !important;
}
.product-small.col .box-text .product-title,
.product-small.col .box-text .woocommerce-loop-product__title {
    min-height: 2.7em !important; /* 2 dòng x 1.35em */
}

/* 5. Nút nằm sát đáy box, giữ khoảng cách tối thiểu với phần mô tả */
.product-small.col .product-small.box .box-text.box-text-products .button,
.product-small.col .product-small.box .box-text.box-text-products .add-to-cart-button {
    margin-top: auto !important;
}
.product-small.col .product-small.box .box-text.box-text-products .box-excerpt {
    margin-bottom: 10px !important;
}
/* ==========================================================
   3. ĐỊNH DẠNG NÚT "LIÊN HỆ BÁO GIÁ"
   ========================================================== */
.product-small.col .product-small.box .button,
.product-small.col .product-small.box button[type="submit"] {
    background-color: #008542 !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    width: 100% !important;
    text-align: center !important;
    font-weight: 600 !important;
    margin-top: 10px !important;
    text-transform: uppercase !important;
    font-size: 13px !important;
    border: none !important;
}

.product-small.col .product-small.box .button:hover {
    background-color: #006833 !important;
}
/* 1. Tổng thể trang & Banner đầu trang */
.cat-page-wrap {
    background-color: #f7f9f8;
    padding-bottom: 60px;
}
.cat-full-banner {
    position: relative;
    background-size: cover;
    background-position: center;
    padding: 50px 0;
    margin-bottom: 30px;
}

/* Lớp phủ overlay màu xanh lá mờ (độ trong suốt 0.7) */
.cat-full-banner .banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 100, 45, 0.7) !important; /* Tông xanh lá mờ */
    z-index: 1;
}

/* Đưa nội dung lên trên lớp overlay */
.cat-full-banner .banner-content-wrap {
    position: relative;
    z-index: 2;
}

/* 1. Ép toàn bộ Breadcrumb trong banner thành màu trắng */
.cat-full-banner .cat-breadcrumb-wrap, 
.cat-full-banner .cat-breadcrumb-wrap a,
.cat-full-banner .cat-breadcrumb-wrap span,
.cat-full-banner .woocommerce-breadcrumb,
.cat-full-banner .woocommerce-breadcrumb a {
    color: #ffffff !important;
    font-size: 13px;
    margin-bottom: 10px;
}
.cat-full-banner .woocommerce-breadcrumb a:hover {
    color: #e2e8f0 !important;
    text-decoration: underline;
}

/* 2. Ép Tiêu đề H1 thành màu trắng */
.cat-full-banner h1.shop-page-title,
.cat-full-banner h1.cat-h1 {
    color: #ffffff !important;
    font-size: 32px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    margin-bottom: 10px;
    line-height: 1.2;
}

/* 3. Ép đoạn giới thiệu/mô tả thành màu trắng */
.cat-full-banner .cat-header-desc,
.cat-full-banner .cat-header-desc p,
.cat-full-banner .cat-header-desc * {
    color: #ffffff !important;
    font-size: 15px;
    line-height: 1.5;
    max-width: 750px;
    margin: 0;
    opacity: 0.95;
}

/* 2. Khung Sidebar bên trái */
.cat-sidebar {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e2e2;
}
.filter-group {
    margin-bottom: 25px;
}
.filter-group__label {
    font-size: 13px;
    font-weight: 700;
    color: #222;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* Danh sách Nhóm sản phẩm (Có số lượng đếm bên phải) */
.cat-sidebar {
    background: transparent !important; /* Xóa nền sidebar tổng nếu có */
    border: none !important;
    padding: 0 !important;
}

/* Tạo khung riêng cho từng block widget bên trái (Nhóm sản phẩm, Cây trồng, Banner gia công) */
.cat-sidebar .filter-group {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.product-cats-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.product-cats-sidebar-list li {
    margin-bottom: 6px;
}
.product-cats-sidebar-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    color: #333;
    font-size: 14px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}
.product-cats-sidebar-list li.active a,
.product-cats-sidebar-list li a:hover {
    background-color: #008542;
    color: #fff;
}
.product-cats-sidebar-list li a span.count {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.product-cats-sidebar-list li.active a span.count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}



/* 3. Banner Gia công theo công thức riêng (Màu vàng & Nút hồng) */
.sidebar-custom-banner {
    background-color: #ffeb3b;
    border: 1px solid #fbc02d;
    padding: 18px;
    border-radius: 8px;
    text-align: left;
}
.sidebar-custom-banner h4 {
    font-size: 15px;
    font-weight: 700;
    color: #111;
    margin-bottom: 8px;
}
.sidebar-custom-banner p {
    font-size: 12px;
    color: #444;
    margin-bottom: 15px;
    line-height: 1.4;
}
.sidebar-custom-banner .btn-pink {
    background-color: #e91e63;
    color: #fff;
    padding: 7px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    text-decoration: none;
    transition: background 0.2s;
}
.sidebar-custom-banner .btn-pink:hover {
    background-color: #d81b60;
    color: #fff;
}

/* 4. Khung Header bên phải (Bộ lọc & Sắp xếp) */
.cat-main__header {
    background: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border: 1px solid #e2e2e2;
}
.cat-result-count-wrap {
    font-size: 14px;
    color: #333;
}
.cat-result-count-wrap .sub-count {
    color: #777;
    margin-left: 5px;
}
/* Sắp xếp: nhãn và ô chọn nằm ngang trên desktop */
.cat-orderby-custom {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
}
.cat-orderby-custom label {
    margin: 0 !important;      /* Flatsome mặc định có margin-bottom cho label */
    white-space: nowrap !important; /* giữ chữ Sắp xếp trên 1 dòng */
    flex: 0 0 auto !important;      /* không cho label bị co lại */
    width: auto !important;
    font-size: 14px;
    font-weight: 600;
}
.cat-orderby-custom .cat-sort-select {
    margin: 0 !important;      /* Flatsome mặc định có margin-bottom cho select */
    min-width: 150px;
    width: auto !important;
}
.cat-sort-select {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 13px;
    background: #fff;
}
.custom-product-attributes {
    margin: 8px 0 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.box-excerpt.is-small {
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Số dòng muốn hiển thị (có thể sửa thành 1 hoặc 3) */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 2. Định dạng từng nhãn thuộc tính (span.attr-label) */
.custom-product-attributes span.attr-label {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.9) !important; /* Nền trắng mờ nhẹ hoặc trắng sáng */
    color: #008542 !important;                              /* Chữ màu xanh lá chủ đạo */
    padding: 4px 12px !important;
    border-radius: 50px !important;                         /* Bo tròn dạng viên thuốc */
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    border: 1px solid rgba(0, 133, 66, 0.15) !important;   /* Viền xanh lá nhạt sang trọng */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
/* 6. Responsive cho Mobile */
@media (max-width: 849px) {
    #cat-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100%;
        background: #fff;
        z-index: 99999;
        transition: 0.3s ease;
        overflow-y: auto;
    }
    #cat-sidebar.active {
        left: 0;
    }
}

@media only screen and (max-width: 48em) {

    /* 1. Cột giãn hết chiều cao hàng, box bên trong giãn theo */
    .product-small.col {
        display: flex !important;
    }
    .product-small.col > .col-inner {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    .product-small.col .product-small.box {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        height: 100% !important;
        padding: 8px !important;
    }

    /* 2. Phần chữ chiếm hết chỗ còn lại để nút luôn dồn xuống đáy */
    .product-small.col .box-text.box-text-products {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
    }

    /* 3. Tên sản phẩm tối đa 2 dòng, luôn chiếm đủ chiều cao 2 dòng */
    .product-small.col .box-text .product-title,
    .product-small.col .box-text .product-title a,
    .product-small.col .box-text .woocommerce-loop-product__title,
    .product-small.col .box-text .woocommerce-loop-product__title a {
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.35 !important;
        font-size: 14px !important;
    }
    .product-small.col .box-text .product-title,
    .product-small.col .box-text .woocommerce-loop-product__title {
        min-height: 2.7em !important; /* 2 dòng x 1.35em */
    }

    /* 4. Nút nằm sát đáy box */
    .product-small.col .box-text .button {
        margin-top: auto !important;
    }

    /* 5. Sửa nhãn danh mục bị lệch do bottom: 380px */
    .product-small.col .custom-cat-badge {
        top: 10px !important;
        bottom: auto !important;
    }
	.product-small.col .product-small.box .custom-cat-badge,
    .product-small.col .product-small.box .badge-container + .custom-cat-badge,
    .product-small.col .product-small.box .box-image .custom-cat-badge {
        top: -140px !important;
        bottom: auto !important;
        left: 14px !important;
        font-size: 10px !important;
        padding: 3px 8px !important;
    }
	/* 1. Header chia 2 hàng: số lượng ở trên, nút lọc và sắp xếp ở dưới */
    .cat-main__header {
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 12px !important;
    }

    /* 2. Hàng trên: số lượng sản phẩm chiếm trọn chiều ngang */
    .cat-main__header .cat-result-count-wrap {
        order: 1;
        width: 100% !important;
        font-size: 14px !important;
    }
    .cat-main__header .cat-result-count-wrap strong,
    .cat-main__header .cat-result-count-wrap .sub-count {
        white-space: nowrap; /* không cho chữ gãy dòng giữa chừng */
    }

    /* 3. Nút Danh mục và Bộ lọc: gọn, không in hoa, không xuống dòng */
    .cat-main__header .cat-filter-toggle {
        order: 2;
        flex: 1 1 auto;
        margin: 0 !important;
        padding: 0 12px !important;
        height: 38px !important;
        min-height: 0 !important;
        line-height: 38px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        text-transform: none !important;
        white-space: nowrap !important;
        background: #fff !important;
        color: #008542 !important;
        border: 1px solid #008542 !important;
        border-radius: 4px !important;
    }

    /* 4. Sắp xếp: nhãn và ô chọn nằm cùng một hàng ngang */
    .cat-main__header .cat-orderby-custom {
        order: 3;
        flex: 1 1 auto;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 6px !important;
    }
    .cat-main__header .cat-orderby-custom label {
        margin: 0 !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        white-space: nowrap !important; /* giữ chữ Sắp xếp trên 1 dòng */
        width: auto !important;
    }
    .cat-main__header .cat-sort-select {
        flex: 1 1 auto;
        width: 100% !important;
        min-width: 0;
        height: 38px !important;
        margin: 0 !important; /* Flatsome mặc định có margin-bottom cho select */
        padding: 0 8px !important;
        font-size: 13px !important;
        box-shadow: none !important;
    }
}
/* Overlay mặc định ẩn (desktop không dùng) */
.cat-sidebar-overlay {
    display: none;
}

@media (max-width: 849px) {

    /* Sidebar dạng drawer trượt từ trái, ghi đè các rule transparent và padding 0 ở trên */
    #cat-sidebar.cat-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -320px !important;
        width: 290px !important;
        max-width: 85% !important;
        height: 100% !important;
        flex: none !important;
        background: #f7f9f8 !important;
        padding: 16px !important;
        overflow-y: auto !important;
        z-index: 99999 !important;
        transition: left 0.3s ease !important;
        box-shadow: none;
    }
    #cat-sidebar.cat-sidebar.active {
        left: 0 !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    }

    /* Nút đóng */
    .cat-sidebar-close {
        margin-bottom: 14px;
        text-align: right;
    }
    #sidebar-close {
        margin: 0 !important;
        padding: 0 14px !important;
        height: 34px !important;
        min-height: 0 !important;
        line-height: 34px !important;
        font-size: 13px !important;
        text-transform: none !important;
        background: #fff !important;
        color: #333 !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
    }

    /* Lớp nền tối phía sau drawer */
    .cat-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }
    .cat-sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Khóa cuộn trang nền khi mở drawer */
    body.cat-sidebar-open {
        overflow: hidden;
    }
}
.ls-crumb-bar .rank-math-breadcrumb,
.ls-crumb-bar .rank-math-breadcrumb a,
.ls-crumb-bar .rank-math-breadcrumb span {
    color: #000000 !important;
}
.ls-crumb-bar .rank-math-breadcrumb a:hover {
    text-decoration: underline !important;
}