/* ==========================================================================
   WOOCOMMERCE CHECKOUT CUSTOM STYLE (MIDORI DECOR THEME)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ẨN HEADER (CHỈ GIỮ LẠI LOGO CĂN GIỮA) & ẨN TRƯỜNG QUỐC GIA
   -------------------------------------------------------------------------- */
.woocommerce-checkout .agency-header-v2 .ah-mobile-left,
.woocommerce-checkout .agency-header-v2 .ah-main-nav,
.woocommerce-checkout .agency-header-v2 .ah-right-wrapper,
.woocommerce-checkout .agency-header-v2 .ah-mobile-right,
.woocommerce-checkout .agency-header-v2 .ah-mobi-search-dropdown,
.woocommerce-checkout .ah-mobile-menu-overlay,
.woocommerce-checkout .ah-gtranslate-hidden,
.woocommerce-checkout #billing_country_field,
.woocommerce-checkout #shipping_country_field {
    display: none !important;
}

.woocommerce-checkout .agency-header-v2 {
    background: #ffffff !important;
    border-bottom: 1px solid #f0f0f0 !important;
    box-shadow: none !important;
}

.woocommerce-checkout .agency-header-v2 .ah-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 15px 20px !important;
}

.woocommerce-checkout .agency-header-v2 .ah-logo {
    margin: 0 auto !important;
    text-align: center !important;
}

.woocommerce-checkout .agency-header-v2 .ah-logo img.logo-white {
    display: none !important;
}

.woocommerce-checkout .agency-header-v2 .ah-logo img.logo-main {
    display: inline-block !important;
    max-height: 48px !important;
}

/* --------------------------------------------------------------------------
   2. KHUNG MÃ GIẢM GIÁ (KHÔNG CÓ VIỀN TRÊN / LINE XANH)
   -------------------------------------------------------------------------- */
.woocommerce-checkout .woocommerce-form-coupon-toggle {
    margin-bottom: 16px !important;
}

.woocommerce-checkout .woocommerce-form-coupon-toggle .woocommerce-info {
    border: 1px solid #e2e8f0 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    background-color: #f8fafc !important;
    color: var(--text-dark, #333333) !important;
    padding: 10px 14px !important;
    font-size: 13.5px !important;
    border-radius: 4px;
}

.woocommerce-checkout .woocommerce-form-coupon-toggle .woocommerce-info::before {
    display: none !important;
}

.woocommerce-checkout .woocommerce-form-coupon-toggle .woocommerce-info a {
    color: var(--color-accent, #456C35) !important;
    font-weight: 600;
    text-decoration: underline;
}

.woocommerce-checkout form.checkout_coupon {
    border: 1px solid #cbd5e1 !important;
    padding: 14px !important;
    margin-bottom: 20px !important;
    border-radius: 4px !important;
    background: #ffffff !important;
}

/* --------------------------------------------------------------------------
   3. LAYOUT & CẤU TRÚC 2 CỘT
   -------------------------------------------------------------------------- */
.woocommerce-checkout .site-main,
body.woocommerce-checkout .site-main {
    max-width: var(--container-max-w, 1440px) !important;
    padding-top: 20px !important;
    margin-top: 0 !important;
}

.jan-checkout-grid {
    display: flex;
    gap: var(--section-gap, 30px);
    flex-wrap: wrap;
}

.jan-billing-col {
    flex: 1.2;
    min-width: 320px;
}

.jan-order-col {
    flex: 0.8;
    min-width: 320px;
}

.jan-order-box {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    width: 100% !important;
}

.jan-section-title {
    font-family: var(--font-mona) !important;
    font-size: var(--fs-h5, 18px) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    color: var(--heading-color, var(--text-title, #111)) !important;
}

/* --------------------------------------------------------------------------
   4. CẤU TRÚC CÁC TRƯỜNG FORM (CHIA ĐỀU 50% - 50%)
   -------------------------------------------------------------------------- */
.jan-custom-checkout .form-row {
    margin-bottom: 0 !important;
    padding: 0 !important;
}

.jan-custom-checkout .form-row label {
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
    display: block;
    font-family: var(--font-mona) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--text-dark, #333333) !important;
}

.woocommerce-billing-fields__field-wrapper,
.woocommerce-shipping-fields__field-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px !important;
}

.jan-custom-checkout input[type="text"],
.jan-custom-checkout input[type="tel"],
.jan-custom-checkout input[type="email"],
.jan-custom-checkout select,
.jan-custom-checkout textarea {
    width: 100% !important;
    font-family: var(--font-mona) !important;
    font-size: var(--fs-body-s, 14px) !important;
    padding: 9px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    box-sizing: border-box;
    margin-bottom: 0 !important;
    color: var(--text-dark, #1e293b) !important;
    outline: none !important;
}

/* Các trường chiếm 100% chiều rộng */
#billing_first_name_field,
#shipping_first_name_field,
#shipping_phone_field,
#order_comments_field {
    width: 100% !important;
}

/* Các trường tách đôi 50% - 50% */
#billing_phone_field,
#billing_email_field,
#billing_state_field,
#billing_address_1_field,
#shipping_state_field,
#shipping_address_1_field {
    width: calc(50% - 4px) !important;
}

/* Select2 Tỉnh/Thành */
.jan-custom-checkout .select2-container .select2-selection--single {
    height: 40px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    background-color: #ffffff !important;
    box-sizing: border-box !important;
}

.jan-custom-checkout .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 26px !important;
    padding-left: 0 !important;
    color: var(--text-dark, #1e293b) !important;
}

.jan-custom-checkout .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
    right: 8px !important;
}

/* --------------------------------------------------------------------------
   5. KHUNG VAT, ĐỊA CHỈ KHÁC & THIỆP/BANNER
   -------------------------------------------------------------------------- */
.jan-vat-container,
.jan-ship-different {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 10px 14px;
    margin: 8px 0;
}

.jan-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mona) !important;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark, #1e293b);
    margin: 0;
}

.jan-vat-box {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
}

.jan-vat-header {
    font-family: var(--font-mona) !important;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: #475569;
}

.jan-field-row.two-cols {
    display: flex;
    gap: 8px;
}

.jan-field-row .jan-col {
    flex: 1;
}

.jan-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.jan-order-notes textarea {
    min-height: 80px !important;
}

/* --------------------------------------------------------------------------
   6. MÃ QR FULL WIDTH & NÚT ĐẶT HÀNG
   -------------------------------------------------------------------------- */
.custom-qr-box {
    width: 100%;
    text-align: center;
    margin-top: 10px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.custom-qr-box .qr-heading {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13.5px;
    color: var(--text-dark, #333);
}

.custom-qr-box .qr-full-img {
    width: 100% !important;
    max-width: 360px !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block;
    border-radius: 4px;
}

.woocommerce-checkout #payment {
    background-color: transparent !important;
}

.woocommerce-checkout #payment ul.payment_methods {
    background-color: transparent !important;
    padding: 0 !important;
}

.woocommerce-checkout #payment div.payment_box {
    background: #ffffff !important;
    color: var(--text-dark, #333333) !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px;
}

.jan-custom-checkout #place_order {
    background-color: var(--color-accent, #456C35) !important;
    color: #ffffff !important;
    font-family: var(--font-mona) !important;
    font-weight: 700 !important;
    font-size: var(--fs-btn-m, 16px) !important;
    text-transform: uppercase !important;
    width: 100% !important;
    padding: 14px !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer;
    margin-top: 12px;
    transition: var(--transition-base, all 0.2s ease) !important;
}

.jan-custom-checkout #place_order:hover {
    background-color: var(--color-accent-dark, #374426) !important;
}

/* --------------------------------------------------------------------------
   7. MOBILE RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .jan-checkout-grid {
        gap: 20px !important;
    }

    .jan-billing-col,
    .jan-order-col,
    .jan-order-box {
        flex: 0 0 100% !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    #billing_phone_field,
    #billing_email_field,
    #billing_state_field,
    #billing_address_1_field,
    #shipping_state_field,
    #shipping_address_1_field {
        width: 100% !important;
    }
}

/* Ép buộc ô Tỉnh/Thành và Địa chỉ luôn hiển thị dạng Flexbox 50% */
#billing_state_field,
#shipping_state_field {
    display: block !important;
    width: calc(50% - 4px) !important;
}

#billing_address_1_field,
#shipping_address_1_field {
    width: calc(50% - 4px) !important;
}

/* Ẩn hoàn toàn trường quốc gia */
#billing_country_field,
#shipping_country_field {
    display: none !important;
}

/* --------------------------------------------------------------------------
   8. CĂN LỀ BẢNG ĐƠN HÀNG (ÉP TẤT CẢ Ô CỘT PHẢI CĂN BÊN PHẢI TUYỆT ĐỐI)
   -------------------------------------------------------------------------- */
.woocommerce-checkout table.shop_table {
    width: 100% !important;
    border-collapse: collapse !important;
}

/* Ép tất cả tiêu đề cột phải trong thead (chữ "Tạm tính" trên cùng) căn phải */
.woocommerce-checkout table.shop_table thead th.product-total,
.woocommerce-checkout table.shop_table thead th:last-child {
    text-align: right !important;
}

/* Cột trái (Cột Tên sản phẩm, Tạm tính, Shipment, Tổng) */
.woocommerce-checkout table.shop_table tbody th,
.woocommerce-checkout table.shop_table tfoot th,
.woocommerce-checkout table.shop_table td.product-name {
    text-align: left !important;
    vertical-align: top !important;
    padding: 12px 12px !important;
    font-family: var(--font-mona) !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    color: var(--text-dark, #333333) !important;
}

/* Cột phải (Cột Giá tiền, Nội dung Shipment) */
.woocommerce-checkout table.shop_table td,
.woocommerce-checkout table.shop_table td.product-total,
.woocommerce-checkout table.shop_table tfoot td {
    text-align: right !important;
    vertical-align: top !important;
    padding: 12px 12px !important;
    font-family: var(--font-mona) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #000000 !important;
}

/* Đảm bảo các thẻ con bên trong ô cột phải luôn đẩy sát lề bên phải */
.woocommerce-checkout table.shop_table td *,
.woocommerce-checkout table.shop_table td span,
.woocommerce-checkout table.shop_table td p,
.woocommerce-checkout table.shop_table th.product-total {
    text-align: right !important;
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Kiểu chữ riêng cho đoạn văn bản Shipment */
.woocommerce-checkout table.shop_table tr.cart-shipment-row td span {
    font-size: 14px !important;
    font-weight: 400 !important;
    color: #333333 !important;
    line-height: 1.4 !important;
}