.sw-popup-quickbuy, .sw-popup-quickbuy * {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.sw-popup-quickbuy {
    /* Mặc định ẩn và thiết lập font hiện đại */
    display: none;
    color: #333;
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif; 
    font-size: 15px;
    line-height: 1.5;
    
    /* Cần thiết lập position: absolute để bPopup có thể tính toán vị trí */
    position: absolute; 
}

.sw-popup-inner {
    width: 750px;
    min-height: 200px;
    min-width: 300px;
    
    /* RẤT QUAN TRỌNG: LOẠI BỎ HẾT top, left, transform GÂY XUNG ĐỘT */
    
    background: #fff;
    overflow: hidden;
    border-radius: 8px; /* Bo góc */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2); /* Bóng đổ chuyên nghiệp */
}

.sw-popup-content {
    padding: 20px;
    overflow: hidden;
}

.sw-popup-title {
    background: #007bff; /* Màu header hiện đại */
    height: 50px;
    line-height: 50px;
    padding-left: 20px;
    padding-right: 50px;
    font-size: 18px;
    font-weight: 600;
    text-transform: none;
    color: #fff;
    position: relative;
}
.sw-popup-title span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sw-popup-close {
    width: 30px; 
    height: 30px;
    display: inline-block;
    position: absolute;
    top: 10px;
    right: 10px;
    transition: ease .25s all;
    text-align: center;
    line-height: 28px;
    color: #fff;
    background: none; 
    overflow: hidden;
    text-indent: 0; /* Cho phép hiển thị ký tự đóng */
    border: 0 solid transparent;
    outline: 0;
    appearance: none!important;
    margin: auto;
    padding: 0;
    min-height: inherit;
    font-size: 24px;
    cursor: pointer;
}
.sw-popup-close:hover {
    transform: rotate(90deg);
}
.sw-popup-close::before {
    content: '×'; /* Dùng ký tự 'X' thay vì ảnh nền */
}

.sw-popup-title {
    background: #007bff; /* Màu header hiện đại */
    height: 50px;
    line-height: 50px;
    padding-left: 20px;
    padding-right: 50px;
    font-size: 18px;
    font-weight: 600;
    text-transform: none;
    color: #fff;
    position: relative;
}
.sw-popup-title span {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sw-popup-close {
    width: 30px; 
    height: 30px;
    display: inline-block;
    position: absolute;
    top: 10px;
    right: 10px;
    transition: ease .25s all;
    text-align: center;
    line-height: 28px;
    color: #fff;
    background: none; 
    overflow: hidden;
    text-indent: 0; /* Cho phép hiển thị ký tự đóng */
    border: 0 solid transparent;
    outline: 0;
    appearance: none!important;
    margin: auto;
    padding: 0;
    min-height: inherit;
    font-size: 24px;
    cursor: pointer;
}
.sw-popup-close:hover {
    transform: rotate(90deg);
}
.sw-popup-close::before {
    content: '×'; /* Dùng ký tự 'X' thay vì ảnh nền */
}

.sw-popup-content-left, .sw-popup-content-right {
    width: 50%;
    float: left;
    padding: 0 15px; /* Cân đối padding cho desktop */
}
.sw-popup-content-left {
    border-right: 1px solid #eee; /* Đường phân cách giữa 2 cột */
}

.sw-popup-prod {
    display: table;
    width: 100%;
    margin-bottom: 15px;
}
.sw-popup-img, .sw-popup-info {
    display: table-cell;
    float: none;
    vertical-align: middle;
}
.sw-popup-img {
    width: 100px;
    height: auto;
    margin-right: 10px;
}

span.sw_title {
    font-size: 20px;
    color: #333;
    font-weight: 700;
    padding-bottom: 5px;
    display: block;
}
span.sw_price span.woocommerce-Price-amount {
    font-size: 18px;
    color: #ff4500; /* Màu giá nổi bật */
    font-weight: 700;
    padding-bottom: 5px;
    display: block;
}

.popup-customer-info-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
    padding-top: 10px;
}
.popup-customer-info-group {
    width: 100%;
    margin-bottom: 10px;
    overflow: hidden;
}

body .popup-customer-info-group input, 
body .popup-customer-info-group select, 
body .popup-customer-info-group textarea {
    font-size: 14px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    width: 100%;
    height: auto;
    box-shadow: none;
    margin: 0;
    border-radius: 4px;
    background: #fff;
}
.popup-customer-info-item-2 {
    width: 50%;
    float: left;
}
.popup-customer-info-group .popup-customer-info-item-2:first-child {
    padding-right: 5px;
}
.popup-customer-info-item-2:nth-child(2) {
    padding-left: 5px;
}
body .popup-customer-info-group textarea {
    height: 70px;
    min-height: inherit;
}

.popup-customer-info-radio label span {
    padding-left: 23px;
}
/* ... (Giữ nguyên styling radio button: popup-customer-info-radio) ... */
.popup-customer-info-radio label input {
    border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px;
}
.popup-customer-info-radio label span:after, .popup-customer-info-radio label span:before {
    width: 16px; height: 16px; content: ""; position: absolute; border: 1px solid #a6a6a6; border-radius: 50%; top: 1px; left: 0;
}
.popup-customer-info-radio label input:checked~span:before {
    border: 1px solid #fd7518;
}
.popup-customer-info-radio label input:checked~span:after {
    background: #fd7518; border: 1px solid #fd7518; width: 8px; height: 8px; top: 5px; left: 4px;
}

.popup-customer-info-group .sw-order-btn {
    width: 100%;
    height: 45px;
    background: #00c65e; /* Nút đặt hàng nổi bật */
    color: #fff;
    font-size: 18px;
    text-transform: uppercase;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    outline: 0;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0;
    transition: background 0.2s;
}
.popup-customer-info-group .sw-order-btn:hover {
    background: #00a04b;
}

a.sw_buy_now {
    display: block;
    overflow: hidden;
    clear: both;
    padding: 12px 0;
    border-radius: 4px;
    font-size: 18px;
    line-height: normal;
    text-transform: uppercase;
    color: #fff!important;
    text-align: center;
    background: #ff4500; /* Màu CTA nổi bật */
    margin: 0 0 20px;
    text-decoration: none;
    border-bottom: 0!important;
    max-width: 350px;
    width: 100%;
    font-weight: 700;
    transition: background 0.2s;
}
a.sw_buy_now:hover {
    background: #e03d00;
}
a.sw_buy_now  span {
    display: block;
    font-size: 14px;
    color: #fff;
    text-transform: none;
    margin: 2px 0 0;
    font-weight: 400;
}

/* Loading Spinner */
.sw-order-btn.loading {
    opacity: 1!important; position: relative; color: rgba(255,255,255,.05); pointer-events: none!important
}
.sw-order-btn.loading:after{
    animation: sw_spin .5s infinite linear; border: 2px solid #fff; border-radius: 32px; border-right-color: transparent!important; border-top-color: transparent!important; content: ""; display: block; height: 16px; top: 50%; margin-top: -8px; left: 50%; margin-left: -8px; position: absolute; width: 16px
}
@keyframes sw_spin {
    0% {-webkit-transform: rotate(0); transform: rotate(0)}
    100% {-webkit-transform: rotate(360deg); transform: rotate(360deg)}
}

@media (max-width: 768px) {
    .sw-popup-inner {
        width: 95%; 
        max-width: 450px;
        min-width: unset;
        
        /* QUAN TRỌNG: Căn giữa tuyệt đối bằng margin: auto */
        margin: 20px auto; 
        
        /* Bị lệch vì thuộc tính left/top/transform trong CSS bị ghi đè */
        /* Ta sẽ xóa hết các thuộc tính định vị gây xung đột */
        top: auto !important;
        left: auto !important;
        transform: none !important;
        
        position: relative; /* Đảm bảo nó cuộn được và căn giữa */
    }
    .sw-popup-content {
        padding: 10px;
    }

    /* Đặt thành 1 cột */
    .sw-popup-content-left,
    .sw-popup-content-right {
        width: 100%;
        float: none;
        padding: 0;
    }
    .sw-popup-content-left {
        border-right: none;
        border-bottom: 1px solid #eee; 
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
    
    .popup-customer-info-item-2 {
        width: 50%; 
    }
    a.sw_buy_now {
        max-width: 100%;
    }
}

@media screen and (max-width: 768px) {
    .sw-popup-inner {
        width: 95% !important;
        max-width: none;
        margin: 20px auto;
        border-radius: 8px;
        overflow: hidden;
    }

    .sw-popup-content-left,
    .sw-popup-content-right {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }

    .sw-popup-title {
        font-size: 14px !important;
        line-height: 40px !important;
        padding: 0 40px 0 15px !important;
    }

    .popup-customer-info-group input,
    .popup-customer-info-group textarea {
        font-size: 14px !important;
        height: auto !important;
    }

    .sw-order-btn {
        font-size: 16px !important;
        height: 40px !important;
    }
}

.popup-customer-info-title {
    font-weight: 700;             /* Chữ đậm */
    text-transform: uppercase;    /* Viết hoa toàn bộ */
    font-size: 18px;              /* Cỡ chữ vừa phải */
    color: #222;                  /* Màu chữ đậm nhẹ, dễ đọc */
    margin-bottom: 12px;          /* Cách phần nội dung bên dưới */
    padding-bottom: 6px;          /* Tạo không gian cho viền */
    border-bottom: 2px solid #4CAF50; /* Viền dưới màu xanh lá (đổi tuỳ tông chủ đạo) */
    letter-spacing: 0.5px;        /* Tăng khoảng cách giữa các chữ nhẹ */
}

.sw-popup-info .sw_title {
    display: block;
    font-weight: 600;
    text-transform: uppercase;    /* Viết hoa toàn bộ */
    font-size: 17px;
    color: #333;
    background: #f0f8f5;
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.sw-popup-info .sw_price {
    display: block; /* QUAN TRỌNG: Chuyển sang block để chiếm toàn bộ chiều rộng */
    box-sizing: border-box; /* Rất quan trọng: Đảm bảo padding không làm tràn width: 100% */
    width: 100%; /* QUAN TRỌNG: Chiếm toàn bộ chiều rộng container cha */
    text-align: left; /* Căn lề trái nếu cần */

    /* Box Styling */
    background: #fff6f6;
    border: 1px solid #ffcccc;
    border-radius: 6px;
    padding: 6px 12px;
    
    /* Font và Màu sắc */
    font-size: 19px;
    font-weight: 700;
    color: #d62828;
    
    /* Khoảng cách */
    margin-top: 10px;
    margin-bottom: 0;
    
    white-space: nowrap; /* Giữ nguyên để giá không bị ngắt dòng */
}

/* Đảm bảo khối Giỏ hàng (chứa số lượng và nút gốc) sử dụng Flexbox */
.sw_prod_variable .cart {
    display: flex;
    align-items: center; /* Căn giữa các mục theo chiều dọc */
    gap: 15px; /* Khoảng cách giữa số lượng và nút */
    margin-bottom: 20px;
}

/* Ẩn nút Add to Cart gốc (theo JS của bạn) để tránh bị rối bố cục. 
   Nếu nút Mua Nhanh là nút chính, bạn không muốn nút này xuất hiện. */
.sw_prod_variable .single_add_to_cart_button {
    display: none !important;
}

/* Điều chỉnh lại khối số lượng (quantity) cho đẹp */
.quantity {
    /* Đảm bảo khối điều chỉnh số lượng không bị quá rộng */
    flex-shrink: 0;
    width: 120px; 
}

/* Đảm bảo input số lượng có kích thước hợp lý */
.quantity input.qty {
    height: 40px; /* Chiều cao hợp lý */
    text-align: center;
}

@media (max-width: 480px) {
    .sw_prod_variable .cart {
        flex-direction: column; /* Xếp chồng trên mobile rất nhỏ */
        align-items: flex-start; /* Căn lề trái */
        gap: 10px;
    }
    .quantity {
        width: 100%; /* Số lượng chiếm toàn bộ chiều ngang */
    }
}

/* Container chung cho số lượng và nút (Thường là form .cart) */
.sw_prod_variable .cart {
    display: flex; /* Kích hoạt Flexbox */
    align-items: center; /* Căn giữa các mục theo chiều dọc */
    gap: 15px; /* Khoảng cách giữa các phần tử */
    margin-bottom: 20px;
    width: 100%; /* Đảm bảo nó chiếm đủ chiều rộng */
}

/* Khối Số lượng */
.quantity {
    flex-shrink: 0; /* Không cho khối số lượng bị co lại */
    width: 120px; 
}

/* Nút Thêm vào Giỏ hàng */
.single_add_to_cart_button {
    flex-grow: 1; /* Cho nút co giãn để lấp đầy không gian còn lại */
    height: 45px; /* Chiều cao đồng bộ với input */
    line-height: 45px; /* Căn giữa chữ */
    text-align: center;
    padding: 0 15px; /* Bỏ padding cũ nếu có */
}

/* Điều chỉnh lại khối số lượng */
.quantity input.qty {
    height: 40px; 
    text-align: center;
}

/* Ẩn nút Mua Ngay riêng của bạn nếu nó nằm trong cùng container và bạn chỉ muốn nút gốc */
/* Nếu bạn muốn giữ cả nút Mua Nhanh và nút Thêm Giỏ hàng, bạn có thể cần thêm một container */

/* Điều chỉnh cho ảnh sản phẩm và thông tin sản phẩm */
.sw-popup-img, .sw-popup-info {
    display: table-cell;
    float: none;
    vertical-align: middle;
}

/* Tăng khoảng cách từ ảnh đến cột thông tin */
.sw-popup-img {
    width: 100px;
    height: auto;
    /* TĂNG KHOẢNG CÁCH TẠI ĐÂY */
    padding-right: 20px; /* Tăng từ 10px lên 20px (hoặc tùy ý) */
    /* Đảm bảo ảnh chiếm đúng kích thước */
    width: 120px; 
}

/* Định kiểu cho tổng giá sản phẩm (nếu nó là phần tử span, div hoặc p) */
.popup_quickbuy_total_calc {
    font-weight: 700; /* Làm đậm */
    font-size: 18px; /* Đảm bảo đủ lớn để dễ thấy */
    color: #333; /* Màu chữ đậm (hoặc màu đỏ nếu muốn nổi bật hơn) */
}

/* Định kiểu chung cho tổng giá sản phẩm (áp dụng cho cả Desktop và Mobile) */
.popup_quickbuy_total_calc {
    font-weight: 700 !important; /* BUỘC PHẢI ĐẬM, ngăn chặn các CSS khác ghi đè */
    font-size: 18px; 
    color: #333; 
}

/* 1. Thiết lập Flexbox cho container số lượng */
.sw-quantity-wrapper {
    display: flex; 
    align-items: center; 
    gap: 15px; 
    margin-bottom: 10px; 
    /* RẤT QUAN TRỌNG: Ngăn container Flexbox xuống dòng */
    flex-wrap: nowrap; 
}

/* 2. Điều chỉnh chữ "Số lượng" */
.sw-qty-label {
    font-weight: 700;
    font-size: 15px;
    color: #333;
    /* RẤT QUAN TRỌNG: Ngăn chữ bị xuống dòng */
    white-space: nowrap; 
    /* Đảm bảo nó không bị co lại quá mức */
    flex-shrink: 0; 
}

/* 3. Đảm bảo khối số lượng có kích thước cố định */
.sw-quantity-wrapper .quantity {
    flex-shrink: 0; 
    width: 120px; /* Chiều rộng cố định cho khối +- */
}

/* 4. Điều chỉnh cho màn hình mobile nhỏ hơn */
@media (max-width: 400px) {
    .sw-quantity-wrapper {
        gap: 10px;
    }
    .sw-qty-label {
        font-size: 14px; /* Giảm kích thước font nếu cần thiết */
    }
}

/* Đảm bảo thông báo không bị ảnh hưởng bởi float của các phần tử khác */
.popup-customer-note-mess {
    clear: both; /* Rất quan trọng để đảm bảo nó nằm dưới các phần tử float */
    padding: 10px;
    margin-top: 15px; /* Thêm khoảng cách với khối số lượng */
    margin-bottom: 5px; /* Khoảng cách với mép dưới */
    
    /* Định kiểu cảnh báo nhẹ */
    border: 1px solid #ffcc00; 
    background-color: #fffbe6; 
    color: #856404; 
    
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}