/*
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.   ***************/


/* ==========================================================================
   1. PHÁ VỠ CẤU TRÚC LƯỚI (GRID) TRÊN TRANG PRODUCT CATALOG ĐỂ CHUYỂN DỌC
   ========================================================================== */

/* Ép container chứa sản phẩm hiển thị dạng khối dọc thay vì lưới ô vuông */
.archive.woocommerce .products.row,
.archive.woocommerce .products.grid {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}

/* Ép tất cả các cột sản phẩm mở rộng 100% chiều ngang */
.archive.woocommerce .products .col {
    max-width: 100% !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    padding: 0 !important;
    float: none !important;
}

/* Khung bao ngoài tạo khoảng cách hàng cho từng sản phẩm ở trang Catalog */
.catalog-customer-product-wrapper {
    width: 100%;
    margin-bottom: 20px;
}

/* Container tổng bao ngoài danh sách đối với Shortcode [ux_customer_product_list] */
.customer-product-container {
    border-radius: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================================================
   2. BỐ CỤC CHI TIẾT ĐỒNG BỘ THEO PHOM MẪU PRODUCT LIST (DESKTOP)
   ========================================================================== */

/* Cấu trúc từng hàng item */
.customer-product-row {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px !important;
    padding: 15px 15px !important;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
}

.customer-product-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.05);
}

/* CỘT 1: Chứa Logo vuông và text giảm giá nằm LIỀN KỀ nhau trước vạch kẻ */
.customer-col-left {
    display: flex;
    align-items: center;
    width: 35%; 
    padding-right: 25px;
}

/* Khung chứa ảnh LOGO HÌNH VUÔNG TUYỆT ĐỐI */
.customer-logo-square {
    width: 120px !important;
    height: 120px !important;
    margin-right: 25px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important; 
    background: #ffffff !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}
.customer-logo-square img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Ép hình ảnh phủ kín ô vuông không bị dẹt */
}
.customer-logo-link {
    display: inline-block;
}

/* Định dạng chữ phần trăm giảm giá ACF */
.customer-discount-value {
    font-size: 28px !important;
    font-weight: 700 !important;
    color: #1a202c;
    line-height: 1.2;
    text-transform: uppercase;
    flex: 1;
    text-align: center;
}

/* CỘT 2: Chứa thông tin chi tiết (NẰM SAU VẠCH KẺ ĐỨNG) */
.customer-col-middle {
    width: 45%;
    padding-left: 30px;
    padding-right: 20px;
    border-left: 1px solid #edf2f7; /* VẠCH KẺ ĐỨNG phân tách nằm ở đây */
    text-align: left;
}

/* Tiêu đề sản phẩm */
.customer-product-title {
    font-size: 1.15em !important;
    font-weight: normal !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.3 !important;
}
.customer-product-title a {
    text-decoration: none !important;
    transition: color 0.2s ease;
}

/* Text phụ tên thương hiệu danh mục */
.customer-product-vendor {
    font-size: 13px !important;
    color: #4a5568;
    text-decoration: underline;
    font-weight: 500;
    margin-bottom: 6px;
}

/* Khu vực hiển thị Đánh giá Sao của Flatsome */
.customer-product-rating {
    margin-bottom: 8px;
    display: block;
}
.customer-product-rating .star-rating {
    font-size: 14px !important;
    width: 75px; 
}
.customer-product-rating .star-rating span::before, 
.customer-product-rating .star-rating::before {
    color: #d26e4b !important; /* Đổi màu ngôi sao thành màu cam đất giống hình mẫu */
}

/* Giá sản phẩm to đậm nét */
.customer-product-price,
.customer-product-price amount,
.customer-product-price ins {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #1a202c !important;
    text-decoration: none !important;
    margin-top: 4px;
}
.customer-product-price del {
    font-size: 14px !important;
    color: #a0aec0 !important;
    margin-right: 6px;
}

/* CỘT 3: Chứa nút Add to cart */
.customer-col-right {
    width: 20%;
    text-align: right;
}

/* Định dạng nút Add to cart xanh thẫm, bo viền mượt mà */
.customer-add-to-cart-btn {
    background-color: #2e59ca !important;
    color: #ffffff !important;
    padding: 12px 30px !important;
    border-radius: 6px !important;
    text-transform: none !important; 
    display: inline-block;
    transition: background-color 0.2s ease;
    border: none !important;
    text-decoration: none !important;
    white-space: nowrap;
    
    /* FIX CĂN GIỮA: Triệt tiêu hoàn toàn margin thừa từ theme */
    margin-bottom: 0 !important; 
    margin-top: 0 !important;
    vertical-align: middle !important;
}
.customer-add-to-cart-btn:hover {
    background-color: #1e429f !important;
    color: #ffffff !important;
}

/* ==========================================================================
   Css trang chi tiết sản phẩm
   ========================================================================== */
.product_meta>span {
    border-top: none !important;
}

.delivery-trust-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(253, 253, 253, 0.2); /* Màu nền xám trắng cực nhẹ */
    border: 1px dashed #cbd5e1; /* Viền nét đứt mảnh chuẩn mẫu */
    border-radius: 6px;
    padding: 14px 26px;
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
    gap: 20px;
}

/* Khung chứa từng phần tử cam kết */
.trust-item {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 16px;
}

/* Khung tròn chứa Icon màu trắng có đổ bóng nhẹ */
.trust-icon-box {
    width: 50px;
    height: 50px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05); /* Đổ bóng mờ mịn */
    flex-shrink: 0;
}

/* Định dạng màu sắc và kích cỡ cho Icon SVG */
.trust-icon-box svg {
    width: 24px;
    height: 24px;
    color: #1a3a78; /* Màu xanh thẫm hoàng gia theo ảnh mẫu */
}

/* Khối chữ chi tiết bên phải */
.trust-text-box {
    display: flex;
    flex-direction: column;
    text-align: left;
}

/* Tiêu đề dòng trên (Đậm) */
.trust-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #f6f8ff !important;
    margin: 0 0 3px 0 !important;
    line-height: 1.3 !important;
    font-family: sans-serif;
}

/* Dòng mô tả phía dưới (Nhạt hơn) */
.trust-desc {
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #ffffff !important;
    margin: 0 !important;
    line-height: 1.3 !important;
    font-family: sans-serif;
}

/* Ẩn Product SKU */
.sku_wrapper {
    display: none !important;
}

/* Định dạng màu sắc và kích cỡ cho Icon SVG Sold */
.trust-icon-sold {
    display: flex;
    justify-content: space-between;
    margin-top: 8px !important;
}

.trust-icon-sold svg {
    width: 26px;
    height: 26px;
    color: #1a3a78; /* Màu xanh thẫm hoàng gia theo ảnh mẫu */
}

.trust-icon-sold p {
    padding-left: 10px;
}

/* 1. Màu Review buton */

.cr-all-reviews-shortcode .cr-summaryBox-wrap .cr-add-review-wrap .cr-all-reviews-add-review, .cr-reviews-grid .cr-summaryBox-wrap .cr-add-review-wrap .cr-all-reviews-add-review {
    background-color: #0c5adb;
}

.cr-all-reviews-shortcode .cr-summaryBox-wrap .cr-add-review-wrap .cr-all-reviews-add-review:hover, .cr-reviews-grid .cr-summaryBox-wrap .cr-add-review-wrap .cr-all-reviews-add-review:hover {
    background-color: #537ff7;
}

.cr-all-reviews-shortcode .cr-review-form-wrap .cr-review-form-buttons .cr-review-form-submit, .cr-ajax-reviews-review-form .cr-review-form-wrap .cr-review-form-buttons .cr-review-form-submit, .cr-reviews-grid .cr-review-form-wrap .cr-review-form-buttons .cr-review-form-submit, .cr-qna-block .cr-review-form-buttons .cr-review-form-submit {
    background-color: #0c5adb;
}

.cr-all-reviews-shortcode .cr-review-form-buttons .cr-review-form-submit:hover, .cr-ajax-reviews-review-form .cr-review-form-buttons .cr-review-form-submit:hover, .cr-reviews-grid .cr-review-form-buttons .cr-review-form-submit:hover, .cr-qna-block .cr-review-form-buttons .cr-review-form-submit:hover {
    background-color: #537ff7;
}


/* ==========================================================================
   KHÔI PHỤC HOÀN TOÀN KHỐI RELATED PRODUCTS VỀ DẠNG LƯỚI (GRID) CHUẨN
   ========================================================================== */

/* 1. Ép thẻ sản phẩm xếp theo chiều dọc (Ảnh ở trên - Chữ ở dưới) */
.related-products-wrapper .product-small.box-vertical,
.related-products-wrapper .product-small.box {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 15px 15px !important;
    height: 100% !important;
}

/* 2. Căn giữa và định dạng lại Ảnh Logo phía trên */
.related-products-wrapper .product-small .box-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin: 0 0 15px 0 !important;
    padding: 0 !important;
}

.related-products-wrapper .product-small .box-image img {
    width: 100% !important;
    max-width: 100% !important; /* Tăng giới hạn chiều rộng từ 100px lên 180px */
    height: 100% !important;    /* Tăng chiều cao lên 180px */
    object-fit: contain !important; /* Giữ ảnh sắc nét, không bị dẹt hình */
    margin: 0 auto !important;
    display: block !important;
}

/* 3. Phá bỏ thuộc tính table-cell của box-vertical để chữ nằm bên dưới ảnh */
.related-products-wrapper .product-small .box-text {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
    vertical-align: unset !important;
}

/* 4. Định dạng lại Tiêu đề & Giá tiền căn giữa */
.related-products-wrapper .product-small .title-wrapper {
    margin-bottom: 6px !important;
}

.related-products-wrapper .product-small .title-wrapper a {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    line-height: 1.3 !important;
}

.related-products-wrapper .product-small .price-wrapper {
    margin-bottom: 8px !important;
}

/* 5. Căn giữa Nút bấm (Add to cart / Select options) ở đáy thẻ */
.related-products-wrapper .product-small .add_to_cart_button,
.related-products-wrapper .product-small .button {
    display: inline-block !important;
    margin: 6px auto 0 auto !important;
    float: none !important;
    position: relative !important;
    transform: none !important;
}

/* Size font Description */
.woocommerce-tabs .nav>li>a {
    font-size: 1.25em !important;
}

.woocommerce-tabs .nav-line>li>a:before {
    background-color: unset !important;
}

/* Thay đổi cỡ chữ giá tiền trong trang chi tiết sản phẩm Flatsome */
.single-product p.price.product-page-price .woocommerce-Price-amount,
.single-product .woocommerce-variation-price .woocommerce-Price-amount {
    font-size: 20px !important;
    color: #f54d18 !important;
}

/* Ép khung thẻ sản phẩm thành hình vuông màu trắng (1:1) */
.flickity-slider .product-small.box,
.products .product-small.box {
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    height: auto !important;
    background-color: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 15px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    box-sizing: border-box !important;
}

.flickity-slider .product-small.box:hover,
.products .product-small.box:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

/* Vô hiệu hóa hiệu ứng tràn viền (image-cover) của Flatsome */
.flickity-slider .box-image,
.flickity-slider .box-image .image-cover,
.products .box-image,
.products .box-image .image-cover {
    width: 100% !important;
    height: auto !important;
    padding-top: 0 !important; /* Loại bỏ padding-top: 100% gây tràn khung */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-bottom: 10px !important;
    background: transparent !important;
}

/* Thu nhỏ logo xuống 45% và căn giữa tuyệt đối */
.flickity-slider .box-image img,
.products .box-image img {
    position: relative !important; /* Phá bỏ position: absolute tràn viền */
    width: 50% !important;         /* Kích thước logo vừa vặn trong ô vuông */
    height: auto !important;
    object-fit: contain !important; /* Vừa khung, không bị bóp méo/zoom hình */
    margin: 0 auto !important;
    display: block !important;
    border-radius: 6px !important;
}

/* Căn giữa phần chữ + giá tiền */
.flickity-slider .box-text,
.products .box-text {
    padding: 0 !important;
    text-align: center !important;
    width: 100% !important;
    background: transparent !important;
}

/* Khung sản phẩm bo góc nhẹ và đổ bóng */
.best-sale-section .product-small.box,
.row.best-sale-section .product-small.box {
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s ease !important;
}

/* Hiệu ứng nổi khung khi di chuột vào */
.best-sale-section .product-small.box:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Tạo ô vuông màu trắng (1:1) căn giữa Logo */
.best-sale-section .box-image {
    background-color: #ffffff !important; /* Ô màu trắng */
    width: 100% !important;
}

.best-sale-section .box-image a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    aspect-ratio: 1 / 1 !important; /* Tạo khung vuông chuẩn 1:1 */
    width: 100% !important;
    padding: 16px !important; /* Khoảng cách căn đều xung quanh Logo */
    box-sizing: border-box !important;
}

/* Logo nằm thu nhỏ vuông vắn trong ô trắng */
.best-sale-section .box-image img {
    width: auto !important;
    max-width: 70% !important;  /* Tỷ lệ thu nhỏ logo */
    max-height: 70% !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

/* Ph phóng nhẹ Logo khi di chuột vào */
.best-sale-section .product-small.box:hover .box-image img {
    transform: scale(1.1) !important;
}

/* ==========================================================================
   3. TỐI ƯU RESPONSIVE CHO THIẾT BỊ DI ĐỘNG (MOBILE)
   ========================================================================== */
@media only screen and (max-width: 48em) {
/*************** ADD MOBILE ONLY CSS HERE  ***************/

    /* 1. Ép danh sách sản phẩm trang Catalog (Shop/Category) chia 2 cột */
    .archive.woocommerce .products.row,
    .archive.woocommerce .products.grid {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-left: -6px !important;
        margin-right: -6px !important;
    }

    .archive.woocommerce .products .col {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
        padding: 6px !important;
    }

    /* 2. Chia 2 cột cho cả Shortcode [ux_customer_product_list] ngoài trang chủ */
    /* Khai báo khung chứaFlex */
    .customer-product-container {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important; /* Khoảng cách giữa các sản phẩm */
    }

    /* Cấu hình lại thẻ con với selector chính xác và vùng đệm an toàn */
    .customer-product-container .customer-product-row {
        width: calc(50% - 7px) !important; /* Trừ lùi 7px tạo độ hở an toàn chống làm tròn pixel */
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    /* Cập nhật lại độ rộng phần tử con để không bị nhảy xuống dòng khi thêm khoảng cách */
    .customer-product-container > div {
        width: calc(50% - 6px) !important; /* 6px là một nửa của 12px gap */
    }

    .customer-product-container .customer-product-row {
        width: calc(50% - 5px) !important;
        margin-bottom: 0 !important;
    }

    /* 3. Tùy chỉnh các khối bên trong từng sản phẩm nằm gọn trong nửa màn hình */
    .customer-product-row {
        flex-direction: column !important;
        padding: 12px 8px !important;
        text-align: center !important;
        height: 100% !important; /* Đảm bảo các ô cao bằng nhau */
        justify-content: space-between !important;
    }

    /* Cột 1: Ảnh Logo & Giảm giá */
    .customer-col-left {
        width: 100% !important;
        padding-right: 0 !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 6px !important;
        margin-bottom: 6px !important;
    }

    .customer-discount-value {
        font-size: 14px !important;
        text-align: center !important;
    }

    /* Cột 2: Chi tiết Tên, Giá, Đánh giá */
    .customer-col-middle {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        border-left: none !important;
        border-top: 1px dashed #e2e8f0 !important; /* Viền nét đứt nhẹ phân tách */
        padding-top: 8px !important;
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .customer-product-title {
        font-size: 13px !important;
        line-height: 1.25 !important;
        margin-bottom: 3px !important;
    }

    .customer-product-vendor {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }

    .customer-product-rating .star-rating {
        font-size: 11px !important;
        width: 60px !important;
    }

    .customer-product-price,
    .customer-product-price amount,
    .customer-product-price ins {
        font-size: 15px !important;
    }

    /* Cột 3: Nút bấm Add to cart full-width ở đáy ô */
    .customer-col-right {
        width: 100% !important;
        text-align: center !important;
        margin-top: 8px !important;
    }

    .customer-add-to-cart-btn {
        width: 100% !important;
        padding: 8px 6px !important;
        font-size: 12px !important;
        display: block !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
    }

    .customer-product-row {
        flex-direction: column;
        text-align: center;
        padding: 10px !important;
        margin-bottom: 10px;
    }
    
    .customer-col-left {
        width: 100%;
        padding-right: 0;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .customer-logo-square {
        margin-right: 0 !important;
    }

    .customer-col-middle {
        width: 100%;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid #edf2f7;
        padding-top: 15px;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .customer-col-right {
        width: 100%;
        text-align: center;
        margin-top: 15px;
    }
    
    .customer-add-to-cart-btn {
        width: 100%;
        display: block;
    }

    .delivery-trust-container {
        flex-direction: column; /* Chuyển thành hàng dọc trên Mobile */
        align-items: flex-start;
        padding: 20px;
        gap: 22px;
    }
    .trust-item {
        width: 100%;
    }

    .related.products .products .col,
    .upsells.products .products .col {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
    }

    /* Bỏ ép tỉ lệ khung vuông */
    .flickity-slider .product-small.box,
    .products .product-small.box {
        aspect-ratio: unset !important;
    }

    /* Trả lại kích thước ảnh 100% trên di động */
    .flickity-slider .box-image img,
    .products .box-image img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
    }

    /* Hủy bỏ ô vuông và padding thu nhỏ */
    .best-sale-section .box-image a {
        aspect-ratio: auto !important;
        padding: 0 !important;
        display: block !important;
    }

    /* Trả ảnh về kích thước full 100% ban đầu */
    .best-sale-section .box-image img {
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        margin: 0 !important;
        transform: none !important;
    }

    .customer-logo-square {
    width: 100% !important;
    height: 100% !important;
    }
}