@extends('themes.saijana.layouts.app')

@section('title', 'Forum - '.($site_name ?? 'Mon Site'))

@section('content')
<div class="max-w-4xl mx-auto px-6 py-16">
    <h1 class="text-3xl font-bold text-slate-900 mb-8">Forum</h1>

    <div class="space-y-4">
        @forelse($categories ?? [] as $category)
            <a href="{{ route('forum.category', $category->slug) }}" class="block p-6 bg-white rounded-2xl border border-slate-200 hover:border-slate-300 hover:shadow-lg transition">
                <div class="flex items-start justify-between gap-4">
                    <div>
                        <h2 class="text-xl font-semibold text-slate-900">{{ $category->name }}</h2>
                        @if($category->description)
                            <div class="text-slate-600 mt-1 prose prose-slate prose-sm max-w-none">{!! \App\Support\SafeHtml::richText($category->description) !!}</div>
                        @endif
                    </div>
                    <div class="text-right shrink-0">
                        <span class="text-2xl font-bold text-slate-900">{{ $category->threads_count }}</span>
                        <span class="text-slate-500 text-sm block">sujets</span>
                    </div>
                </div>
            </a>
        @empty
            <p class="text-slate-500 py-12 text-center">Aucune catégorie pour le moment.</p>
        @endforelse
    </div>
</div>
@endsection
