<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tax Invoices</title>
    <?php
        if (!isset($invoices)) {
            $invoices = collect([$invoice]);
        }
        if (!isset($invoicesLayoutData)) {
            $invoicesLayoutData = [$invoice->id => $layoutData];
        }

        $firstInv = $invoices->first();
        $firstLayout = $invoicesLayoutData[$firstInv->id] ?? [];
        $layout = $firstLayout['layout'] ?? 'navy';
    ?>
    <style>
        :root {
            <?php if($layout === 'green'): ?>
                --ink: #16352b;
                --accent: #2f8f5b;
            <?php elseif($layout === 'minimal'): ?>
                --ink: #2b2d3a;
                --accent: #6b6f7d;
            <?php elseif($layout === 'classic'): ?>
                --ink: #17181c;
                --accent: #b3261e;
            <?php else: ?>
                --ink:#0e2a47;
                --accent: #1e7a46;
            <?php endif; ?>
            --line:#dfe3e8;
            --text: #23262f;
            --muted: #6b7280;
            --faint: #98a1ad;
            --bg-soft: #f7f8fa;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        @page {
            size: A4;
            margin: 0;
        }

        html, body {
            font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
            color: var(--text);
            font-size: 12.5px;
            line-height: 1.4;
            background: #fff;
        }

        .invoice-wrapper {
            position: relative;
            max-width: 800px;
            margin: 0 auto;
            padding: 30px 34px 22px 34px;
        }

        .invoice-wrapper.has-footer-image {
            min-height: 1080px;
            padding-bottom: 160px;
        }

        .watermark {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) rotate(-45deg);
            font-size: 72px;
            font-weight: 800;
            color: rgba(0, 0, 0, 0.12);
            z-index: 0;
            pointer-events: none;
            white-space: nowrap;
            text-transform: uppercase;
            letter-spacing: 4px;
        }

        .watermark-img {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 260px;
            height: 260px;
            opacity: 0.12;
            z-index: 0;
            pointer-events: none;
            object-fit: contain;
        }

        /* ================= HEADER ================= */
        .header {
            position: relative;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 24px 34px;
            border-bottom: 2px solid var(--accent);
            overflow: hidden;
            background: #fff;
            margin: -30px -34px 16px -34px;
        }

        .header-slant {
            position: absolute;
            top: 0;
            right: 0;
            width: 0;
            height: 0;
            border-top: 130px solid var(--ink);
            border-left: 220px solid transparent;
            z-index: 1;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 12px;
            z-index: 2;
        }

        .brand img.logo {
            height: 52px;
            object-fit: contain;
            flex-shrink: 0;
        }

        .brand-icon {
            width: 44px;
            height: 44px;
            border: 2px solid var(--ink);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .brand-icon span {
            font-weight: 800;
            color: var(--ink);
            font-size: 15px;
        }

        .brand-text .name {
            font-size: 17px;
            font-weight: 700;
            color: var(--ink);
            line-height: 1.2;
        }

        .brand-text .tag {
            font-size: 10.5px;
            letter-spacing: 1px;
            color: var(--accent);
            font-weight: 700;
            margin-top: 2px;
        }

        .title-block {
            text-align: center;
            flex: 1;
            z-index: 2;
            padding-right: 48px;
        }

        .title-block h1 {
            font-size: 24px;
            font-weight: 800;
            color: var(--ink);
            letter-spacing: 1px;
            margin-bottom: 1px;
        }

        .title-block .subtitle {
            font-size: 11px;
            font-weight: 700;
            color: var(--ink);
            opacity: 0.85;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .title-block .verified {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            margin-top: 4px;
            font-size: 11px;
            font-weight: 700;
            color: var(--ink);
        }

        .header-invoice-type {
            position: absolute;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            z-index: 3;
            color: #fff;
            text-align: right;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .header-invoice-type svg {
            width: 26px;
            height: 26px;
            color: var(--accent);
            opacity: 0.95;
        }

        .header-invoice-type .details {
            display: flex;
            flex-direction: column;
        }

        .header-invoice-type .details .label {
            font-size: 9px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            opacity: 0.75;
        }

        .header-invoice-type .details .value {
            font-weight: 700;
            font-size: 11.5px;
        }

        /* ================= META BAR ================= */
        .meta-bar {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 6px 24px;
            padding: 10px 0;
            border-bottom: 1px solid var(--line);
            font-size: 11.5px;
            color: var(--muted);
            margin-bottom: 18px;
        }

        .meta-bar b {
            color: var(--text);
            font-weight: 600;
        }

        /* ================= PARTY / DETAILS GRID ================= */
        .top-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            align-items: start;
            margin-bottom: 20px;
        }

        .box {
            border: 1px solid var(--line);
            border-radius: 5px;
            overflow: hidden;
        }

        .box-header {
            background: var(--bg-soft);
            color: var(--muted);
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.8px;
            padding: 6px 12px;
            border-bottom: 1px solid var(--line);
        }

        .box-body {
            padding: 10px 12px;
        }

        .party-name {
            font-size: 13px;
            font-weight: 700;
            color: var(--ink);
            margin-bottom: 4px;
        }

        .party-body p {
            font-size: 11px;
            color: var(--muted);
            line-height: 1.45;
        }

        .party-body .ntn-strn {
            margin-top: 6px;
            font-size: 11px;
            color: var(--text);
            font-weight: 600;
        }

        .party-body .contact-line {
            font-size: 11px;
            color: var(--muted);
            margin-top: 2px;
        }

        .details-table {
            width: 100%;
            border-collapse: collapse;
        }

        .details-table tr td {
            padding: 4px 0;
            font-size: 11px;
            border-bottom: 1px solid #f0f2f5;
        }

        .details-table tr:last-child td {
            border-bottom: none;
        }

        .details-table td:first-child {
            color: var(--muted);
            width: 50%;
        }

        .details-table td:last-child {
            color: var(--text);
            font-weight: 600;
            text-align: right;
        }

        .qr-box {
            border: 1px solid var(--line);
            border-radius: 5px;
            padding: 4px;
            background: #fff;
            display: inline-block;
        }

        .qr-caption {
            font-size: 9px;
            color: var(--faint);
            text-align: center;
            letter-spacing: 0.3px;
        }

        /* ================= ITEMS TABLE ================= */
        .items-wrap {
            border-radius: 5px;
            overflow: hidden;
            border: 1px solid var(--line);
        }

        table.items {
            width: 100%;
            border-collapse: collapse;
        }

        table.items thead th {
            background: var(--ink);
            color: #fff;
            font-size: 10.5px;
            font-weight: 600;
            text-align: left;
            padding: 8px 12px;
            white-space: nowrap;
        }

        table.items thead th.num {
            text-align: right;
        }

        table.items tbody td {
            padding: 7px 12px;
            font-size: 11.5px;
            border-bottom: 1px solid var(--line);
            color: var(--text);
        }

        table.items tbody tr:nth-child(even) {
            background: var(--bg-soft);
        }

        table.items tbody tr:last-child td {
            border-bottom: none;
        }

        table.items td.num {
            text-align: right;
        }

        /* ================= SUMMARY ================= */
        .summary-grid {
            display: grid;
            grid-template-columns: 1.1fr 0.9fr;
            gap: 16px;
            margin-top: 16px;
            align-items: stretch;
            margin-bottom: 24px;
        }

        .tax-summary-table {
            width: 100%;
            border-collapse: collapse;
        }

        .tax-summary-table th {
            text-align: left;
            font-size: 10px;
            color: var(--muted);
            padding: 5px 0;
            border-bottom: 1px solid var(--line);
            text-transform: uppercase;
            letter-spacing: 0.4px;
        }

        .tax-summary-table th.num, .tax-summary-table td.num {
            text-align: right;
        }

        .tax-summary-table td {
            padding: 5px 0;
            font-size: 11px;
            border-bottom: 1px solid #f0f2f5;
        }

        .tax-summary-table tr.total-row td {
            font-weight: 700;
            color: var(--ink);
            border-bottom: none;
            padding-top: 7px;
        }

        .words-box {
            margin-top: 10px;
            font-size: 10.5px;
            padding-top: 8px;
            border-top: 1px solid var(--line);
        }

        .words-box b {
            display: block;
            color: var(--text);
            margin-bottom: 1px;
            font-size: 10px;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            color: var(--muted);
        }

        .words-box i {
            color: var(--text);
            font-style: normal;
        }

        .totals-box {
            border: 1px solid var(--line);
            border-radius: 5px;
            overflow: hidden;
            height: fit-content;
        }

        .totals-row {
            display: flex;
            justify-content: space-between;
            padding: 7px 14px;
            font-size: 11.5px;
            border-bottom: 1px solid var(--line);
            color: var(--muted);
        }

        .totals-row.net {
            background: var(--ink);
            color: #fff;
            font-weight: 700;
            font-size: 13px;
            border-bottom: none;
        }

        .bottom-grid {
            display: grid;
            grid-template-columns: 1.2fr 1fr;
            gap: 24px;
            margin-top: 18px;
            padding-top: 14px;
            border-top: 1px solid var(--line);
        }

        .notes-col h4 {
            font-size: 10px;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.6px;
            margin-bottom: 8px;
        }

        .notes-col ul {
            list-style: none;
        }

        .notes-col li {
            font-size: 10.5px;
            color: var(--muted);
            margin-bottom: 4px;
            padding-left: 12px;
            position: relative;
        }

        .notes-col li::before {
            content: "–";
            position: absolute;
            left: 0;
            color: var(--faint);
        }

        .sign-area {
            margin-top: 22px;
            text-align: left;
            font-size: 10.5px;
            color: var(--muted);
        }

        .sign-line {
            border-top: 1px solid var(--text);
            width: 60%;
            margin-bottom: 5px;
        }

        .sign-area b {
            color: var(--text);
        }

        .thankyou-col {
            text-align: right;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
        }

        .thankyou-col .ty-title {
            color: var(--ink);
            font-size: 12px;
            font-weight: 700;
            margin-bottom: 6px;
        }

        .thankyou-col .ty-line {
            font-size: 10.5px;
            color: var(--muted);
        }

        .footer-image-container {
            position: absolute;
            bottom: 30px;
            left: 34px;
            right: 34px;
            overflow: hidden;
        }

        .page-break {
            page-break-after: always;
            break-after: page;
        }

        @media (max-width:700px) {
            .top-grid { grid-template-columns: 1fr; }
            .bottom-grid { grid-template-columns: 1fr; }
            .thankyou-col { text-align: left; }
        }

        @media print {
            .invoice-wrapper {
                padding: 18px 28px;
            }
        }
    </style>
</head>

<body>
    <?php $__currentLoopData = $invoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invoice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php
            if (!isset($invoicesLayoutData)) {
                $layoutData = \App\Helpers\InvoicePdfHelper::getLayoutData($invoice);
            } else {
                $layoutData = $invoicesLayoutData[$invoice->id] ?? [];
            }
            $template = $layoutData['template'] ?? 'classic';
        ?>

        <?php echo $__env->make('invoices.pdfs.' . $template, ['invoice' => $invoice, 'layoutData' => $layoutData], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

        <?php if(!$loop->last): ?>
            <div class="page-break" style="page-break-after: always;"></div>
        <?php endif; ?>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</body>

</html><?php /**PATH /www/wwwroot/an.shiningerp.com/resources/views/invoices/invoice_pdf.blade.php ENDPATH**/ ?>