<?php
require __DIR__ . '/includes/functions.php';

$currentPage = 'cart';
$pageTitle = 'Cart | Furnify';

require __DIR__ . '/includes/header.php';
?>

<section class="page-section cart-page">
    <div class="container">
        <div class="section-heading split-heading">
            <div>
                <p class="eyebrow">Your picks</p>
                <h1>Shopping Cart</h1>
            </div>
            <a href="index.php#catalog" class="text-link">Continue shopping <i class="bi bi-arrow-right" aria-hidden="true"></i></a>
        </div>
        <div class="cart-layout">
            <div>
                <div class="cart-items" id="cart-items"></div>
                <div class="cart-help-card">
                    <i class="bi bi-info-circle" aria-hidden="true"></i>
                    <div>
                        <strong>Note:</strong>
                        Inquiry totals are estimates. Final shipping and custom fabric costs can be confirmed after submission.
                    </div>
                </div>
            </div>
            <aside class="cart-summary premium-panel">
                <h2>Order Summary</h2>
                <dl>
                    <div>
                        <dt>Items</dt>
                        <dd id="summary-items">0</dd>
                    </div>
                    <div>
                        <dt>Estimated subtotal</dt>
                        <dd id="summary-total">&#8369;0.00</dd>
                    </div>
                    <div>
                        <dt>Shipping</dt>
                        <dd>To quote</dd>
                    </div>
                </dl>
                <a href="checkout.php" class="btn btn-primary w-100" id="checkout-link">
                    <i class="bi bi-send" aria-hidden="true"></i>
                    Proceed to Inquiry
                </a>
                <button type="button" class="btn btn-outline-primary w-100 mt-2" id="clear-cart">
                    <i class="bi bi-trash" aria-hidden="true"></i>
                    Clear Cart
                </button>
                <div class="secure-note"><i class="bi bi-lock" aria-hidden="true"></i> Server recalculates prices before saving.</div>
            </aside>
        </div>
    </div>
</section>

<template id="empty-cart-template">
    <div class="empty-state">
        <i class="bi bi-bag" aria-hidden="true"></i>
        <h2>Your cart is empty.</h2>
        <p>Pick a sofa from the store to begin.</p>
        <a href="index.php#catalog" class="btn btn-primary">Browse Sofas</a>
    </div>
</template>

<?php require __DIR__ . '/includes/footer.php'; ?>
