{{-- Public Membership Category Details --}}
<x-site-layout title="{{ $membershipCategory->name }}">
    
    {{-- Hero Section --}}
    <section class="relative min-h-[50vh] bg-gradient-to-r from-green-600 to-green-700">
        <div class="absolute inset-0 bg-black/30"></div>
        <div class="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20">
            <div class="text-center">
                @if($membershipCategory->icon)
                    <i class="fas {{ $membershipCategory->icon }} text-white text-5xl mb-6 opacity-80"></i>
                @else
                    <i class="fas fa-users text-white text-5xl mb-6 opacity-80"></i>
                @endif
                <h1 class="text-4xl md:text-5xl font-bold text-white mb-6">
                    {{ $membershipCategory->name }}
                </h1>
                <p class="text-xl text-green-100 max-w-5xl mx-auto">
                    {{ $membershipCategory->description }}
                </p>
            </div>
        </div>
    </section>

    {{-- Breadcrumb --}}
    <div class="bg-gray-50 border-b border-gray-200">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-3">
            <nav class="flex items-center space-x-2 text-sm text-gray-600" aria-label="Breadcrumb">
                <a href="{{ url('/') }}" class="hover:text-green-600 transition flex items-center">
                    <i class="fas fa-home mr-1"></i>Home
                </a>
                <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
                <a href="{{ route('membership.categories.index') }}" class="hover:text-green-600 transition">
                    Membership Categories
                </a>
                <i class="fas fa-chevron-right text-gray-400 text-xs"></i>
                <span class="text-gray-900 font-medium">{{ $membershipCategory->name }}</span>
            </nav>
        </div>
    </div>

    {{-- Main Content --}}
    <section class="py-16 bg-gray-50">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            
            <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
                
                {{-- Main Content --}}
                <div class="lg:col-span-2 space-y-8">
                    
                    {{-- Description --}}
                    <div class="theme-card rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gray-50 px-6 py-4 border-b border-gray-200">
                            <h2 class="text-xl font-semibold text-gray-900 flex items-center">
                                <i class="fas fa-info-circle text-green-600 mr-3"></i>
                                About This Category
                            </h2>
                        </div>
                        <div class="p-6">
                            <p class="text-gray-700 leading-relaxed">
                                {{ $membershipCategory->description ?? 'Join our community and enjoy exclusive member benefits. This membership category offers various privileges designed to enhance your experience and provide value throughout your membership journey.' }}
                            </p>
                        </div>
                    </div>

                    {{-- Benefits --}}
                    @if($membershipCategory->benefits && count($membershipCategory->benefits) > 0)
                        <div class="theme-card rounded-xl shadow-lg overflow-hidden">
                            <div class="bg-gray-50 px-6 py-4 border-b border-gray-200">
                                <h2 class="text-xl font-semibold text-gray-900 flex items-center">
                                    <i class="fas fa-star text-green-600 mr-3"></i>
                                    Benefits Included
                                </h2>
                            </div>
                            <div class="p-6">
                                <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                                    @foreach($membershipCategory->benefits as $benefit)
                                        <div class="flex items-start p-4 bg-green-50 rounded-lg">
                                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3 flex-shrink-0"></i>
                                            <span class="text-gray-700">{{ $benefit }}</span>
                                        </div>
                                    @endforeach
                                </div>
                            </div>
                        </div>
                    @endif

                    {{-- Subscription Fees --}}
                    <div class="theme-card rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gray-50 px-6 py-4 border-b border-gray-200">
                            <h2 class="text-xl font-semibold text-gray-900 flex items-center">
                                <i class="fas fa-dollar-sign text-green-600 mr-3"></i>
                                Subscription Fees
                            </h2>
                        </div>
                        <div class="p-6">
                            @if($membershipCategory->subscriptionFees->count() > 0)
                                <div class="space-y-4">
                                    @foreach($membershipCategory->subscriptionFees as $fee)
                                        <div class="flex items-center justify-between p-4 border border-gray-200 rounded-lg hover:border-green-300 transition">
                                            <div>
                                                <h4 class="font-semibold text-gray-900">{{ $fee->name }}</h4>
                                                <p class="text-sm text-gray-500">{{ $fee->billing_cycle_display }}</p>
                                                @if($fee->description)
                                                    <p class="text-sm text-gray-600 mt-1">{{ $fee->description }}</p>
                                                @endif
                                            </div>
                                            <div class="text-right">
                                                <span class="text-2xl font-bold text-green-600">{{ $fee->formatted_amount }}</span>
                                            </div>
                                        </div>
                                    @endforeach
                                </div>
                            @else
                                <p class="text-gray-500 text-center py-4">No subscription fees configured for this category.</p>
                            @endif
                        </div>
                    </div>

                    {{-- Contribution Fees --}}
                    @if($membershipCategory->contributionFees->count() > 0)
                        <div class="theme-card rounded-xl shadow-lg overflow-hidden">
                            <div class="bg-gray-50 px-6 py-4 border-b border-gray-200">
                                <h2 class="text-xl font-semibold text-gray-900 flex items-center">
                                    <i class="fas fa-hand-holding-usd text-green-600 mr-3"></i>
                                    Contribution Requirements
                                </h2>
                            </div>
                            <div class="p-6">
                                <div class="overflow-x-auto">
                                    <table class="w-full">
                                        <thead>
                                            <tr class="border-b border-gray-200">
                                                <th class="text-left py-3 px-4 text-sm font-semibold text-gray-600">Name</th>
                                                <th class="text-left py-3 px-4 text-sm font-semibold text-gray-600">Amount</th>
                                                <th class="text-left py-3 px-4 text-sm font-semibold text-gray-600">Cycle</th>
                                                <th class="text-center py-3 px-4 text-sm font-semibold text-gray-600">Type</th>
                                            </tr>
                                        </thead>
                                        <tbody class="divide-y divide-gray-100">
                                            @foreach($membershipCategory->contributionFees as $fee)
                                                <tr>
                                                    <td class="py-3 px-4 text-gray-900">{{ $fee->name }}</td>
                                                    <td class="py-3 px-4 font-medium text-green-600">{{ number_format($fee->amount, 2) }} {{ $fee->currency }}</td>
                                                    <td class="py-3 px-4 text-gray-600">{{ ucfirst($fee->cycle) }}</td>
                                                    <td class="py-3 px-4 text-center">
                                                        <span class="px-2 py-1 rounded-full text-xs {{ $fee->is_optional ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 text-gray-700' }}">
                                                            {{ $fee->is_optional ? 'Optional' : 'Required' }}
                                                        </span>
                                                    </td>
                                                </tr>
                                            @endforeach
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    @endif
                </div>

                {{-- Sidebar --}}
                <div class="space-y-6">
                    
                    {{-- Apply CTA --}}
                    <div class="theme-card rounded-xl shadow-lg overflow-hidden sticky top-4">
                        <div class="bg-gradient-to-r from-green-600 to-green-700 p-6 text-white text-center">
                            <h3 class="text-xl font-bold mb-2">Ready to Join?</h3>
                            <p class="text-green-100 text-sm mb-4">Apply now for this membership category</p>
                            <a href="{{ route('membership.apply') }}?category={{ $membershipCategory->id }}" 
                               class="inline-block px-6 py-3 bg-white text-green-700 rounded-lg font-semibold hover:bg-green-50 transition">
                                <i class="fas fa-user-plus mr-2"></i>
                                Apply Now
                            </a>
                        </div>
                        <div class="p-4 bg-gray-50 text-center">
                            <p class="text-sm text-gray-600">
                                <i class="fas fa-clock mr-2"></i>
                                Applications processed in 3-5 business days
                            </p>
                        </div>
                    </div>

                    {{-- Quick Facts --}}
                    <div class="theme-card rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gray-50 px-6 py-4 border-b border-gray-200">
                            <h3 class="text-lg font-semibold text-gray-900">Quick Facts</h3>
                        </div>
                        <div class="p-6 space-y-4">
                            <div class="flex items-center justify-between">
                                <span class="text-gray-600">Status</span>
                                <span class="px-3 py-1 rounded-full text-sm font-semibold {{ $membershipCategory->is_active ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700' }}">
                                    {{ $membershipCategory->is_active ? 'Active' : 'Inactive' }}
                                </span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-gray-600">Subscription Plans</span>
                                <span class="font-bold text-gray-900">{{ $membershipCategory->subscriptionFees->count() }}</span>
                            </div>
                            <div class="flex items-center justify-between">
                                <span class="text-gray-600">Contribution Types</span>
                                <span class="font-bold text-gray-900">{{ $membershipCategory->contributionFees->count() }}</span>
                            </div>
                        </div>
                    </div>

                    {{-- Questions --}}
                    <div class="bg-blue-50 border border-blue-200 rounded-xl p-6">
                        <h3 class="font-semibold text-blue-900 mb-3">
                            <i class="fas fa-question-circle mr-2"></i>
                            Have Questions?
                        </h3>
                        <p class="text-blue-700 text-sm mb-4">
                            Contact our support team for assistance with your membership application.
                        </p>
                        <a href="#" class="text-blue-600 hover:underline text-sm font-medium">
                            Contact Support <i class="fas fa-arrow-right ml-1"></i>
                        </a>
                    </div>

                </div>
            </div>

        </div>
    </section>

</x-site-layout>