<?php
/**
 * DISPUTE RAISED EMAIL TEMPLATE (CUSTOMER/VENDOR NOTIFICATION)
 * File: templates/email/dispute-raised.php
 * Uses layout.php wrapper
 */

// Build email content
ob_start();
?>

<div class="alert alert-warning">
    <strong><?= htmlspecialchars($reporter_name) ?></strong> (<?= ucfirst($reporter_type) ?>) has reported an issue with your order.
</div>

<div class="order-summary">
    <h3>Dispute Details</h3>
    
    <table style="width: 100%; border-collapse: collapse;">
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Dispute Number:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($dispute_number) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Order Number:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;">#<?= htmlspecialchars($order_number) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Item:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($item_title) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><strong>Issue Type:</strong></td>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef;"><?= htmlspecialchars($issue_type) ?></td>
        </tr>
        <tr>
            <td style="padding: 8px 0; vertical-align: top;"><strong>Description:</strong></td>
            <td style="padding: 8px 0;"><?= nl2br(htmlspecialchars($description)) ?></td>
        </tr>
        <?php if (isset($amount_involved) && $amount_involved > 0): ?>
        <tr>
            <td style="padding: 8px 0;"><strong>Amount Involved:</strong></td>
            <td style="padding: 8px 0;"><strong style="color: #dc3545;">₦<?= number_format($amount_involved, 2) ?></strong></td>
        </tr>
        <?php endif; ?>
    </table>
</div>

<div class="alert alert-info">
    <strong>What Happens Next?</strong>
    <ul style="margin: 10px 0 0 20px;">
        <li>Review the issue details carefully</li>
        <li>Respond to the issue through the dispute center</li>
        <li>Provide any counter-evidence or explanations</li>
        <li>Work towards a resolution with the other party</li>
    </ul>
</div>

<p style="color: #6c757d; margin-top: 30px;">
    <strong>⏰ Response Deadline:</strong><br>
    Please respond within 48 hours. Timely response to disputes helps maintain a good relationship between vendors and customers.
</p>

<?php
$content = ob_get_clean();

// Prepare email data for layout
$email_data = [
    'title' => '⚠️ Issue Reported - Order #' . $order_number,
    'greeting' => "Dear {$recipient_name},",
    'content' => $content,
    'action_url' => $dashboard_url,
    'action_text' => 'View & Respond to Issue',
    'footer_note' => 'We are committed to fair and transparent dispute resolution.',
    'signature' => "Best regards,<br>The " . APP_NAME . " Team<br>disputes@rentidium.ng"
];

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