<?php
/**
 * DISPUTE MESSAGE/REPLY EMAIL TEMPLATE
 * File: templates/email/dispute-message.php
 * Uses layout.php wrapper
 * Sent when someone replies to a dispute
 */

// Build email content
ob_start();
?>

<div class="alert alert-info">
    <strong><?= htmlspecialchars($sender_name) ?></strong> (<?= ucfirst($sender_type) ?>) has replied to dispute <strong><?= htmlspecialchars($dispute_number) ?></strong>.
</div>

<div class="order-summary">
    <h3>Dispute Information</h3>
    
    <table style="width: 100%; border-collapse: collapse;">
        <tr>
            <td style="padding: 8px 0; border-bottom: 1px solid #e9ecef; width: 35%;"><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;"><strong>Item:</strong></td>
            <td style="padding: 8px 0;"><?= htmlspecialchars($item_title) ?></td>
        </tr>
    </table>
</div>

<div style="background-color: #f8f9fa; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #667eea;">
    <div style="font-size: 12px; color: #6c757d; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #e9ecef;">
        <strong>From:</strong> <?= htmlspecialchars($sender_name) ?> (<?= ucfirst($sender_type) ?>)<br>
        <strong>Date:</strong> <?= date('F j, Y \a\t g:i A') ?>
    </div>
    <div style="color: #212529; line-height: 1.8;">
        <?= nl2br(htmlspecialchars($message)) ?>
    </div>
</div>

<div class="alert alert-warning">
    <strong>💬 Action Required</strong><br>
    Please login to your dashboard to view the full conversation history and respond to this message.
</div>

<p style="color: #6c757d; margin-top: 30px;">
    <strong>Note:</strong> Timely communication helps resolve disputes faster and maintains good relationships between all parties.
</p>

<?php
$content = ob_get_clean();

// Prepare email data for layout
$email_data = [
    'title' => '💬 New Reply on Dispute #' . $dispute_number,
    'greeting' => "Dear {$recipient_name},",
    'content' => $content,
    'action_url' => $dashboard_url,
    'action_text' => 'View Full Conversation',
    'footer_note' => 'Keep communication professional and focused on resolving the issue.',
    'signature' => "Best regards,<br>The " . APP_NAME . " Team<br>disputes@rentidium.ng"
];

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