@props([
    'title' => '',
    'description' => '',
    'createRoute' => null,
    'createPermission' => null,
    'createButtonText' => 'إضافة جديد',
    'tableHeaders' => [],
    'emptyMessage' => 'لا توجد بيانات حالياً',
    'emptySubMessage' => 'ابدأ بإضافة عنصر جديد'
])

<div class="min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 py-8 px-4 md:px-8">
    <div class="max-w-7xl mx-auto">
        <div class="mb-8">
            <div class="flex items-center justify-between mb-6">
                <div>
                    <h1 class="text-3xl font-bold text-gray-900 mb-2">{{ $title }}</h1>
                    @if($description)
                    <p class="text-gray-600">{{ $description }}</p>
                    @endif
                </div>
                @if($createRoute && (!$createPermission || auth()->user()->can($createPermission)))
                <a href="{{ $createRoute }}" class="inline-flex items-center px-6 py-3 bg-gradient-to-r from-blue-600 to-blue-700 text-white font-semibold rounded-lg hover:from-blue-700 hover:to-blue-800 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:scale-105">
                    <i class="fas fa-plus ml-2"></i>
                    <span>{{ $createButtonText }}</span>
                </a>
                @endif
            </div>

            @if(session('success'))
            <div class="bg-green-50 border-l-4 border-green-500 p-4 mb-6 rounded-r-lg">
                <div class="flex">
                    <div class="flex-shrink-0">
                        <i class="fas fa-check-circle text-green-500 text-xl"></i>
                    </div>
                    <div class="mr-3">
                        <p class="text-green-700 font-medium">{{ session('success') }}</p>
                    </div>
                </div>
            </div>
            @endif

            @if(session('error'))
            <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6 rounded-r-lg">
                <div class="flex">
                    <div class="flex-shrink-0">
                        <i class="fas fa-exclamation-circle text-red-500 text-xl"></i>
                    </div>
                    <div class="mr-3">
                        <p class="text-red-700 font-medium">{{ session('error') }}</p>
                    </div>
                </div>
            </div>
            @endif
        </div>

        <div class="bg-white rounded-xl shadow-lg overflow-hidden border border-gray-200">
            <div class="overflow-x-auto">
                <table class="w-full">
                    <thead class="bg-gradient-to-r from-gray-800 to-gray-900 text-white">
                        <tr>
                            @foreach($tableHeaders as $header)
                            <th class="px-6 py-4 {{ $header['align'] ?? 'text-right' }} font-semibold text-sm">
                                {{ $header['label'] }}
                            </th>
                            @endforeach
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-200">
                        {{ $slot }}
                    </tbody>
                </table>
            </div>

            @if(isset($pagination) && $pagination->hasPages())
            <div class="px-6 py-4 bg-gray-50 border-t border-gray-200">
                <div class="flex justify-center">
                    {{ $pagination->links() }}
                </div>
            </div>
            @endif
        </div>
    </div>
</div>
