@extends('layouts.app')

@section('title', 'Subscription Plans & Pricing')

@section('content')
<div class="space-y-6">
    <div class="flex items-center justify-between">
        <div>
            <h1 class="text-xl font-bold text-slate-900 dark:text-white">Subscription Plans & Pricing</h1>
            <p class="text-xs text-slate-500 dark:text-slate-400">Configure commercial SaaS subscription plans, branch limits, user limits, and pricing.</p>
        </div>
        <a href="{{ route('platform.plans.create') }}" class="px-4 py-2 bg-sky-600 hover:bg-sky-700 text-white font-bold text-xs rounded-xl shadow-sm">
            + New Plan
        </a>
    </div>

    <!-- Plans Catalog Cards Grid (Requirement 15, 16) -->
    <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
        @foreach($plans as $plan)
            <div class="bg-white dark:bg-slate-800 rounded-3xl p-6 border border-slate-200 dark:border-slate-700/60 shadow-sm flex flex-col justify-between space-y-6">
                <div class="space-y-4">
                    <div class="flex items-center justify-between">
                        <h3 class="text-lg font-extrabold text-slate-900 dark:text-white">{{ $plan->name }}</h3>
                        <span class="px-2.5 py-0.5 rounded-full bg-sky-100 dark:bg-sky-950 text-sky-700 dark:text-sky-300 font-bold text-[10px] uppercase">
                            {{ $plan->slug }}
                        </span>
                    </div>
                    <p class="text-xs text-slate-500 dark:text-slate-400">{{ $plan->description }}</p>

                    <div class="py-2 border-y border-slate-100 dark:border-slate-700">
                        <span class="text-3xl font-extrabold text-slate-900 dark:text-white">AED {{ number_format($plan->price_monthly, 0) }}</span>
                        <span class="text-xs text-slate-400">/ month</span>
                    </div>

                    <div class="space-y-2 text-xs text-slate-600 dark:text-slate-300 font-medium">
                        <div class="flex items-center space-x-2 rtl:space-x-reverse">
                            <span class="text-sky-500">✓</span>
                            <span>Max Branches: <strong>{{ $plan->max_branches }}</strong></span>
                        </div>
                        <div class="flex items-center space-x-2 rtl:space-x-reverse">
                            <span class="text-sky-500">✓</span>
                            <span>Max ERP Users: <strong>{{ $plan->max_users }}</strong></span>
                        </div>
                        <div class="flex items-center space-x-2 rtl:space-x-reverse">
                            <span class="text-sky-500">✓</span>
                            <span>Storage GB: <strong>{{ $plan->max_storage_gb }} GB</strong></span>
                        </div>
                        <div class="flex items-center space-x-2 rtl:space-x-reverse">
                            <span class="text-sky-500">✓</span>
                            <span>AI Credits: <strong>{{ number_format($plan->monthly_ai_credits) }}</strong></span>
                        </div>
                        <div class="flex items-center space-x-2 rtl:space-x-reverse">
                            <span class="text-sky-500">✓</span>
                            <span>WhatsApp Pack: <strong>{{ number_format($plan->monthly_whatsapp_messages) }}</strong></span>
                        </div>
                    </div>
                </div>

                <div class="pt-4 border-t border-slate-100 dark:border-slate-700 flex justify-between items-center text-xs">
                    <span class="font-mono {{ $plan->is_active ? 'text-emerald-600' : 'text-slate-400' }}">{{ $plan->is_active ? 'Active Plan' : 'Inactive Plan' }}</span>
                    <a href="{{ route('platform.plans.edit', $plan) }}" class="px-4 py-1.5 bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-200 font-bold rounded-xl">Edit Plan</a>
                </div>
            </div>
        @endforeach
    </div>
</div>
@endsection
