@extends('admin.layout')

@section('title', 'Message')

@section('content')
    <p><a href="{{ route('admin.contact-messages.index') }}">← Retour aux messages</a></p>
    <h1>Message de {{ $message->name }}</h1>
    <p class="muted">Recu le {{ $message->created_at->format('d/m/Y à H:i') }} @if($message->ip_address) · IP {{ $message->ip_address }} @endif</p>

    <div class="card" style="margin-bottom:20px;">
        <p style="margin-bottom:8px;"><strong>Email :</strong> <a href="mailto:{{ $message->email }}">{{ $message->email }}</a></p>
        <p style="margin-bottom:8px;"><strong>Besoin :</strong> <span class="pill">{{ $message->besoin }}</span></p>
        <p style="margin-bottom:0;white-space:pre-wrap;color:#334155;">{{ $message->message }}</p>
    </div>

    <form method="post" action="{{ route('admin.contact-messages.destroy', $message) }}" onsubmit="return confirm('Supprimer ce message ?');">
        @csrf
        @method('DELETE')
        <button type="submit" class="btn secondary" style="background:#fef2f2;color:#b91c1c;">Supprimer</button>
    </form>
@endsection
