<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Invoice: Wanfi Technology - INV-2025-05-001</title>
    <style>
        /* 整体样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Helvetica Neue', Arial, sans-serif;
        }
        
        body {
            margin: 15px;
            line-height: 1.6;
        }

        .container {
            max-width: 800px;
            margin: 0 auto;
        }
        
        .invoice-container {
            background: white;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 40px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.05);
        }
        
        /* 头部样式 */
        .header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #e9ecef;
        }
        
        .company-info {
            flex: 1;
        }
        
        .company-logo {
            text-align: right;
        }
        
        .company-logo img {
            max-width: 150px;
            height: auto;
        }
        
        h1 {
            font-size: 25px;
            color: #2c3e50;
            margin-bottom: 5px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        
        /* 发票信息 */
        .invoice-info {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
        }
        
        .bill-to {
            flex: 1;
        }
        
        .invoice-details {
            text-align: right;
        }
        
        .invoice-details div {
            margin-bottom: 8px;
        }
        
        .invoice-number {
            font-size: 20px;
            font-weight: bold;
            color: #2c3e50;
        }
        
        /* 表格样式 */
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 10px 0 20px;
        }
        
        th {
            background-color: #f0f7ff;

            text-align: left;
            padding: 12px 15px;
            font-weight: 600;
        }
        
        td {
            padding: 12px 15px;
            border-bottom: 1px solid #e9ecef;
        }
        
        tr:last-child td {
            border-bottom: none;
        }
        
        /* 服务详情 */
        .service-details {
            margin: 10px 0;
            padding: 5px;
            background-color: #f8f9fa;
            border-left: 3px solid #3498db;
            font-size: 15px;
        }
        
        .service-details li {
            margin-left: 20px;
        }
        
        /* 金额部分 */
        .amount-summary {
            margin-top: 20px;
            width: 100%;
            text-align: right;
        }
        
        .amount-row {
            display: flex;
            justify-content: flex-end;
            padding: 8px 0;
        }
        
        .amount-label {
            width: 250px;
            text-align: right;
            padding-right: 15px;
            font-weight: bold;
        }
        
        .amount-value {
            width: 150px;
            text-align: right;
        }
        
        .total-due {
            font-size: 20px;
            font-weight: bold;
            border-top: 2px solid #2c3e50;
            padding-top: 12px;
            margin-top: 5px;
            color: #2c3e50;
        }
        
        /* 付款信息 */
        .payment-info {
            margin-top: 10px;
            padding: 5px;
            background-color: #e8f4ff;
            border-radius: 6px;
        }
        
        .payment-info h3 {
            margin-bottom: 5px;
            color: #2c3e50;
        }
        
        .bank-details {
            display: flex;
            flex-wrap: wrap;
            gap: 15px;
        }
        
        .bank-details div {
            min-width: 200px;
        }
        
        /* 页脚 */
        .thank-you {
            margin-top: 20px;
            text-align: center;
            font-size: 15px;
            color: #2c3e50;
            padding-top: 5px;
            border-top: 1px solid #e9ecef;
            font-style: italic;
        }
        
        /* 分隔线 */
        hr {
            border: 0;
            height: 1px;
            /* background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.1), rgba(0,0,0,0)); */
            background: #e9ecef;
            margin: 15px 0;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <div class="company-info">
                <h1>INVOICE</h1>
                <p><strong>From:</strong></p>
                <p><strong>MacroHub Technology</strong></p>
                <p>ABN: 12 345 678 900</p>
                <p>contact@exampel.com</p>
                <p>+61 400 000 001</p>
            </div>
            <div class="company-logo">
                <img src="https://img.icons8.com/?size=100&id=13047&format=png&color=000000" alt="Wanfi Technology Logo">
            </div>
        </div>
        
        <div class="invoice-info">
            <div class="bill-to">
                <p><strong>To:</strong></p>
                <p><span th:text="${username}">Mr. Exampele</span></p>
                <p><span th:text="${email}">Example@example.com</span></p>
            </div>
            <div class="invoice-details">
                <div><strong>Invoice Number:</strong> <span th:text="${invoiceNumber}">INV-2025-05-001</span></div>
                <div><strong>Invoice Date:</strong> <span th:text="${#dates.format(new java.util.Date(now), 'yyyy-MM-dd')}">2025-05-28</span></div>
                <div><strong>Due Date:</strong> <span th:text="${#dates.format(new java.util.Date(now + 7*1000*60*60*24L), 'yyyy-MM-dd')}">2025-06-04</span></div>
            </div>
        </div>
        
        <hr>
        
        <h2>Description of Services</h2>
        
        <table>
            <thead>
                <tr>
                    <th>Item Name</th>
                    <th>Qty</th>
                    <th>Unit Price (<span th:text="${currency}">AUD</span>)</th>
                    <th>Total (<span th:text="${currency}">AUD</span>)</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td><span th:text="${itemName}">Network Traffic Fee</span></td>
                    <td><span th:text="${qty}">1</span></td>
                    <td><span th:text="${unitPrice}">$50</span></td>
                    <td><span th:text="${total}">$50</span></td>
                </tr>
            </tbody>
        </table>
        
        <div class="service-details" th:if="${hasDetails}">
            <p><strong>Details:</strong></p>
            <ul>
                <li>Total data: <strong><span th:text="${traffic}">200GB</span></strong></li>
                <li>Speed cap: <strong><span th:text="${speedCap}">Upload 30 Mbps / Download 100 Mbps</span></strong></li>
                <li>Number of devices supported: <strong><span th:text="${clientsNumber}">5</span></strong></li>
                <li>Billing cycle: <strong><span th:text="${billingCycle}">Monthly</span></strong></li>
            </ul>
        </div>
        
        <div class="amount-summary">
            <div class="amount-row">
                <div class="amount-label">Subtotal:</div>
                <div class="amount-value"><span th:text="${total}">$50.00</span></div>
            </div>
            <div class="amount-row">
                <div class="amount-label">GST (0%):</div>
                <div class="amount-value"><span th:text="${currencySymbol}">$</span>0.00</div>
            </div>
            <div class="amount-row total-due">
                <div class="amount-label">Total Due (<span th:text="${currency}">AUD</span>):</div>
                <div class="amount-value"><span th:text="${total}">$50.00</span></div>
            </div>
        </div>
        
        <!-- <hr>
        
        <div class="payment-info">
            <h3>Payment Details</h3>
            <div class="bank-details">
                <div><strong>Bank:</strong> ANZ</div>
                <div><strong>BSB:</strong> 123-456</div>
                <div><strong>Account:</strong> 98765432</div>
                <div><strong>Reference:</strong> INV-2025-05-001</div>
            </div>
        </div> -->
        
        <div class="thank-you">
            <p>Thank you for your business!</p>
        </div>
    </div>
</body>
</html>