<?php $__env->startSection('title', 'Shopping Bag — Divine Drops'); ?>

<?php
    $cartItems = $cart ?? session('cart', []);
    $appliedCoupon = $coupon ?? session('coupon');
    $shipping = $subtotal >= 499 || $subtotal == 0 ? 0 : 70;
    $total = max(0, $subtotal - $discount + $shipping);
?>

<?php $__env->startSection('content'); ?>

    <?php if (isset($component)) { $__componentOriginale19f62b34dfe0bfdf95075badcb45bc2 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.breadcrumb','data' => ['items' => [['label' => 'Shopping Bag']]]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('breadcrumb'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['items' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([['label' => 'Shopping Bag']])]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2)): ?>
<?php $attributes = $__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2; ?>
<?php unset($__attributesOriginale19f62b34dfe0bfdf95075badcb45bc2); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale19f62b34dfe0bfdf95075badcb45bc2)): ?>
<?php $component = $__componentOriginale19f62b34dfe0bfdf95075badcb45bc2; ?>
<?php unset($__componentOriginale19f62b34dfe0bfdf95075badcb45bc2); ?>
<?php endif; ?>

    <section class="py-10 lg:py-16">
        <div class="container-shop">
            <h1 class="font-serif text-3xl font-medium sm:text-4xl">Shopping Bag</h1>

            <?php if(empty($cartItems)): ?>
                <div class="mt-12 text-center py-16 bg-cream-50 rounded-2xl border border-cream-200">
                    <?php if (isset($component)) { $__componentOriginalce262628e3a8d44dc38fd1f3965181bc = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icon','data' => ['name' => 'bag','class' => 'mx-auto h-16 w-16 text-ink-400']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'bag','class' => 'mx-auto h-16 w-16 text-ink-400']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $attributes = $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $component = $__componentOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?>
                    <h2 class="mt-4 font-serif text-2xl font-medium">Your shopping bag is empty</h2>
                    <p class="mt-2 text-sm text-ink-500">Explore our farm-fresh botanical formulations and treat your skin.</p>
                    <a href="<?php echo e(route('shop')); ?>" class="btn-primary mt-6">Explore Catalog</a>
                </div>
            <?php else: ?>
                <div class="mt-8 grid gap-10 lg:grid-cols-3 lg:gap-12">
                    
                    <div class="lg:col-span-2">
                        <div class="divide-y divide-cream-200 border-y border-cream-200">
                            <?php $__currentLoopData = $cartItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="flex items-center gap-4 py-6 sm:gap-6">
                                    <img src="<?php echo e(asset($item['image'])); ?>" alt="<?php echo e($item['name']); ?>" width="120" height="120" class="h-24 w-24 rounded-lg bg-cream-50 border border-cream-200 object-contain p-2 shrink-0">
                                    <div class="flex-1 min-w-0">
                                        <h2 class="font-serif text-base font-medium text-ink-900 truncate">
                                            <a href="<?php echo e(route('product', $item['slug'])); ?>" class="hover:underline"><?php echo e($item['name']); ?></a>
                                        </h2>
                                        <p class="mt-1 text-xs text-ink-500">Size: <?php echo e($item['size']); ?></p>
                                        <p class="mt-2 font-medium text-ink-900">₹<?php echo e(number_format($item['price'])); ?></p>
                                    </div>
                                    <div class="flex items-center gap-3">
                                        <form action="<?php echo e(route('cart.update')); ?>" method="POST" class="flex items-center border border-sand-300 rounded-lg">
                                            <?php echo csrf_field(); ?>
                                            <input type="hidden" name="key" value="<?php echo e($key); ?>">
                                            <button type="submit" name="quantity" value="<?php echo e(max(1, $item['quantity'] - 1)); ?>" class="flex h-9 w-8 items-center justify-center text-ink-500 hover:text-ink-900" aria-label="Decrease quantity"><?php if (isset($component)) { $__componentOriginalce262628e3a8d44dc38fd1f3965181bc = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icon','data' => ['name' => 'minus','class' => 'h-3.5 w-3.5']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'minus','class' => 'h-3.5 w-3.5']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $attributes = $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $component = $__componentOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?></button>
                                            <span class="w-8 text-center text-sm font-medium"><?php echo e($item['quantity']); ?></span>
                                            <button type="submit" name="quantity" value="<?php echo e($item['quantity'] + 1); ?>" class="flex h-9 w-8 items-center justify-center text-ink-500 hover:text-ink-900" aria-label="Increase quantity"><?php if (isset($component)) { $__componentOriginalce262628e3a8d44dc38fd1f3965181bc = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icon','data' => ['name' => 'plus','class' => 'h-3.5 w-3.5']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'plus','class' => 'h-3.5 w-3.5']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $attributes = $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $component = $__componentOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?></button>
                                        </form>
                                        <form action="<?php echo e(route('cart.remove')); ?>" method="POST">
                                            <?php echo csrf_field(); ?>
                                            <input type="hidden" name="key" value="<?php echo e($key); ?>">
                                            <button type="submit" class="p-2 text-ink-400 hover:text-terra-600" aria-label="Remove item"><?php if (isset($component)) { $__componentOriginalce262628e3a8d44dc38fd1f3965181bc = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icon','data' => ['name' => 'trash','class' => 'h-4 w-4']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'trash','class' => 'h-4 w-4']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $attributes = $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $component = $__componentOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?></button>
                                        </form>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>

                        
                        <div class="mt-8 bg-cream-50 border border-cream-200 rounded-xl p-6">
                            <h3 class="font-serif text-lg font-medium text-ink-900 mb-2">Promotional Offers & Coupon Code</h3>
                            
                            <?php if($appliedCoupon): ?>
                                <div class="flex items-center justify-between bg-moss-50 px-4 py-3 border border-moss-300 rounded-lg">
                                    <div class="flex items-center gap-2">
                                        <span class="flex h-6 w-6 items-center justify-center rounded-full bg-moss-600 text-white text-xs font-bold">✓</span>
                                        <div>
                                            <span class="text-xs font-bold text-moss-800 tracking-wider uppercase">Coupon '<?php echo e($appliedCoupon['code']); ?>' Applied!</span>
                                            <div class="text-[11px] text-moss-700">Saved ₹<?php echo e(number_format($discount, 2)); ?> on your order</div>
                                        </div>
                                    </div>
                                    <form action="<?php echo e(route('cart.coupon.remove')); ?>" method="POST">
                                        <?php echo csrf_field(); ?>
                                        <button type="submit" class="text-xs text-terra-600 font-bold underline hover:text-terra-800 cursor-pointer">Remove</button>
                                    </form>
                                </div>
                            <?php else: ?>
                                <form class="flex gap-2 mb-6" action="<?php echo e(route('cart.coupon')); ?>" method="POST">
                                    <?php echo csrf_field(); ?>
                                    <label for="coupon" class="sr-only">Coupon code</label>
                                    <input id="coupon" type="text" name="code" placeholder="Enter Promo Code (e.g. WELCOME15)" class="field-input flex-1 !py-2.5 uppercase font-bold tracking-wider" required>
                                    <button type="submit" class="btn-primary !px-6 !py-2.5 cursor-pointer">Apply Code</button>
                                </form>
                            <?php endif; ?>

                            
                            <?php if(isset($availableCoupons) && $availableCoupons->count() > 0): ?>
                                <div class="mt-6 border-t border-cream-200 pt-5">
                                    <span class="text-xs font-semibold tracking-wider text-ink-700 uppercase block mb-3">Available Store Offers:</span>
                                    <div class="space-y-3">
                                        <?php $__currentLoopData = $availableCoupons; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $avail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php
                                                $isValidSubtotal = $subtotal >= $avail->min_order_amount;
                                                $shortage = $avail->min_order_amount - $subtotal;
                                            ?>
                                            <div class="flex items-center justify-between bg-white border border-sand-300 rounded-lg p-3 shadow-xs">
                                                <div>
                                                    <div class="flex items-center gap-2">
                                                        <span class="font-mono text-xs font-bold bg-moss-50 text-moss-800 px-2 py-0.5 border border-moss-300 rounded uppercase tracking-wider"><?php echo e($avail->code); ?></span>
                                                        <span class="text-xs font-bold text-ink-900">
                                                            <?php if($avail->type === 'percent'): ?>
                                                                <?php echo e((int)$avail->value); ?>% OFF <?php echo e($avail->max_discount_amount ? '(up to ₹'.number_format($avail->max_discount_amount).')' : ''); ?>

                                                            <?php else: ?>
                                                                Flat ₹<?php echo e(number_format($avail->value)); ?> OFF
                                                            <?php endif; ?>
                                                        </span>
                                                    </div>
                                                    <div class="text-[11px] text-ink-500 mt-1">
                                                        <?php if($avail->min_order_amount > 0): ?>
                                                            Valid on orders above ₹<?php echo e(number_format($avail->min_order_amount)); ?>

                                                            <?php if(!$isValidSubtotal): ?>
                                                                <span class="text-terra-600 font-semibold">&middot; Add ₹<?php echo e(number_format($shortage)); ?> more to unlock</span>
                                                            <?php endif; ?>
                                                        <?php else: ?>
                                                            No minimum purchase required
                                                        <?php endif; ?>
                                                    </div>
                                                </div>

                                                <?php if($isValidSubtotal): ?>
                                                    <form action="<?php echo e(route('cart.coupon')); ?>" method="POST">
                                                        <?php echo csrf_field(); ?>
                                                        <input type="hidden" name="code" value="<?php echo e($avail->code); ?>">
                                                        <button type="submit" class="text-xs font-bold text-moss-700 bg-moss-50 border border-moss-300 hover:bg-moss-700 hover:text-white px-3 py-1.5 rounded transition-all cursor-pointer">
                                                            1-Click Apply
                                                        </button>
                                                    </form>
                                                <?php else: ?>
                                                    <button type="button" disabled class="text-xs font-medium text-ink-400 bg-gray-100 px-3 py-1.5 rounded opacity-60 cursor-not-allowed">
                                                        Locked
                                                    </button>
                                                <?php endif; ?>
                                            </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                </div>
                            <?php endif; ?>
                        </div>
                    </div>

                    
                    <aside class="h-fit border border-cream-200 bg-cream-50 p-8 lg:sticky lg:top-28 rounded-xl" aria-label="Order summary">
                        <h2 class="font-serif text-xl font-medium">Order Summary</h2>
                        <dl class="mt-6 space-y-3.5 text-sm">
                            <div class="flex justify-between"><dt class="text-ink-500">Subtotal</dt><dd class="font-medium">₹<?php echo e(number_format($subtotal, 2)); ?></dd></div>
                            <?php if($discount > 0): ?>
                                <div class="flex justify-between text-moss-700"><dt>Discount (<?php echo e($appliedCoupon['code']); ?>)</dt><dd class="font-semibold">- ₹<?php echo e(number_format($discount, 2)); ?></dd></div>
                            <?php endif; ?>
                            <div class="flex justify-between"><dt class="text-ink-500">Shipping</dt><dd class="font-medium"><?php echo e($shipping === 0 ? 'FREE' : '₹' . $shipping); ?></dd></div>
                            <div class="flex justify-between border-t border-sand-200 pt-4 text-base"><dt class="font-semibold">Grand Total</dt><dd class="font-serif text-xl font-semibold text-ink-900">₹<?php echo e(number_format($total, 2)); ?></dd></div>
                        </dl>
                        <?php if($shipping === 0): ?>
                            <p class="mt-4 flex items-center gap-2 bg-moss-100 px-3 py-2.5 text-xs font-medium text-moss-800 rounded">
                                <?php if (isset($component)) { $__componentOriginalce262628e3a8d44dc38fd1f3965181bc = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icon','data' => ['name' => 'truck','class' => 'h-4 w-4 shrink-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'truck','class' => 'h-4 w-4 shrink-0']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $attributes = $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $component = $__componentOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?> You've unlocked free shipping across India!
                            </p>
                        <?php else: ?>
                            <p class="mt-4 text-xs text-ink-500">Add ₹<?php echo e(499 - $subtotal); ?> more to unlock FREE shipping!</p>
                        <?php endif; ?>
                        <a href="<?php echo e(route('checkout')); ?>" class="btn-primary mt-6 w-full justify-center">Proceed to Checkout</a>
                        <p class="mt-4 flex items-center justify-center gap-1.5 text-xs text-ink-400">
                            <?php if (isset($component)) { $__componentOriginalce262628e3a8d44dc38fd1f3965181bc = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.icon','data' => ['name' => 'lock','class' => 'h-3.5 w-3.5']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'lock','class' => 'h-3.5 w-3.5']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $attributes = $__attributesOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__attributesOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc)): ?>
<?php $component = $__componentOriginalce262628e3a8d44dc38fd1f3965181bc; ?>
<?php unset($__componentOriginalce262628e3a8d44dc38fd1f3965181bc); ?>
<?php endif; ?> Secure checkout · UPI, Cards & Cash on Delivery
                        </p>
                    </aside>
                </div>
            <?php endif; ?>
        </div>
    </section>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/koushikkona/Documents/Projects/divne/resources/views/pages/cart.blade.php ENDPATH**/ ?>