@extends('layouts.app')
@section('title', 'Your Cart')

@section('content')
<section class="py-16" style="background: linear-gradient(135deg, #0a0a0a 0%, #1a0000 100%);">
    <div class="max-w-3xl mx-auto px-4 text-center">
        <h1 class="font-display text-7xl text-white troll-glow mb-3">YOUR CART</h1>
        <p class="text-gray-400">Review your order before unleashing hell.</p>
    </div>
</section>

<section class="max-w-3xl mx-auto px-4 py-12">
    @if(empty($cart))
        <div class="card-dark rounded-2xl p-16 text-center">
            <div class="text-6xl mb-4">🛒</div>
            <h2 class="font-display text-4xl text-white mb-3">CART IS EMPTY</h2>
            <p class="text-gray-400 mb-8">You haven't selected your weapon of mass karma yet.</p>
            <a href="{{ route('services.index') }}" class="btn-troll text-white px-10 py-4 rounded-lg font-bold inline-block">
                VIEW PACKAGES
            </a>
        </div>
    @else
        <div class="space-y-3 mb-6">
            @foreach($cart as $slug => $item)
            <div class="card-dark rounded-xl p-5 flex items-center justify-between gap-4">
                <div class="flex-1">
                    <h3 class="text-white font-semibold">{{ $item['name'] }}</h3>
                    <p class="text-gray-400 text-sm">Qty: {{ $item['quantity'] }}</p>
                </div>
                <div class="text-right">
                    <div class="font-display text-2xl text-tm-red">${{ number_format($item['price'] * $item['quantity'], 2) }}</div>
                    <form action="{{ route('cart.remove', $slug) }}" method="POST" class="mt-1">
                        @csrf
                        @method('DELETE')
                        <button type="submit" class="text-gray-600 hover:text-red-500 text-xs transition-colors">Remove</button>
                    </form>
                </div>
            </div>
            @endforeach
        </div>

        <div class="card-dark rounded-xl p-6 mb-6">
            <div class="flex items-center justify-between text-xl">
                <span class="text-gray-300 font-semibold">Total</span>
                <span class="font-display text-4xl text-tm-red">${{ number_format($total, 2) }}</span>
            </div>
        </div>

        <div class="flex flex-col sm:flex-row gap-3">
            <a href="{{ route('checkout.index') }}" class="btn-troll text-white text-center py-4 px-8 rounded-lg font-bold text-lg flex-1">
                PROCEED TO CHECKOUT →
            </a>
            <form action="{{ route('cart.clear') }}" method="POST">
                @csrf
                <button type="submit" class="w-full sm:w-auto border border-tm-border text-gray-500 hover:border-red-700 hover:text-red-500 px-6 py-4 rounded-lg font-medium text-sm transition-all">
                    Clear Cart
                </button>
            </form>
        </div>

        <div class="mt-6 text-center">
            <a href="{{ route('services.index') }}" class="text-gray-500 hover:text-tm-red text-sm transition-colors">← Continue Shopping</a>
        </div>
    @endif
</section>
@endsection
