<?php $__env->startSection('title', 'Checkout'); ?>

<?php $__env->startPush('styles'); ?>
    <style>
        .checkout-layout {
            display: grid;
            grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
            gap: 24px;
            margin-top: 30px;
        }

        .form-card,
        .summary-card {
            background: var(--card);
            border: 1px solid rgba(123, 91, 47, 0.16);
            border-radius: 24px;
            box-shadow: var(--shadow);
        }

        .form-card {
            padding: 24px;
        }

        .field-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 18px;
        }

        .field {
            display: grid;
            gap: 8px;
        }

        .field.full {
            grid-column: 1 / -1;
        }

        label {
            color: var(--gold-deep);
            font-size: 0.95rem;
        }

        input,
        textarea {
            width: 100%;
            padding: 14px 16px;
            border-radius: 18px;
            border: 1px solid rgba(123, 91, 47, 0.22);
            background: rgba(255, 255, 255, 0.72);
            font: inherit;
            color: var(--text);
        }

        textarea {
            min-height: 120px;
            resize: vertical;
        }

        .error-text {
            color: #8f3640;
            font-size: 0.9rem;
        }

        .summary-card {
            padding: 24px;
            height: fit-content;
            position: sticky;
            top: 20px;
        }

        .summary-card h3,
        .form-card h3 {
            margin: 0 0 18px;
            font-size: 1.45rem;
        }

        .summary-item,
        .summary-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
        }

        .summary-item {
            padding: 14px 0;
            border-bottom: 1px solid rgba(123, 91, 47, 0.12);
        }

        .summary-row {
            padding: 12px 0;
            color: var(--muted);
        }

        .summary-total {
            color: var(--gold-deep);
            font-size: 1.5rem;
            font-weight: 700;
        }

        .place-order {
            width: 100%;
            margin-top: 14px;
            padding: 14px 20px;
            color: #fffaf0;
            background: linear-gradient(135deg, var(--gold), var(--gold-deep));
            box-shadow: 0 16px 30px rgba(125, 89, 45, 0.24);
        }

        @media (max-width: 960px) {
            .checkout-layout {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 640px) {
            .field-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
    <h2 class="section-title">Checkout</h2>

    <section class="checkout-layout">
        <form id="checkout-form" class="form-card" action="<?php echo e(route('checkout.store')); ?>" method="POST">
            <?php echo csrf_field(); ?>
            <h3>Collector Details</h3>

            <div class="field-grid">
                <div class="field">
                    <label for="customer_name">Full name</label>
                    <input id="customer_name" name="customer_name" type="text" value="<?php echo e(old('customer_name')); ?>" required>
                    <?php $__errorArgs = ['customer_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <div class="error-text"><?php echo e($message); ?></div> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="field">
                    <label for="email">Email</label>
                    <input id="email" name="email" type="email" value="<?php echo e(old('email')); ?>" required>
                    <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <div class="error-text"><?php echo e($message); ?></div> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="field">
                    <label for="phone">Phone</label>
                    <input id="phone" name="phone" type="text" value="<?php echo e(old('phone')); ?>" required>
                    <?php $__errorArgs = ['phone'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <div class="error-text"><?php echo e($message); ?></div> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="field">
                    <label for="city">City</label>
                    <input id="city" name="city" type="text" value="<?php echo e(old('city')); ?>" required>
                    <?php $__errorArgs = ['city'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <div class="error-text"><?php echo e($message); ?></div> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="field full">
                    <label for="shipping_address">Shipping address</label>
                    <input id="shipping_address" name="shipping_address" type="text" value="<?php echo e(old('shipping_address')); ?>" required>
                    <?php $__errorArgs = ['shipping_address'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <div class="error-text"><?php echo e($message); ?></div> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="field">
                    <label for="postal_code">Postal code</label>
                    <input id="postal_code" name="postal_code" type="text" value="<?php echo e(old('postal_code')); ?>" required>
                    <?php $__errorArgs = ['postal_code'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <div class="error-text"><?php echo e($message); ?></div> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>

                <div class="field full">
                    <label for="notes">Order notes</label>
                    <textarea id="notes" name="notes" placeholder="Packaging requests, gifting notes, delivery timing..."><?php echo e(old('notes')); ?></textarea>
                    <?php $__errorArgs = ['notes'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <div class="error-text"><?php echo e($message); ?></div> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>
        </form>

        <aside class="summary-card">
            <h3>Order Summary</h3>

            <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="summary-item">
                    <div>
                        <strong><?php echo e($item['product']->name); ?></strong>
                        <div class="meta-text">Qty <?php echo e($item['quantity']); ?></div>
                    </div>
                    <span>$<?php echo e(number_format($item['subtotal'], 2)); ?></span>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            <div class="summary-row">
                <span>Subtotal</span>
                <span>$<?php echo e(number_format($subtotal, 2)); ?></span>
            </div>
            <div class="summary-row">
                <span>Shipping</span>
                <span>$<?php echo e(number_format($shipping, 2)); ?></span>
            </div>
            <div class="summary-row">
                <span>Estimated tax</span>
                <span>$<?php echo e(number_format($tax, 2)); ?></span>
            </div>
            <div class="summary-row">
                <span>Total</span>
                <span class="summary-total">$<?php echo e(number_format($total, 2)); ?></span>
            </div>

            <button class="place-order" type="submit" form="checkout-form">Place order</button>
        </aside>
    </section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.store', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/gladwintan/Documents/New project/storefront/resources/views/storefront/checkout.blade.php ENDPATH**/ ?>