<?php
require_once __DIR__ . '/../../includes/email.php';

try {
    sendBankEmail(
        $chap,
        'Password Reset — Security Code',
        $name ?? 'Valued Customer',
        'Two-Factor Authentication Code',
        '<p>A password reset has been requested for your account. Please use the following one-time code to complete the process:</p>
        <p style="text-align:center;font-size:28px;font-weight:700;letter-spacing:6px;color:#0a1f44;padding:16px 32px;background:#f0f2ff;border-radius:6px;margin:16px 0;">' . htmlspecialchars($otp, ENT_QUOTES, 'UTF-8') . '</p>
        <p style="color:#cc0000;">This code expires in 10 minutes. If you did not request a password reset, please contact us immediately.</p>'
    );
} catch (Exception $e) {
    error_log('Email send failed: ' . $e->getMessage());
}
