<table style="width: 100%; border-collapse: collapse; font-size: 13px; margin: 15px 0;">
    <thead>
        <tr style="color: #6b7280; font-weight: bold; border-bottom: 2px solid #e5e7eb;">
            <th style="text-align: left; padding: 10px 5px;">Product</th>
            <th style="text-align: center; padding: 10px 5px; width: 60px;">Qty</th>
            <th style="text-align: right; padding: 10px 5px; width: 90px;">Total</th>
        </tr>
    </thead>
    <tbody>
        @foreach($order->items as $item)
            @php
                $itemProduct = $item->product;
                $itemImg = $itemProduct ? ($itemProduct->getFirstMediaUrl('images', 'webp') ?: ($itemProduct->getFirstMediaUrl('images') ?: null)) : null;
            @endphp
            <tr style="border-bottom: 1px solid #f3f4f6;">
                <td style="padding: 10px 5px;">
                    <table style="border-collapse: collapse; border: none; margin: 0; padding: 0;">
                        <tr>
                            @if($itemImg)
                                <td style="padding-right: 10px; vertical-align: middle;">
                                    <img src="{{ $itemImg }}" width="40" height="40" style="border-radius: 6px; object-fit: cover; border: 1px solid #e5e7eb; display: block;" alt="{{ $item->product_name }}">
                                </td>
                            @endif
                            <td style="vertical-align: middle;">
                                <div style="font-weight: bold; color: #111827;">{{ $item->product_name }}</div>
                                @if($item->variant_name)
                                    <div style="font-size: 11px; color: #6b7280; margin-top: 2px;">Variant: {{ $item->variant_name }}</div>
                                @endif
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="text-align: center; padding: 10px 5px; color: #4b5563;">{{ $item->quantity }}</td>
                <td style="text-align: right; padding: 10px 5px; font-weight: bold; color: #111827;">৳{{ number_format($item->price * $item->quantity, 2) }}</td>
            </tr>
        @endforeach
    </tbody>
</table>
