<x-layout :title="$category->name . ' - Muse'">
    <!-- Category Header -->
    <section class="relative overflow-hidden">
        <div class="absolute inset-0 bg-gradient-to-br from-rose-50 via-fuchsia-50/50 to-indigo-50"></div>
        
        <div class="relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 lg:py-20">
            <div class="text-center max-w-2xl mx-auto">
                <span class="inline-block px-4 py-1.5 text-sm font-medium bg-white/80 backdrop-blur-sm text-fuchsia-600 rounded-full mb-4 shadow-sm">
                    分类
                </span>
                <h1 class="font-serif text-3xl sm:text-4xl lg:text-5xl font-bold text-stone-900 mb-4">
                    {{ $category->name }}
                </h1>
                @if($category->description)
                    <p class="text-lg text-stone-600">{{ $category->description }}</p>
                @endif
                <p class="mt-4 text-stone-500">共 {{ $posts->total() }} 篇文章</p>
            </div>
        </div>
    </section>
    
    <!-- Categories Pills -->
    @if($categories->isNotEmpty())
        <section class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
            <div class="flex flex-wrap items-center justify-center gap-3">
                <a href="{{ route('home') }}" 
                   class="px-5 py-2.5 text-sm font-medium rounded-full bg-white text-stone-700 hover:bg-stone-100 shadow-sm transition-all duration-300">
                    全部
                </a>
                @foreach($categories as $cat)
                    <a href="{{ route('category', $cat) }}" 
                       class="px-5 py-2.5 text-sm font-medium rounded-full transition-all duration-300
                              {{ $cat->id === $category->id ? 'bg-stone-900 text-white shadow-lg shadow-stone-900/25' : 'bg-white text-stone-700 hover:bg-stone-100 shadow-sm' }}">
                        {{ $cat->name }}
                    </a>
                @endforeach
            </div>
        </section>
    @endif
    
    <!-- Posts Grid -->
    <section class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-16">
        @if($posts->isNotEmpty())
            <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 lg:gap-8">
                @foreach($posts as $post)
                    <x-post-card :post="$post" />
                @endforeach
            </div>
            
            <!-- Pagination -->
            <div class="mt-12">
                {{ $posts->links() }}
            </div>
        @else
            <div class="text-center py-20">
                <div class="w-20 h-20 mx-auto mb-6 bg-stone-100 rounded-full flex items-center justify-center">
                    <svg class="w-10 h-10 text-stone-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" />
                    </svg>
                </div>
                <h3 class="text-xl font-medium text-stone-900 mb-2">该分类暂无文章</h3>
                <p class="text-stone-500">敬请期待更多精彩内容</p>
            </div>
        @endif
    </section>
</x-layout>

