@forelse($categories as $category)
    <div class="bg-white rounded-xl shadow-md border border-[#d1d5db] p-4">
        <div class="flex items-start gap-4 mb-3">
            <div class="flex-shrink-0">
                @if($category->image_base64)
                    <img src="{{ $category->image_data_url }}" alt="{{ $category->name }}" class="w-20 h-20 object-cover rounded-lg border border-[#d1d5db]">
                @else
                    <div class="w-20 h-20 bg-gradient-to-br from-[#d1d5db] to-[#e6d5b8] rounded-lg border border-[#d1d5db]"></div>
                @endif
            </div>
            <div class="flex-1 min-w-0">
                <h3 class="font-semibold text-black text-lg mb-1">{{ $category->name }}</h3>
                <p class="text-sm text-black mb-2 line-clamp-2">{{ $category->description }}</p>
                <p class="text-sm text-black font-semibold">{{ $category->products_count }} products</p>
            </div>
        </div>
        <div class="flex flex-wrap gap-2 pt-3 border-t border-[#d1d5db]">
            <a href="{{ route('admin.categories.edit', $category->id) }}" class="text-black hover:text-black transition-colors font-medium text-sm">Edit</a>
            <form method="POST" action="{{ route('admin.categories.destroy', $category->id) }}" onsubmit="return confirm('Are you sure?')" class="inline">
                @csrf
                @method('DELETE')
                <button type="submit" class="text-black hover:text-[#b86a4f] transition-colors font-medium text-sm">Delete</button>
            </form>
        </div>
    </div>
@empty
    <div class="bg-white rounded-xl shadow-md border border-[#d1d5db] p-8 text-center">
        <p class="text-black">No categories found.</p>
    </div>
@endforelse

















