@php
    use App\Support\EnquiryRouter;
    $ref = strtoupper($enquiry->type) . '-' . str_pad((string) $enquiry->id, 5, '0', STR_PAD_LEFT);
@endphp
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width"></head>
<body style="margin:0;background:#faf7f2;font-family:Arial,Helvetica,sans-serif;color:#1f2a33;">
    <div style="max-width:600px;margin:0 auto;padding:24px;">
        <div style="background:#1f2a33;color:#fff;padding:24px;border-radius:12px 12px 0 0;">
            <p style="margin:0;font-size:12px;letter-spacing:2px;text-transform:uppercase;color:#d9763f;">New {{ $enquiry->type === 'rfq' ? 'quote request' : 'enquiry' }} · {{ $ref }}</p>
            <h1 style="margin:8px 0 0;font-size:22px;">{{ $enquiry->subject ?? 'Website enquiry' }}</h1>
        </div>
        <div style="background:#fff;padding:24px;border:1px solid #e9e6e1;border-top:none;border-radius:0 0 12px 12px;">
            <table style="width:100%;border-collapse:collapse;font-size:14px;">
                <tr><td style="padding:8px 0;color:#909090;width:140px;">Name</td><td style="padding:8px 0;">{{ $enquiry->name }}</td></tr>
                <tr><td style="padding:8px 0;color:#909090;">Email</td><td style="padding:8px 0;"><a href="mailto:{{ $enquiry->email }}" style="color:#b35327;">{{ $enquiry->email }}</a></td></tr>
                @if ($enquiry->phone)<tr><td style="padding:8px 0;color:#909090;">Phone</td><td style="padding:8px 0;">{{ $enquiry->phone }}</td></tr>@endif
                @if ($enquiry->company)<tr><td style="padding:8px 0;color:#909090;">Company</td><td style="padding:8px 0;">{{ $enquiry->company }}</td></tr>@endif
                @if ($enquiry->country)<tr><td style="padding:8px 0;color:#909090;">Country</td><td style="padding:8px 0;">{{ $enquiry->country }}</td></tr>@endif
                <tr><td style="padding:8px 0;color:#909090;">Service</td><td style="padding:8px 0;">{{ EnquiryRouter::serviceLabel($enquiry->service) }}</td></tr>
                @if (!empty($enquiry->meta['budget']))<tr><td style="padding:8px 0;color:#909090;">Budget</td><td style="padding:8px 0;">{{ $enquiry->meta['budget'] }}</td></tr>@endif
                @if (!empty($enquiry->meta['timeline']))<tr><td style="padding:8px 0;color:#909090;">Timeline</td><td style="padding:8px 0;">{{ $enquiry->meta['timeline'] }}</td></tr>@endif
                <tr><td style="padding:8px 0;color:#909090;">Routed to</td><td style="padding:8px 0;">{{ $enquiry->routed_to }}</td></tr>
            </table>
            <div style="margin-top:16px;padding:16px;background:#faf7f2;border-radius:8px;">
                <p style="margin:0 0 6px;color:#909090;font-size:12px;text-transform:uppercase;letter-spacing:1px;">Message</p>
                <p style="margin:0;white-space:pre-wrap;line-height:1.6;">{{ $enquiry->message }}</p>
            </div>
            <p style="margin-top:20px;font-size:12px;color:#909090;">Reply directly to this email to respond to {{ $enquiry->name }}. Received {{ $enquiry->created_at->format('d M Y H:i') }}.</p>
        </div>
        <p style="text-align:center;font-size:11px;color:#909090;margin-top:16px;">Brokam International Ltd · {{ config('brokam.company.domain') }}</p>
    </div>
</body>
</html>
