<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>HMRC VAT Return (Box 1-9)</title>
    <style>
        body {
            font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
            color: #1e293b;
            font-size: 13px;
            line-height: 1.5;
            margin: 0;
            padding: 0;
        }
        .header {
            margin-bottom: 25px;
            border-bottom: 2px solid #e2e8f0;
            padding-bottom: 15px;
        }
        .business-title {
            font-size: 22px;
            font-weight: bold;
            color: #4f46e5;
            margin: 0;
        }
        .report-title {
            font-size: 16px;
            font-weight: bold;
            margin-top: 5px;
            color: #0f172a;
        }
        .summary-box {
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 25px;
        }
        .summary-box.due {
            background-color: #fef2f2;
            border-color: #fca5a5;
        }
        .summary-box.reclaim {
            background-color: #ecfdf5;
            border-color: #6ee7b7;
        }
        .summary-title {
            font-size: 11px;
            text-transform: uppercase;
            font-weight: bold;
            color: #64748b;
            letter-spacing: 0.5px;
            margin-bottom: 5px;
        }
        .stat-value {
            font-size: 20px;
            font-weight: bold;
            font-family: Courier, monospace;
        }
        .stat-value.due-text {
            color: #dc2626;
        }
        .stat-value.reclaim-text {
            color: #059669;
        }
        .table-data {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 25px;
        }
        .table-data th {
            background-color: #f1f5f9;
            font-weight: bold;
            text-align: left;
            padding: 10px;
            border-bottom: 2px solid #cbd5e1;
            font-size: 11px;
            text-transform: uppercase;
            color: #475569;
        }
        .table-data td {
            padding: 10px;
            border-bottom: 1px solid #e2e8f0;
        }
        .box-num {
            font-weight: bold;
            color: #4f46e5;
            width: 80px;
        }
        .text-right {
            text-align: right;
        }
        .font-mono {
            font-family: Courier, monospace;
            font-weight: bold;
        }
    </style>
</head>
<body>

    <div class="header">
        <table style="width: 100%;">
            <tr>
                <td>
                    <h1 class="business-title">{{ $businessName }}</h1>
                    <div class="report-title">HMRC VAT Return (Box 1-9)</div>
                </td>
                <td style="text-align: right; vertical-align: top; font-size: 11px; color: #64748b;">
                    <div>Generated on: {{ date('d-m-Y H:i') }}</div>
                    <div>VAT Reg No: {{ $vatRegNo }}</div>
                    <div>Period: {{ $dateFrom->format('d-m-Y') }} &rarr; {{ $dateTo->format('d-m-Y') }}</div>
                </td>
            </tr>
        </table>
    </div>

    <!-- Summary Box (Box 5 Net VAT Due/Reclaim) -->
    @if($box5 >= 0)
        <div class="summary-box due">
            <div class="summary-title">Net VAT Payable to HMRC (Box 5)</div>
            <div class="stat-value due-text">{{ $currencySymbol }}{{ number_format($box5, 2) }}</div>
            <div style="font-size: 11px; color: #991b1b; margin-top: 4px;">This amount is due to be paid to HMRC for this period.</div>
        </div>
    @else
        <div class="summary-box reclaim">
            <div class="summary-title">Net VAT Reclaimable from HMRC (Box 5)</div>
            <div class="stat-value reclaim-text">{{ $currencySymbol }}{{ number_format(abs($box5), 2) }}</div>
            <div style="font-size: 11px; color: #065f46; margin-top: 4px;">This amount will be reclaimed from HMRC for this period.</div>
        </div>
    @endif

    <table class="table-data">
        <thead>
            <tr>
                <th style="width: 15%;">HMRC Box</th>
                <th style="width: 60%;">Description</th>
                <th style="width: 25%; text-align: right;">Amount</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="box-num">Box 1</td>
                <td>VAT due on sales and other outputs (minus customer refunds)</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box1, 2) }}</td>
            </tr>
            <tr>
                <td class="box-num">Box 2</td>
                <td>VAT due on acquisitions from other EU Member States</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box2, 2) }}</td>
            </tr>
            <tr style="background-color: #f8fafc; font-weight: bold;">
                <td class="box-num">Box 3</td>
                <td>Total VAT due (sum of Box 1 and Box 2)</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box3, 2) }}</td>
            </tr>
            <tr>
                <td class="box-num">Box 4</td>
                <td>VAT reclaimed on purchases and other inputs (Expenses)</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box4, 2) }}</td>
            </tr>
            <tr style="background-color: #f8fafc; font-weight: bold;">
                <td class="box-num">Box 5</td>
                <td>Net VAT to pay to HMRC or reclaim (difference between Box 3 and Box 4)</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box5, 2) }}</td>
            </tr>
            <tr>
                <td class="box-num">Box 6</td>
                <td>Total value of sales and all other outputs, excluding VAT (minus customer refunds)</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box6, 2) }}</td>
            </tr>
            <tr>
                <td class="box-num">Box 7</td>
                <td>Total value of purchases and all other inputs, excluding VAT</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box7, 2) }}</td>
            </tr>
            <tr>
                <td class="box-num">Box 8</td>
                <td>Total value of all supplies of goods to other EU Member States, excluding VAT</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box8, 2) }}</td>
            </tr>
            <tr>
                <td class="box-num">Box 9</td>
                <td>Total value of all acquisitions of goods from other EU Member States, excluding VAT</td>
                <td class="text-right font-mono">{{ $currencySymbol }}{{ number_format($box9, 2) }}</td>
            </tr>
        </tbody>
    </table>

    <div style="font-size: 10px; color: #94a3b8; text-align: center; margin-top: 30px; border-top: 1px dashed #cbd5e1; padding-top: 10px;">
        HMRC Box 1-9 calculations are prepared based on logged transactions and VAT configurations. Verify all figures before submission.
    </div>

</body>
</html>
