<?php
/**
 * Checkout Form
 *
 * Template aligned with WooCommerce 9.4.0
 * @see https://woocommerce.com/document/template-structure/
 * @package Pawfect
 * @version 10.9.1
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

do_action( 'woocommerce_before_checkout_form', $checkout );

// If checkout registration is disabled and not logged in, the user cannot checkout.
if ( ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in() ) {
    echo esc_html( apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be logged in to checkout.', 'pawfect' ) ) );
    return;
}

?>

<div class="pawfect-container pawfect-mx-auto pawfect-px-6 pawfect-pb-12 md:pawfect-pb-24">
    <form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">

        <?php if ( $checkout->get_checkout_fields() ) : ?>

            <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>

            <div class="pawfect-grid pawfect-grid-cols-1 lg:pawfect-grid-cols-2 pawfect-gap-8 lg:pawfect-gap-16" id="customer_details">
                
                <!-- Billing Details -->
                <div class="col-1">
                    <?php do_action( 'woocommerce_checkout_billing' ); ?>
                </div>

                <!-- Order Summary -->
                <div class="col-2">
                    <?php do_action( 'woocommerce_checkout_shipping' ); ?>
                    
                    <?php do_action( 'woocommerce_checkout_before_order_review_heading' ); ?>
                    
                    <div id="order_review" class="woocommerce-checkout-review-order">
                        <?php do_action( 'woocommerce_checkout_before_order_review' ); ?>

                        <div class="pawfect-bg-white pawfect-p-8 pawfect-rounded-lg pawfect-shadow-md pawfect-sticky pawfect-top-8">
                            <h3 id="order_review_heading" class="pawfect-font-serif pawfect-text-3xl pawfect-border-b pawfect-border-border-color pawfect-pb-4 pawfect-mb-6">
                                <?php esc_html_e( 'Your order', 'pawfect' ); ?>
                            </h3>
                            
                            <?php do_action( 'woocommerce_checkout_order_review' ); ?>
                        </div>

                        <?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
                    </div>
                </div>
            </div>

            <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>

        <?php endif; ?>

    </form>
</div>

<?php do_action( 'woocommerce_after_checkout_form', $checkout ); ?>

