<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Final Notice - Collections</title>
    <style>
        body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.6; color: #333; margin: 0; padding: 0; background-color: #f5f5f5; }
        .container { max-width: 600px; margin: 20px auto; background: #ffffff; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); overflow: hidden; border: 4px solid #7f1d1d; }
        .critical-banner { background: #7f1d1d; color: #ffffff; padding: 20px; text-align: center; font-weight: 700; font-size: 20px; }
        .header { background: #000000; color: #ffffff; padding: 30px 20px; text-align: center; }
        .header h1 { margin: 0; font-size: 28px; font-weight: 700; text-transform: uppercase; }
        .collections-notice { background: #fee2e2; color: #7f1d1d; padding: 20px; text-align: center; font-weight: 700; font-size: 16px; border: 2px solid #b91c1c; margin: 20px; border-radius: 6px; }
        .content { padding: 30px 20px; }
        .formal-greeting { font-size: 16px; font-weight: 600; margin-bottom: 20px; text-transform: uppercase; }
        .message { margin-bottom: 20px; }
        .invoice-details { background: #fef2f2; border: 3px solid #b91c1c; padding: 25px; margin: 25px 0; border-radius: 8px; }
        .invoice-details table { width: 100%; }
        .invoice-details td { padding: 12px 0; font-size: 15px; }
        .invoice-details td:first-child { font-weight: 700; width: 50%; }
        .amount { font-size: 40px; font-weight: 700; color: #7f1d1d; }
        .deadline-box { background: #7f1d1d; color: #ffffff; padding: 25px; border-radius: 8px; text-align: center; margin: 25px 0; }
        .deadline-box .title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
        .deadline-box .date { font-size: 32px; font-weight: 700; margin: 10px 0; }
        .button { display: inline-block; padding: 18px 45px; background: #7f1d1d; color: #ffffff !important; text-decoration: none; border-radius: 6px; font-weight: 700; margin: 20px 0; font-size: 18px; box-shadow: 0 4px 6px rgba(0,0,0,0.2); text-transform: uppercase; }
        .button:hover { background: #991b1b; }
        .legal-box { background: #fef3c7; border: 3px solid #f59e0b; padding: 25px; margin: 25px 0; border-radius: 6px; }
        .legal-box h3 { margin-top: 0; color: #78350f; font-size: 18px; }
        .legal-box ol { margin: 15px 0; padding-left: 25px; }
        .legal-box li { margin: 12px 0; color: #78350f; font-weight: 600; line-height: 1.8; }
        .contact-urgent { background: #fee2e2; border: 2px solid #b91c1c; padding: 20px; margin: 25px 0; border-radius: 6px; text-align: center; }
        .footer { background: #f8f9fa; padding: 20px; text-align: center; font-size: 11px; color: #6c757d; border-top: 2px solid #7f1d1d; }
        .footer p { margin: 8px 0; }
        .footer .legal { font-weight: 600; color: #7f1d1d; }
    </style>
</head>
<body>
    <div class="container">
        <div class="critical-banner">
            ⛔ CRITICAL: FINAL NOTICE BEFORE LEGAL ACTION ⛔
        </div>
        
        <div class="header">
            <h1>⚖️ FINAL DEMAND FOR PAYMENT ⚖️</h1>
        </div>
        
        <div class="collections-notice">
            THIS ACCOUNT HAS BEEN FLAGGED FOR COLLECTIONS PROCEEDINGS
        </div>
        
        <div class="content">
            <div class="formal-greeting">RE: {{customer_name}} - Account #{{customer_account_number}}</div>
            
            <div class="message">
                <p style="font-size: 16px; font-weight: 700; color: #7f1d1d;">
                    This is your <strong>FINAL NOTICE</strong> regarding invoice {{invoice_number}}, which is now <strong>{{days_overdue}} DAYS OVERDUE</strong>.
                </p>
                <p style="font-size: 15px; margin-top: 15px;">
                    Despite multiple previous attempts to contact you regarding this outstanding debt, we have not received payment or communication from you. Your account is now in serious default and will be referred to our collections department and/or external collections agency if not resolved immediately.
                </p>
            </div>
            
            <div class="invoice-details">
                <table>
                    <tr>
                        <td>INVOICE NUMBER:</td>
                        <td><strong style="font-size: 20px;">{{invoice_number}}</strong></td>
                    </tr>
                    <tr>
                        <td>ORIGINAL DUE DATE:</td>
                        <td><strong style="color: #7f1d1d;">{{due_date}}</strong></td>
                    </tr>
                    <tr>
                        <td>ORIGINAL INVOICE AMOUNT:</td>
                        <td><strong>{{currency_symbol}}{{original_amount}}</strong></td>
                    </tr>
                    <tr>
                        <td>ACCUMULATED LATE FEES:</td>
                        <td><strong style="color: #b91c1c;">{{currency_symbol}}{{late_fees}}</strong></td>
                    </tr>
                    <tr>
                        <td>COLLECTION FEES:</td>
                        <td><strong style="color: #b91c1c;">{{currency_symbol}}{{collection_fees}}</strong></td>
                    </tr>
                    <tr>
                        <td colspan="2"><hr style="border: 2px solid #b91c1c; margin: 15px 0;"></td>
                    </tr>
                    <tr>
                        <td><strong style="font-size: 18px;">TOTAL AMOUNT NOW DUE:</strong></td>
                        <td class="amount">{{currency_symbol}}{{total_amount}}</td>
                    </tr>
                    <tr>
                        <td>DAYS OVERDUE:</td>
                        <td><strong style="color: #7f1d1d; font-size: 24px;">{{days_overdue}} DAYS</strong></td>
                    </tr>
                </table>
            </div>
            
            <div class="deadline-box">
                <div class="title">⏰ PAYMENT MUST BE RECEIVED BY:</div>
                <div class="date">{{final_deadline_date}}</div>
                <div style="font-size: 14px; margin-top: 10px;">({{deadline_days_remaining}} business days remaining)</div>
            </div>
            
            <center>
                <a href="{{payment_link}}" class="button">Pay {{currency_symbol}}{{total_amount}} Immediately</a>
            </center>
            
            <div class="legal-box">
                <h3>⚖️ LEGAL NOTICE: ACTIONS TO BE TAKEN</h3>
                <p><strong>If payment is not received by {{final_deadline_date}}, the following actions will be taken without further notice:</strong></p>
                <ol>
                    <li><strong>COLLECTIONS REFERRAL:</strong> Your account will be immediately referred to {{collections_agency_name}}, our authorized collections agency. Additional fees will apply.</li>
                    <li><strong>CREDIT REPORTING:</strong> This delinquent account will be reported to major credit bureaus, which will negatively impact your credit score and rating.</li>
                    <li><strong>LEGAL PROCEEDINGS:</strong> We reserve the right to initiate legal proceedings to recover the full amount owed, plus all legal fees, court costs, and interest.</li>
                    <li><strong>ASSET LIENS:</strong> A judgment may be filed against you, which could result in wage garnishment, bank account levies, or liens on property.</li>
                    <li><strong>SERVICE TERMINATION:</strong> All services will be permanently terminated. Future business will require advance payment only.</li>
                </ol>
                <p style="margin-top: 20px; font-weight: 700; color: #78350f;">
                    These are not idle threats. Legal action WILL be taken if this matter is not resolved immediately.
                </p>
            </div>
            
            <div class="contact-urgent">
                <h4 style="margin-top: 0; color: #7f1d1d; font-size: 18px;">⚠️ LAST CHANCE TO AVOID COLLECTIONS</h4>
                <p style="font-weight: 600; margin-bottom: 15px;">If you wish to discuss payment arrangements or dispute this debt, you must contact us IMMEDIATELY:</p>
                <p style="margin: 8px 0; font-size: 16px;"><strong>Collections Department:</strong></p>
                <p style="margin: 5px 0;"><strong>Email:</strong> <a href="mailto:{{collections_email}}" style="color: #7f1d1d; font-weight: 700;">{{collections_email}}</a></p>
                <p style="margin: 5px 0;"><strong>Phone:</strong> <span style="font-size: 18px; font-weight: 700;">{{collections_phone}}</span></p>
                <p style="margin: 5px 0;"><strong>Reference:</strong> {{invoice_number}} / {{customer_account_number}}</p>
                <p style="margin-top: 15px; font-size: 13px; color: #64748b;">Office Hours: {{business_hours}}. After-hours inquiries will be responded to the next business day.</p>
            </div>
            
            <div class="message" style="margin-top: 30px; padding: 20px; background: #fef2f2; border: 2px solid #fecaca; border-radius: 6px;">
                <p style="font-weight: 700; color: #7f1d1d; margin-bottom: 10px; font-size: 15px;">DEBT VALIDATION NOTICE:</p>
                <p style="font-size: 13px; margin: 0; line-height: 1.8;">
                    This is an attempt to collect a debt. Any information obtained will be used for that purpose. If you believe this debt is not valid, you have the right to dispute it in writing within 30 days of receiving this notice. Upon receipt of a written dispute, we will provide verification of the debt.
                </p>
            </div>
        </div>
        
        <div class="footer">
            <p class="legal">{{footer_text}}</p>
            <p class="legal">THIS IS A FINAL DEMAND FOR PAYMENT. FAILURE TO RESPOND WILL RESULT IN LEGAL ACTION.</p>
            <p>{{company_legal_name}} | {{company_address}}</p>
            <p>Tax ID: {{company_tax_id}} | Business License: {{business_license}}</p>
        </div>
    </div>
    
    <!-- Tracking Pixel -->
    <img src="{{tracking_pixel_url}}" width="1" height="1" style="display:none;" alt="">
</body>
</html>