<x-app-layout title="AI Summary">
    <div class="mx-auto max-w-3xl">
        <h1 class="text-2xl font-semibold text-slate-900">{{ $summary->session->room->title }}</h1>
        <p class="mt-1 text-sm text-slate-500">AI meeting summary</p>

        <div class="prose prose-slate mt-6 max-w-none rounded-2xl border border-slate-200 bg-white p-6">
            <h2 class="text-lg font-semibold">Summary</h2>
            <p class="whitespace-pre-wrap text-sm text-slate-700">{{ $summary->summary }}</p>

            @if ($summary->decisions)
                <h2 class="mt-6 text-lg font-semibold">Decisions</h2>
                <ul class="list-disc pl-5 text-sm">
                    @foreach ($summary->decisions as $decision)
                        <li>{{ is_string($decision) ? $decision : json_encode($decision) }}</li>
                    @endforeach
                </ul>
            @endif

            @if ($summary->actionItems->isNotEmpty())
                <h2 class="mt-6 text-lg font-semibold">Action items</h2>
                <ul class="space-y-2 text-sm">
                    @foreach ($summary->actionItems as $item)
                        <li class="rounded-lg bg-slate-50 p-3">
                            {{ $item->description }}
                            @if ($item->assignee_name)
                                <span class="text-slate-500">— {{ $item->assignee_name }}</span>
                            @endif
                        </li>
                    @endforeach
                </ul>
            @endif
        </div>

        @if ($summary->transcript)
            <details class="mt-6 rounded-2xl border border-slate-200 bg-white p-4">
                <summary class="cursor-pointer text-sm font-medium text-slate-700">Full transcript</summary>
                <pre class="mt-3 whitespace-pre-wrap text-xs text-slate-600">{{ $summary->transcript->content }}</pre>
            </details>
        @endif
    </div>
</x-app-layout>
