<?php
/**
 * VENDOR ITEM REJECTED EMAIL TEMPLATE
 * File: templates/email/item-rejected.php
 *
 * Variables available via Mailer::getTemplate() extract():
 *   $vendor_name  - vendor business name
 *   $item_title   - item title
 *   $reason       - reason for rejection
 *   $app_name     - platform name (APP_NAME)
 *   $app_url      - platform URL  (APP_URL)
 */

ob_start();
?>

<div class="alert alert-danger">
    <strong>Your Item Listing Was Not Approved</strong><br>
    Our team has reviewed your listing and it requires some changes before it can go live.
</div>

<div class="order-summary">
    <h3>Item Details</h3>
    <p><strong>Item Name:</strong> <?= htmlspecialchars($item_title) ?></p>
    <p><strong>Status:</strong> <span style="color: #dc3545; font-weight: bold;">Rejected</span></p>
</div>

<p>
    Thank you for submitting your listing to <?= APP_NAME ?>.
    After careful review, our team was unable to approve this item at this time.
</p>

<table class="table">
    <tr>
        <th colspan="2" style="background: #f8d7da; color: #721c24;">Reason for Rejection</th>
    </tr>
    <tr>
        <td><?= nl2br(htmlspecialchars($reason)) ?></td>
    </tr>
</table>

<div class="alert alert-info">
    <strong>What you can do:</strong>
    <ul style="margin: 10px 0 0 20px;">
        <li>Log in to your vendor dashboard and edit the item to address the feedback above.</li>
        <li>Ensure all photos are clear, well-lit, and show the item from multiple angles.</li>
        <li>Make sure the title, description, pricing, and terms are complete and accurate.</li>
        <li>Once changes are made, resubmit the item for review.</li>
    </ul>
</div>

<p>
    If you believe this rejection was made in error or need further clarification,
    please do not hesitate to contact our support team — we are happy to help.
</p>

<p>We hope to see your updated listing soon!</p>

<?php
$content = ob_get_clean();

$email_data = [
    'title'                 => 'Item Not Approved — ' . htmlspecialchars($item_title),
    'greeting'              => 'Hello ' . htmlspecialchars($vendor_name) . ',',
    'content'               => $content,
    'action_url'            => APP_URL . '/vendor/items.php',
    'action_text'           => 'Edit & Resubmit Item',
    'secondary_action_url'  => APP_URL . '/contact-us.php',
    'secondary_action_text' => 'Contact Support',
    'footer_note'           => 'This is an automated notification from ' . APP_NAME . '.',
    'signature'             => "Best regards,<br>The " . APP_NAME . " Team",
];

extract($email_data);
include 'layout.php';
?>