/*
Theme Name: puca Child
Theme URI: https://demo.thembay.com/puca/
Author: Thembay
Description: This is a child theme for puca
Version: 1.0
Author URI: https://thembay.com/
Template: puca
Text Domain: puca-child
*/

/*  [ Add your custom css below ]
- - - - - - - - - - - - - - - - - - - - */
.order-item-thumbnail {
    position: relative;
    flex: 0 0 80px;
    margin-right: 15px;
}

.quantity-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff0000;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 3px rgba(0,0,0,0.2);
}

.order-item-thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 3px;
    border: 1px solid #eee;
}

/* Các phần CSS khác giữ nguyên như trước */

/* === Order Summary Table === */
.woocommerce-checkout-review-order-table .order-summary {
    margin-top: 30px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
}

.woocommerce-checkout-review-order-table .order-summary h2 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 1.3em;
}

.woocommerce-checkout-review-order-table .order-summary-table {
    width: 100%;
    border-collapse: collapse;
}

.woocommerce-checkout-review-order-table .order-summary-table tr {
    border-bottom: 1px solid #eee;
}

.woocommerce-checkout-review-order-table .order-summary-table th {
    text-align: left;
    padding: 8px 0;
    font-weight: normal;
    color: #666;
}

.woocommerce-checkout-review-order-table .order-summary-table td {
    text-align: right;
    padding: 8px 0;
    font-weight: 500;
}

.woocommerce-checkout-review-order-table .order-summary-table .order-total th {
    font-weight: 600;
    color: #333;
}

.woocommerce-checkout-review-order-table .order-summary-table .order-total td {
    font-size: 1.2em;
    color: #d63638; /* Màu đỏ của WooCommerce */
    font-weight: 600;
}

/* Căn chỉnh shipping methods */
.woocommerce-checkout-review-order-table .shipping td {
    text-align: right;
}

.woocommerce-checkout-review-order-table .shipping ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.woocommerce-checkout-review-order-table .shipping li {
    text-align: right;
}
/* Nút đặt hàng */
#place_order {
    display: block;
    width: 100%;
    padding: 15px;
    margin-top: 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.3s;
}

#place_order:hover {
    background-color: #45a049;
}

/* Responsive */
@media (min-width: 768px) {
    #place_order {
        width: auto;
        float: right;
        min-width: 200px;
    }
}

/* Ẩn checkbox nhưng giữ text điều khoản */
.woocommerce-terms-and-conditions-checkbox-text {
    padding-left: 0 !important;
}
.woocommerce-terms-and-conditions-checkbox-text:before {
    display: none !important;
}

/* Định dạng lại text điều khoản */
.woocommerce-terms-and-conditions-checkbox-text {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* Tùy chỉnh giao diện phương thức thanh toán */
#payment {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
}

#payment ul.payment_methods {
    margin: 0;
    padding: 0;
    list-style: none;
}

#payment .payment_methods li {
    margin-bottom: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* Tùy chỉnh giao diện checkbox và ô ghi chú */
.custom-show-notes {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.custom-show-notes .woocommerce-form__label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.custom-show-notes .woocommerce-form__input-checkbox {
    margin-right: 10px;
}

#order_comments_field {
    transition: all 0.3s ease;
    margin-top: 15px;
}

#order_comments {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Style cho phần mã giảm giá */
.custom-coupon-field {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.custom-coupon-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.custom-coupon-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

#apply_coupon_btn {
    width: 100%;
    padding: 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

#apply_coupon_btn:hover {
    background-color: #45a049;
}

form.checkout_coupon {
    padding: 0;
    margin: 0;
}

.checkout-coupon-form {
    margin-top: 10px;
}

/* Custom CSS cho Review Order Table - Tối ưu hiển thị sản phẩm */

/* --- Tổng thể Container Danh sách sản phẩm --- */
.woocommerce-checkout-review-order-table .order-items-list {
    display: flex;
    flex-direction: column; /* Xếp các sản phẩm theo cột */
    gap: 15px; /* Khoảng cách giữa mỗi sản phẩm */
    margin-bottom: 20px; /* Khoảng cách với phần tổng kết */
}

/* --- Từng Sản phẩm trong Danh sách --- */
.woocommerce-checkout-review-order-table .order-item {
    display: flex;
    align-items: center; /* Căn giữa các item theo chiều dọc */
    gap: 12px; /* Khoảng cách giữa thumbnail và chi tiết sản phẩm */
    padding: 12px 0;
    border-bottom: 1px dashed #eaeaea; /* Đường phân cách giữa các sản phẩm */
    /* Không cần flex-direction: row; ở đây nữa vì nó là mặc định của flex.
       Nếu muốn đảm bảo, có thể thêm nhưng thường không cần. */
}
.woocommerce-checkout-review-order-table .order-item:last-child {
    border-bottom: none; /* Không có đường kẻ ở sản phẩm cuối cùng */
    padding-bottom: 0;
}


/* --- Container bên trái: Ảnh Thumbnail Sản phẩm (Avatar) --- */
.woocommerce-checkout-review-order-table .order-item-left {
    flex-shrink: 0; /* Quan trọng: Ngăn không cho ảnh bị co lại khi không gian hẹp */
    width: 60px; /* Kích thước cố định cho thumbnail. */
    height: 60px; /* Thêm height để đảm bảo tỷ lệ hình vuông */
    position: relative; /* Cần thiết cho badge số lượng */
    overflow: hidden; /* Đảm bảo ảnh không tràn ra ngoài khung */
    border-radius: 4px; /* Bo góc nhẹ cho ảnh */
}

.woocommerce-checkout-review-order-table .order-item-thumbnail {
    width: 100%;
    height: 100%;
    display: flex; /* Dùng flex để căn giữa ảnh nếu ảnh nhỏ hơn khung */
    align-items: center;
    justify-content: center;
}

.woocommerce-checkout-review-order-table .order-item-thumbnail img {
    display: block;
    width: 100%; /* Kéo ảnh lấp đầy khung */
    height: 100%; /* Kéo ảnh lấp đầy khung */
    object-fit: cover; /* Đảm bảo ảnh lấp đầy không gian mà không bị méo. */
}

/* --- Badge Số lượng sản phẩm --- */
.woocommerce-checkout-review-order-table .quantity-badge {
    position: absolute;
    top: -5px; /* Dịch lên trên một chút */
    right: -5px; /* Dịch sang phải một chút */
    background-color: #ff4500; /* Màu sắc nổi bật cho badge (cam đỏ) */
    color: white; /* Chữ trắng */
    border-radius: 50%; /* Làm tròn thành hình tròn */
    padding: 3px 6px; /* Khoảng cách chữ bên trong badge */
    font-size: 0.7em; /* Kích thước chữ nhỏ hơn */
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px; /* Đảm bảo hình tròn nhỏ */
    min-height: 18px;
    box-sizing: border-box; /* Tính cả padding và border vào kích thước */
    z-index: 10; /* Đảm bảo badge nằm trên ảnh */
}

/* --- Container bên phải: Tên sản phẩm, Biến thể, Giá --- */
.woocommerce-checkout-review-order-table .order-item-right {
    flex-grow: 1; /* Quan trọng: Cho phép phần này chiếm hết không gian còn lại */
    display: flex;
    /* Dưới đây là phần thay đổi quan trọng để tên và giá nằm ngang với nhau nếu đủ chỗ,
       hoặc xuống dòng nếu không đủ */
    flex-direction: row; /* Thay đổi thành row để tên và giá nằm ngang */
    justify-content: space-between; /* Đẩy tên và giá về hai phía */
    align-items: center; /* Căn giữa tên và giá theo chiều dọc */
    flex-wrap: wrap; /* Cho phép các mục xuống dòng nếu không đủ không gian */
}

.woocommerce-checkout-review-order-table .order-item-details {
    flex-grow: 1; /* Cho phép tên và biến thể chiếm không gian còn lại */
    /* Để tên và biến thể xếp dọc */
    display: flex;
    flex-direction: column;
    /* Loại bỏ justify-content nếu nó làm giãn quá mức */
}

.woocommerce-checkout-review-order-table .order-item-name {
    font-weight: 600;
    margin-bottom: 4px; /* Giảm margin bottom để gần biến thể hơn */
    font-size: 14px;
}
.woocommerce-checkout-review-order-table .order-item-name a {
    color: inherit;
    text-decoration: none;
}
.woocommerce-checkout-review-order-table .order-item-name a:hover {
    text-decoration: underline;
}

.woocommerce-checkout-review-order-table .order-item-variations {
    font-size: 0.85em;
    color: #666;
    margin-top: 0; /* Đảm bảo không có margin top không mong muốn */
    margin-bottom: 5px; /* Nếu có các yếu tố khác dưới biến thể */
}
.woocommerce-checkout-review-order-table .variation-attribute {
    margin-bottom: 2px;
}
.woocommerce-checkout-review-order-table .variation-attribute strong {
    font-weight: 500;
}


/* --- Giá sản phẩm --- */
.woocommerce-checkout-review-order-table .order-item-meta {
    flex-shrink: 0; /* Ngăn giá bị co lại */
    text-align: right; /* Căn phải giá */
    white-space: nowrap; /* Ngăn giá bị xuống dòng nếu dài */
    font-weight: bold; /* Làm nổi bật giá */
    margin-left: auto; /* Đẩy giá sang phải hết mức có thể */
    /* Loại bỏ margin-top nếu nó đẩy giá xuống không mong muốn */
    margin-top: 0;
    font-size: 14px; /* Đảm bảo font size nhất quán */
}
.woocommerce-checkout-review-order-table .order-item-price {
    font-size: 1em; /* Kích thước chữ giá */
    color: #333;
}


/* --- Media Queries cho Mobile --- */
@media (max-width: 767px) { /* Cho các thiết bị di động */
    .woocommerce-checkout-review-order-table .order-item {
        align-items: flex-start; /* Căn chỉnh top lại trên mobile nếu cần */
        gap: 10px; /* Giảm khoảng cách */
    }

    .woocommerce-checkout-review-order-table .order-item-left {
        width: 50px; /* Giảm kích thước ảnh trên mobile */
        height: 50px; /* Giảm kích thước ảnh trên mobile */
    }
    .woocommerce-checkout-review-order-table .quantity-badge {
        font-size: 0.6em;
        padding: 1px 3px;
        top: -2px; /* Điều chỉnh vị trí badge trên mobile */
        right: -2px;
        min-width: 15px;
        min-height: 15px;
    }
    
    .woocommerce-checkout-review-order-table .order-item-right {
        flex-direction: column; /* Trên mobile, có thể muốn tên và giá lại xuống dòng */
        align-items: flex-start; /* Căn trái nội dung */
    }
    .woocommerce-checkout-review-order-table .order-item-details {
        width: 100%; /* Chiếm toàn bộ chiều rộng có thể */
    }
    .woocommerce-checkout-review-order-table .order-item-meta {
        width: 100%; /* Chiếm toàn bộ chiều rộng có thể */
        text-align: left; /* Căn trái giá trên mobile */
        margin-left: 0; /* Bỏ margin auto để không bị đẩy sang phải */
        margin-top: 5px; /* Thêm khoảng cách giữa tên và giá */
    }
    .woocommerce-checkout-review-order-table .order-item-name {
        font-size: 0.85em; /* Giảm font size tên SP */
    }
    .woocommerce-checkout-review-order-table .order-item-variations {
        font-size: 0.75em; /* Giảm font size biến thể */
    }
}