@php
    $emailPrimary = \App\Models\Setting::get('primary_color', '#b66420');
    $emailSecondary = \App\Models\Setting::get('secondary_color', '#d3901d');
@endphp
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Nouvelle commande</title>
    <style>
        body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: #334155; margin: 0; padding: 0; background: #f8fafc; }
        .container { max-width: 600px; margin: 0 auto; padding: 24px; }
        .card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-top: 4px solid {{ $emailPrimary }}; }
        h1 { color: #0f172a; font-size: 20px; margin: 0 0 16px 0; }
        .badge { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
        .badge-pending { background: #fff7ed; color: {{ $emailSecondary }}; border: 1px solid {{ $emailSecondary }}; }
        table { width: 100%; border-collapse: collapse; margin: 16px 0; }
        th, td { padding: 10px 0; border-bottom: 1px solid #e2e8f0; text-align: left; }
        th { color: #64748b; font-weight: 500; font-size: 13px; }
        .footer { margin-top: 24px; font-size: 13px; color: #94a3b8; }
    </style>
</head>
<body>
    <div class="container">
        <div class="card">
            <h1>Nouvelle commande reçue</h1>
            <p>Commande <strong>#{{ $order->number }}</strong> – <span class="badge badge-pending">{{ $order->status }}</span></p>

            <p><strong>Client :</strong> {{ $order->customer_name }}<br>
            <strong>Email :</strong> {{ $order->customer_email }}<br>
            @if($order->customer_phone)<strong>Tél :</strong> {{ $order->customer_phone }}<br>@endif</p>

            <p><strong>Adresse :</strong><br>
            {{ $order->customer_address }}<br>
            {{ $order->customer_postal_code }} {{ $order->customer_city }}, {{ $order->customer_country }}</p>

            <table>
                <thead>
                    <tr><th>Produit</th><th>Qté</th><th>Total</th></tr>
                </thead>
                <tbody>
                    @foreach($order->items as $item)
                    <tr>
                        <td>{{ $item['name'] ?? 'Produit' }}</td>
                        <td>{{ $item['qty'] ?? 1 }}</td>
                        <td>{{ number_format(($item['total'] ?? 0), 2, ',', ' ') }} €</td>
                    </tr>
                    @endforeach
                </tbody>
            </table>

            <p><strong>Total :</strong> {{ number_format($order->total, 2, ',', ' ') }} €</p>

            @if($order->notes)
            <p><strong>Notes :</strong> {{ $order->notes }}</p>
            @endif

            <p class="footer">Connectez-vous à l'administration pour gérer cette commande.</p>
        </div>
    </div>
</body>
</html>
