<?php
/**
 * CUSTOMER ORDER COMPLETION EMAIL TEMPLATE
 * File: templates/email/order-completion-customer.php
 */

// Email content
ob_start();
?>

<div class="alert alert-success">
    <strong>Order Completed Successfully!</strong><br>
    Your rental has been marked as complete and your security deposit has been refunded.
</div>

<div class="order-summary">
    <h3>Order Details</h3>
    <p><strong>Order Number:</strong> #<?= $order_number ?></p>
    <p><strong>Item:</strong> <?= htmlspecialchars($item_title) ?></p>
    <p><strong>Status:</strong> <span style="color: #28a745; font-weight: bold;">Completed</span></p>
</div>

<table class="table">
    <tr>
        <th colspan="2" style="background: #f8f9fa;">Security Deposit Refund</th>
    </tr>
    <tr style="font-weight: bold; font-size: 16px;">
        <td>Refunded Amount</td>
        <td style="text-align: right; color: #28a745;">₦<?= number_format($security_deposit, 2) ?></td>
    </tr>
</table>

<div class="alert alert-success">
    <strong>Deposit Refunded!</strong><br>
    Your security deposit of <strong>₦<?= number_format($security_deposit, 2) ?></strong> has been refunded to your wallet and is now available for:
    <ul style="margin: 10px 0 0 20px;">
        <li>Withdrawal to your bank account</li>
        <li>Use for future rentals on our platform</li>
    </ul>
</div>

<div class="alert alert-info">
    <strong>We'd Love Your Feedback!</strong><br>
    Please take a moment to rate your rental experience and help other customers make informed decisions.
</div>

<div class="alert alert-warning">
    <strong>What's Next?</strong>
    <ul style="margin: 10px 0 0 20px;">
        <li>Check your wallet balance in your dashboard</li>
        <li>Withdraw funds to your bank account anytime</li>
        <li>Rate and review this rental experience</li>
        <li>Browse more amazing items for your next rental</li>
    </ul>
</div>

<p>Thank you for using <?= APP_NAME ?>! We hope to serve you again soon.</p>

<?php
$content = ob_get_clean();

// Prepare email data
$email_data = [
    'title' => 'Order Completed - #' . $order_number,
    'greeting' => "Hello {$customer_name}!",
    'content' => $content,
    'action_url' => APP_URL . '/customer/wallet.php',
    'action_text' => 'View Wallet',
    'secondary_action_url' => APP_URL . '/items.php',
    'secondary_action_text' => 'Browse More Items',
    'footer_note' => 'Thank you for choosing us!',
    'signature' => "Best regards,<br>The " . APP_NAME . " Team<br>support@rentidium.com"
];

// Include layout
include 'layout.php';
?>