@extends('layouts.nova.content-layout')

@php
    $hero_title = ucfirst(str_replace('_', ' ', $category)) . ' Stories';
    $hero_description = 'Stories in the ' . str_replace('_', ' ', $category) . ' category.';
@endphp

@section('page-content')
<div class="space-y-8">
    <div class="rounded-xl border border-gray-700 bg-gray-800/60 p-4">
        <div class="flex flex-wrap gap-2">
            @foreach($categories as $item)
                <a href="{{ route('stories.category', $item['slug']) }}" class="rounded-lg border px-3 py-2 text-sm {{ $item['slug'] === $category ? 'border-sky-400/50 bg-sky-500/10 text-sky-200' : 'border-gray-700 bg-gray-800 text-gray-300 hover:text-white' }}">
                    {{ $item['name'] }}
                </a>
            @endforeach
        </div>
    </div>

    @if($stories->isNotEmpty())
        <div class="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3">
            @foreach($stories as $story)
                <x-story-card :story="$story" />
            @endforeach
        </div>

        <div class="mt-8">{{ $stories->links() }}</div>
    @else
        <div class="rounded-xl border border-gray-700 bg-gray-800/50 px-8 py-16 text-center text-sm text-gray-300">
            No stories found in this category.
        </div>
    @endif
</div>
@endsection
