<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Invoice <?php echo e($invoice->invoice_number); ?></title>
    <style>
        body { font-family: sans-serif; font-size: 14px; }
        .invoice-box { max-width: 800px; margin: auto; padding: 30px; border: 1px solid #eee; box-shadow: 0 0 10px rgba(0, 0, 0, .15); }
        .header { display: flex; justify-content: space-between; margin-bottom: 20px; }
        .company-details { text-align: right; }
        .invoice-details { margin-bottom: 20px; }
        table { width: 100%; line-height: inherit; text-align: left; border-collapse: collapse; }
        table td { padding: 5px; vertical-align: top; }
        table tr.heading td { background: #eee; border-bottom: 1px solid #ddd; font-weight: bold; }
        table tr.item td { border-bottom: 1px solid #eee; }
        table tr.total td { border-top: 2px solid #eee; font-weight: bold; }
        .text-right { text-align: right; }
    </style>
</head>
<body>
    <div class="invoice-box">
        <div class="header">
            <div>
               <h2>American Plastics</h2>
            </div>
            <div class="company-details">
                Invoice #: <?php echo e($invoice->invoice_number); ?><br>
                Date: <?php echo e($invoice->invoice_date->format('Y-m-d')); ?><br>
            </div>
        </div>

        <div class="invoice-details">
            <strong>Bill To:</strong><br>
            <?php echo e($invoice->customer_name); ?><br>
            <?php echo e($invoice->billing_address); ?><br>
            <?php echo e($invoice->customer_email); ?>

        </div>

        <table cellpadding="0" cellspacing="0">
            <tr class="heading">
                <td>Description</td>
                <td class="text-right">Amount</td>
            </tr>

            <tr class="item">
                <td>Order Subtotal (Ref: <?php echo e($invoice->order_id); ?>)</td>
                <td class="text-right">LKR <?php echo e(number_format($invoice->subtotal, 2)); ?></td>
            </tr>
            
            <?php if($invoice->shipping_cost > 0): ?>
            <tr class="item">
                <td>Shipping</td>
                <td class="text-right">LKR <?php echo e(number_format($invoice->shipping_cost, 2)); ?></td>
            </tr>
            <?php endif; ?>

            <?php if($invoice->tax_amount > 0): ?>
            <tr class="item">
                <td>Tax (<?php echo e($invoice->tax_percentage); ?>%)</td>
                <td class="text-right">LKR <?php echo e(number_format($invoice->tax_amount, 2)); ?></td>
            </tr>
            <?php endif; ?>

            <?php if($invoice->discount_amount > 0): ?>
            <tr class="item" style="color: green;">
                <td>Discount</td>
                <td class="text-right">- LKR <?php echo e(number_format($invoice->discount_amount, 2)); ?></td>
            </tr>
            <?php endif; ?>

            <?php if(isset($invoice->points_applied) && $invoice->points_applied > 0): ?>
            <tr class="item" style="color: blue;">
                <td>Points Applied</td>
                <td class="text-right">- LKR <?php echo e(number_format($invoice->points_applied, 2)); ?></td>
            </tr>
            <?php endif; ?>

            <tr class="total">
                <td></td>
                <td class="text-right">Total: LKR <?php echo e(number_format($invoice->total_amount, 2)); ?></td>
            </tr>
        </table>
        
        <br>
        <p style="text-align: center;font-size: 12px; color: #777;">Thank you for your business!</p>
    </div>
</body>
</html>
<?php /**PATH /home/amerbofz/public_html/resources/views/admin/invoices/pdf.blade.php ENDPATH**/ ?>