<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Invoice {{ $invoice->invoice_number ?? '' }}</title>
    @include('invoices.templates.partials._pdf-head-compact')
</head>
<body>
<div class="pdf-wrap" style="max-width:100%;">
<table style="width:100%; border-collapse:collapse; font-family:DejaVu Sans, sans-serif; font-size:14px;">
    @if(!empty($showWatermark))
    <tr>
        <td style="padding:10px 12px; text-align:center; background-color:#fef2f2; color:#dc2626; font-weight:bold; font-size:14px;">UNLICENSED COPY</td>
    </tr>
    @endif

    <tr>
        <td style="padding:0 0 14px 0;" class="pdf-section">
            <table style="width:100%; border-collapse:collapse; background-color:#4f46e6; color:#ffffff;">
                <tr>
                    <td style="width:58%; vertical-align:top; padding:14px 16px;">
                        <table style="width:100%; border-collapse:collapse;">
                            <tr>
                                <td style="width:1%; vertical-align:top; padding-right:12px;">
                                    @if($logoDataUri)
                                        <img src="{{ $logoDataUri }}" alt="" style="max-width:180px; max-height:58px;">
                                    @endif
                                </td>
                                <td style="vertical-align:top;">
                                    <div style="font-size:18px; font-weight:bold;">{{ $companySettings->company_name ?? config('app.name') }}</div>
                                    <div style="font-size:12px; opacity:0.9;">Professional business solutions</div>
                                    <div style="font-size:12px; line-height:1.45; opacity:0.88; padding-top:6px;">
                                        @if($companySettings->company_address){{ $companySettings->company_address }}@endif
                                        @if($companySettings->company_phone)@if($companySettings->company_address) — @endif{{ $companySettings->company_phone }}@endif
                                        @if($companySettings->company_email)@if($companySettings->company_address || $companySettings->company_phone) — @endif{{ $companySettings->company_email }}@endif
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td style="width:42%; vertical-align:top; padding:14px 16px; text-align:right;">
                        <div style="font-size:20px; font-weight:600; letter-spacing:2px; padding-bottom:8px;">INVOICE</div>
                        <div style="font-size:13px; line-height:1.45; opacity:0.95;">
                            #{{ $invoice->invoice_number ?? '—' }}<br>
                            Issue {{ $issueDate->format('M d, Y') }} · Due {{ $dueDate->format('M d, Y') }}
                        </div>
                    </td>
                </tr>
            </table>
        </td>
    </tr>

    @include('invoices.templates.partials._pdf-bill-to', ['billLabelColor' => '#1e3a5f'])

    @include('invoices.templates.partials._pdf-items-totals-footer', [
        'thBg' => '#4f46e6',
        'thText' => '#ffffff',
        'thBorderBottom' => '#4338ca',
        'accent' => '#1e3a5f',
        'paymentBg' => '#f5f3ff',
        'paymentBorder' => '#ddd6fe',
        'paymentTitle' => '#5b21b6',
        'paymentText' => '#4c1d95',
    ])
</table>
</div>
</body>
</html>
