@extends('layouts.dashboard')
@section('title', 'Writer Packages')
@section('page-title', 'Become a Writer')
@section('content')
<p class="lead mb-4">Buy a package to start publishing your own blogs. Pay once, content lives forever.</p>
<div class="row g-4">
    @forelse($packages as $package)
        <div class="col-md-4">
            <div class="package-card {{ $package->is_featured ? 'featured' : '' }}">
                <div class="package-name">{{ $package->name }}</div>
                <div class="package-blogs">{{ $package->blogs_count }} {{ $package->blogs_count === 1 ? 'blog' : 'blogs' }}</div>
                <div class="package-price">${{ number_format($package->price, 0) }}<small>/once</small></div>
                @if(!empty($package->features))
                <ul class="package-features">@foreach($package->features as $f)<li>{{ $f }}</li>@endforeach</ul>
                @endif
                <form action="{{ route('user.packages.buy', $package) }}" method="POST">
                    @csrf
                    <button class="btn btn-{{ $package->is_featured ? 'accent' : 'primary' }} w-100">Buy & Pay with PayPal</button>
                </form>
            </div>
        </div>
    @empty
        <div class="col-12"><p class="text-muted text-center py-5">No packages available right now.</p></div>
    @endforelse
</div>
<div class="alert alert-info mt-4 small">
    <strong>Note:</strong> After purchase, an admin will upgrade your account to <em>Reseller</em> status with the corresponding blog quota. You'll then have access to the writing dashboard.
</div>
@endsection
