<?php
/**
 * Password reset OTP email.
 *
 * Self-contained, WooCommerce-independent HTML email. Override by filtering
 * `app_bridge_password_reset_otp_email_template` with a custom template path.
 *
 * @package WeDevs\AppBridge
 *
 * @var WP_User $user               The user requesting the reset.
 * @var string  $otp                The 6-digit one-time password.
 * @var int     $expires_in_minutes Minutes until the code expires.
 * @var string  $site_title         The site title.
 */

defined( 'ABSPATH' ) || exit;

$greeting_name = $user->first_name ? $user->first_name : $user->display_name;
?>
<!DOCTYPE html>
<html lang="<?php echo esc_attr( str_replace( '_', '-', get_locale() ) ); ?>">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title><?php echo esc_html( $site_title ); ?></title>
</head>
<body style="margin:0;padding:0;background-color:#f1f5f9;">
	<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#f1f5f9;">
		<tr>
			<td align="center" style="padding:32px 16px;">
				<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="max-width:480px;width:100%;background-color:#ffffff;border-radius:16px;overflow:hidden;box-shadow:0 1px 3px rgba(15,23,42,0.08);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
					<tr>
						<td style="padding:32px 40px 8px;">
							<p style="margin:0;font-size:14px;font-weight:600;letter-spacing:0.5px;text-transform:uppercase;color:#6366f1;">
								<?php echo esc_html( $site_title ); ?>
							</p>
						</td>
					</tr>
					<tr>
						<td style="padding:8px 40px 0;">
							<h1 style="margin:0;font-size:22px;line-height:1.3;font-weight:700;color:#0f172a;">
								<?php esc_html_e( 'Reset your password', 'app-bridge' ); ?>
							</h1>
						</td>
					</tr>
					<tr>
						<td style="padding:16px 40px 0;">
							<p style="margin:0;font-size:15px;line-height:1.6;color:#334155;">
								<?php
								/* translators: %s: user first name. */
								printf( esc_html__( 'Hi %s,', 'app-bridge' ), esc_html( $greeting_name ) );
								?>
							</p>
							<p style="margin:12px 0 0;font-size:15px;line-height:1.6;color:#334155;">
								<?php esc_html_e( 'We received a request to reset your password. Enter the code below in the app to continue.', 'app-bridge' ); ?>
							</p>
						</td>
					</tr>
					<tr>
						<td style="padding:24px 40px 0;">
							<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background-color:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;">
								<tr>
									<td align="center" style="padding:24px 16px;">
										<div style="font-size:34px;line-height:1;font-weight:700;letter-spacing:10px;color:#0f172a;padding-left:10px;">
											<?php echo esc_html( $otp ); ?>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td style="padding:16px 40px 0;">
							<p style="margin:0;font-size:13px;line-height:1.6;color:#64748b;">
								<?php
								printf(
									/* translators: %d: minutes until the code expires. */
									esc_html( _n( 'This code expires in %d minute.', 'This code expires in %d minutes.', $expires_in_minutes, 'app-bridge' ) ),
									(int) $expires_in_minutes
								);
								?>
							</p>
						</td>
					</tr>
					<tr>
						<td style="padding:24px 40px 32px;">
							<hr style="border:none;border-top:1px solid #e2e8f0;margin:0 0 16px;">
							<p style="margin:0;font-size:12px;line-height:1.6;color:#94a3b8;">
								<?php esc_html_e( 'If you did not request a password reset, you can safely ignore this email. Your password will not change.', 'app-bridge' ); ?>
							</p>
						</td>
					</tr>
				</table>
				<p style="margin:24px 0 0;font-size:12px;color:#94a3b8;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
					<?php
					printf(
						/* translators: 1: current year, 2: site title. */
						esc_html__( '© %1$s %2$s', 'app-bridge' ),
						esc_html( gmdate( 'Y' ) ),
						esc_html( $site_title )
					);
					?>
				</p>
			</td>
		</tr>
	</table>
</body>
</html>
