/* CSS style cho ô nhập số lượng trên Checkout gọn gàng */
.checkout-qty-wrapper input.qty {
    width: 45px !important;
    padding: 5px 4px !important;
    text-align: center;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: bold;
    height: auto !important;
}

.checkout-qty-wrapper input.qty::-webkit-outer-spin-button,
.checkout-qty-wrapper input.qty::-webkit-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Tổng quan layout Checkout */
form.woocommerce-checkout {
    display: flex !important;
    flex-direction: column !important;
    gap: 2rem !important;
    max-width: 1200px !important;
    margin: 2rem auto !important;
    font-family: 'Inter', sans-serif !important;
    width: 100% !important;
}

@media (min-width: 768px) {
    form.woocommerce-checkout {
        display: grid !important;
        grid-template-columns: 58% 38% !important;
        justify-content: space-between !important;
        align-items: start !important;
    }

    /* 1. Khung thông tin khách hàng: Cột 1, Dòng 1 */
    form.woocommerce-checkout #customer_details {
        grid-column: 1 !important;
        grid-row: 1 !important;
        width: 100% !important;
        margin-right: 0 !important;
        float: none !important;
    }

    /* 2. Cho phép các phần tử con trực tiếp của #order_review tham gia vào Grid */
    form.woocommerce-checkout #order_review {
        display: contents !important;
    }

    /* 3. Bảng gói dịch vụ (đã bọc trong div .woocommerce-checkout-review-order-table): Cột 1, Dòng 2 */
    form.woocommerce-checkout .woocommerce-checkout-review-order-table {
        grid-column: 1 !important;
        grid-row: 2 !important;
        width: 100% !important;
    }

    /* 4. Khung hướng dẫn chuyển khoản QR: Cột 2, Dòng 1 */
    form.woocommerce-checkout .mf-checkout-qr-box {
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: 100% !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* 5. Khung cổng thanh toán & nút thanh toán: Cột 2 */
    form.woocommerce-checkout #payment {
        grid-column: 2 !important;
        grid-row: 1 / span 2 !important;
        width: 100% !important;

        /* Biến #payment thành chiếc box màu trắng riêng biệt trên desktop */
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 1.5rem !important;
        padding: 2rem !important;
        box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05) !important;
        position: sticky !important;
        top: 80px !important;
    }

    /* Thêm tiêu đề "Thanh toán" cho box payment trên desktop */
    form.woocommerce-checkout #payment::before {
        content: "💳 Phương thức thanh toán" !important;
        display: block !important;
        font-family: 'Lexend', sans-serif !important;
        font-weight: 800 !important;
        font-size: 1.125rem !important;
        color: #1e293b !important;
        margin-bottom: 1.5rem !important;
        border-bottom: 2px solid #f1f5f9 !important;
        padding-bottom: 0.75rem !important;
    }
}

#order_review_heading {
    display: none !important;
    /* Ẩn tiêu đề trùng lặp */
}

/* Đảm bảo col-1 (billing) chiếm 100% chiều rộng của #customer_details */
.col2-set .col-1 {
    width: 100% !important;
    float: none !important;
}

.col2-set .col-2 {
    display: none !important;
    /* Ẩn hoàn toàn vì ta đã tắt shipping fields */
}

/* Khung nhập thông tin khách hàng */
form.woocommerce-checkout #customer_details {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1.5rem !important;
    padding: 2rem !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05) !important;
}

form.woocommerce-checkout h3 {
    font-family: 'Lexend', sans-serif !important;
    font-weight: 800 !important;
    font-size: 1.25rem !important;
    color: #1e293b !important;
    margin-bottom: 1.5rem !important;
    border-bottom: 2px solid #f1f5f9 !important;
    padding-bottom: 0.75rem !important;
}

.woocommerce-checkout .form-row {
    margin-bottom: 1.25rem !important;
}

.woocommerce-checkout label {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
}

.woocommerce-checkout input.input-text {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 0.75rem !important;
    font-size: 0.875rem !important;
    color: #1e293b !important;
    outline: none !important;
    transition: all 0.2s !important;
    background-color: #f8fafc !important;
}

.woocommerce-checkout input.input-text:focus {
    border-color: #2563eb !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* Khung đơn hàng của bạn (chỉ áp dụng trên mobile) */
.woocommerce-checkout-review-order {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1.5rem !important;
    padding: 2rem !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05) !important;
}

/* Ẩn ô nhập số lượng trong checkout */
.woocommerce-checkout .checkout-qty-wrapper .quantity {
    display: none !important;
}

/* Giao diện nút chọn biến thể (dropdown) trong Checkout */
.checkout-variation-select {
    display: inline-block !important;
    width: 100% !important;
    max-width: 280px !important;
    font-size: 12px !important;
    padding: 8px 32px 8px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background-color: #ffffff !important;
    color: #334155 !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 10px center !important;
    background-repeat: no-repeat !important;
    background-size: 18px !important;
    outline: none !important;
    margin-top: 6px !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s !important;
}

.checkout-variation-select:hover {
    border-color: #94a3b8 !important;
    background-color: #f8fafc !important;
}

.checkout-variation-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* CSS cho Phương thức thanh toán */
#payment {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
}

#payment ul.payment_methods {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 1.5rem !important;
}

#payment ul.payment_methods li {
    padding: 0.75rem 1rem !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    background: #f8fafc !important;
    list-style: none !important;
    font-size: 0.875rem !important;
}

/* Ép hiển thị radio button chọn phương thức thanh toán mặc định */
#payment ul.payment_methods li input[type="radio"] {
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin-right: 0.5rem !important;
    -webkit-appearance: radio !important;
    -moz-appearance: radio !important;
    appearance: radio !important;
    cursor: pointer !important;
}

#payment ul.payment_methods li label {
    display: inline !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    cursor: pointer !important;
}

/* Ẩn khung mô tả cổng thanh toán */
#payment .payment_box {
    display: none !important;
}

/* Ẩn đoạn text chính sách bảo mật dài dòng trên button thanh toán */
.woocommerce-privacy-policy-text {
    display: none !important;
}

/* Place Order Button */
#place_order {
    width: 100% !important;
    padding: 1rem !important;
    background-color: #2563eb !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.875rem !important;
    border: none !important;
    border-radius: 0.75rem !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2), 0 2px 4px -2px rgba(37, 99, 235, 0.2) !important;
}

#place_order:hover {
    background-color: #1d4ed8 !important;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3) !important;
}

/* Khung mã giảm giá coupon */
.woocommerce-form-coupon-toggle {
    margin-bottom: 1rem !important;
}

.woocommerce-info {
    position: relative !important;
    border-top: 3px solid #2563eb !important;
    background-color: #eff6ff !important;
    padding: 1rem 1rem 1rem 3.25rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.875rem !important;
    color: #1e3a8a !important;
}

.woocommerce-info::before {
    left: 1.25rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    position: absolute !important;
}

.woocommerce-info a {
    color: #2563eb !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

/* Form nhập mã coupon rõ ràng hiện đại */
form.checkout_coupon {
    border: 1px solid #e2e8f0 !important;
    padding: 1.5rem !important;
    border-radius: 1rem !important;
    background-color: #ffffff !important;
    margin-bottom: 2rem !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: center !important;
}

form.checkout_coupon .form-row {
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    width: auto !important;
}

form.checkout_coupon .form-row-first {
    flex-grow: 1 !important;
    max-width: 320px !important;
}

form.checkout_coupon input.input-text {
    width: 100% !important;
    padding: 10px 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    outline: none !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

form.checkout_coupon input.input-text:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

form.checkout_coupon button.button {
    padding: 11px 24px !important;
    background-color: #10b981 !important;
    color: #ffffff !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    line-height: 1.2 !important;
    height: auto !important;
}

form.checkout_coupon button.button:hover {
    background-color: #059669 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2) !important;
}

/* Khung mã giảm giá khả dụng trên checkout */
.mf-active-coupon-checkout-notice {
    margin-bottom: 1.5rem !important;
    padding: 1rem 1.25rem !important;
    border-radius: 1rem !important;
    border: 1px dashed #10b981 !important;
    background-color: #ecfdf5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 15px !important;
    font-family: 'Inter', sans-serif !important;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.05) !important;
}

.mf-active-coupon-checkout-notice .coupon-info {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.mf-active-coupon-checkout-notice .coupon-text {
    font-size: 13px !important;
    color: #065f46 !important;
    line-height: 1.5 !important;
}

.mf-active-coupon-checkout-notice .coupon-code-badge {
    background-color: #10b981 !important;
    color: #ffffff !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
    font-weight: 800 !important;
    font-family: monospace !important;
    cursor: pointer !important;
    display: inline-block !important;
    transition: all 0.2s !important;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15) !important;
}

.mf-active-coupon-checkout-notice .coupon-code-badge:hover {
    background-color: #059669 !important;
    transform: scale(1.05) !important;
}

.mf-active-coupon-checkout-notice .apply-coupon-quick-btn {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.15) !important;
    white-space: nowrap !important;
}

.mf-active-coupon-checkout-notice .apply-coupon-quick-btn:hover {
    background-color: #059669 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.2) !important;
}

