<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Quotation {{ $quotation->quote_no }}</title>
    <style>
        body { font-family: 'Helvetica Neue', Arial, sans-serif; color: #1f2937; margin: 30px; font-size: 13px; }
        .header { display: flex; justify-content: space-between; border-bottom: 2px solid #111827; padding-bottom: 14px; }
        h1 { margin: 0; font-size: 22px; }
        .meta { margin: 20px 0; }
        .total { font-size: 18px; font-weight: bold; text-align: right; margin-top: 20px; color: #059669; }
        table { width: 100%; border-collapse: collapse; margin-top: 18px; }
        th, td { border: 1px solid #d1d5db; padding: 8px 10px; text-align: left; }
        th { background: #f3f4f6; font-size: 11px; text-transform: uppercase; }
        .right { text-align: right; }
    </style>
</head>
<body>
    <div class="header">
        <div>
            <h1>QUOTATION</h1>
            <p style="margin: 2px 0;">Reference: <strong>{{ $quotation->quote_no }}</strong></p>
        </div>
        <div style="text-align: right;">
            <strong>{{ config('app.name') }}</strong><br>
            {{ config('app.url') }}
        </div>
    </div>

    <div class="meta">
        <strong>Customer:</strong> {{ $customer->name ?? 'Customer' }}<br>
        @if(!empty($customer->email)) Email: {{ $customer->email }}<br> @endif
        @if(!empty($customer->phone)) Phone: {{ $customer->phone }}<br> @endif
        @if(!empty($customer->company)) Company: {{ $customer->company }} @endif
    </div>

    <table>
        <thead>
            <tr>
                <th>Item / Description</th>
                <th>Qty</th>
                <th>Unit Price</th>
                <th class="right">Amount</th>
            </tr>
        </thead>
        <tbody>
            @foreach($items as $item)
                <tr>
                    <td>{{ $item->product->name ?? $item->description ?? 'Item' }}</td>
                    <td>{{ $item->quantity }}</td>
                    <td>{{ format_inr($item->unit_price) }}</td>
                    <td class="right">{{ format_inr($item->quantity * $item->unit_price) }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>

    <p class="total">Total: {{ format_inr($quotation->total ?? 0) }}</p>
</body>
</html>
