<x-app-layout title="Conversation">
    <div class="mx-auto flex max-w-2xl flex-col" style="height: calc(100vh - 8rem);">
        <div class="flex-1 space-y-4 overflow-y-auto py-4">
            @foreach ($messages as $message)
                <div class="rounded-xl bg-white p-4 shadow-sm ring-1 ring-slate-200">
                    <p class="text-sm font-medium text-slate-900">{{ $message->sender_name }}</p>
                    <p class="mt-1 text-sm text-slate-700 whitespace-pre-wrap">{{ $message->body }}</p>
                </div>
            @endforeach
            {{ $messages->links() }}
        </div>

        <form method="POST" action="{{ route('meet.messages.store', $conversation) }}" class="shrink-0 border-t border-slate-200 pt-4">
            @csrf
            <div class="flex gap-2">
                <input type="text" name="body" required placeholder="Write a message…" class="flex-1 rounded-lg border-slate-300 text-sm">
                <button type="submit" class="btn-primary">Send</button>
            </div>
        </form>
    </div>
</x-app-layout>
