<?php
/**
 * Base email template (table-based, inline styles, email-safe).
 *
 * Available variables: $template_key, $brand, $heading, $inbox_preview, $intro_line, $footer_line,
 * $body, $cta_label, $cta_url, $image_url, $footer_text, $address, $unsubscribe,
 * $accent, $logo_url, $discount.
 *
 * @package SuiteMkt3k
 */

defined( 'ABSPATH' ) || exit;

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template locals supplied by Email_Renderer::render().
$suitemkt3k_body_part = SUITEMKT3K_PATH . 'includes/email/templates/parts/body-' . $template_key . '.php';
if ( ! is_readable( $suitemkt3k_body_part ) ) {
	$suitemkt3k_body_part = SUITEMKT3K_PATH . 'includes/email/templates/parts/body-classic.php';
}
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
?><!doctype html>
<html lang="<?php echo esc_attr( get_bloginfo( 'language' ) ); ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="x-apple-disable-message-reformatting">
<title><?php echo esc_html( $heading ?: $brand ); ?></title>
</head>
<body style="margin:0;padding:0;background:#F4F4F7;font-family:Inter,Arial,Helvetica,sans-serif;color:#0F172A;">
<?php if ( '' !== $inbox_preview ) : ?>
<span style="display:none;font-size:1px;color:#F4F4F7;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;">
<?php echo esc_html( $inbox_preview ); ?>
</span>
<?php endif; ?>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#F4F4F7;">
	<tr>
		<td align="center" style="padding:24px 12px;">
			<table role="presentation" width="600" cellpadding="0" cellspacing="0" style="max-width:600px;background:#ffffff;border-radius:14px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,0.05);">
				<?php if ( $logo_url ) : ?>
				<tr>
					<td align="center" valign="middle" style="background:#ffffff;padding:24px 32px;text-align:center;">
						<img src="<?php echo esc_url( $logo_url ); ?>" alt="<?php echo esc_attr( $brand ); ?>" style="display:inline-block;max-height:64px;height:auto;border:0;outline:none;text-decoration:none;vertical-align:middle;">
					</td>
				</tr>
				<tr>
					<td height="6" style="background:<?php echo esc_attr( $accent ); ?>;font-size:0;line-height:0;">&nbsp;</td>
				</tr>
				<?php else : ?>
				<tr>
					<td align="center" valign="middle" style="background:<?php echo esc_attr( $header_color ); ?>;padding:28px 32px;color:#ffffff;text-align:center;">
						<strong style="font-size:20px;letter-spacing:-0.01em;color:#ffffff;"><?php echo esc_html( $brand ); ?></strong>
					</td>
				</tr>
				<?php endif; ?>
				<?php include $suitemkt3k_body_part; ?>
				<tr>
					<td align="center" style="padding:20px 32px 32px;border-top:1px solid #E2E8F0;font-family:Inter,Arial,Helvetica,sans-serif;font-size:12px;line-height:1.6;color:#94A3B8;text-align:center;">
						<div style="text-align:center;"><strong style="color:#475569;"><?php echo esc_html( $footer_text ); ?></strong></div>
						<?php if ( $address ) : ?>
							<div style="text-align:center;"><?php echo esc_html( $address ); ?></div>
						<?php endif; ?>
						<?php if ( '' !== $footer_line ) : ?>
							<div style="margin-top:10px;text-align:center;font-size:11px;color:<?php echo esc_attr( $footer_color ); ?>;"><?php echo esc_html( $footer_line ); ?></div>
						<?php endif; ?>
						<?php if ( $unsubscribe ) : ?>
							<div style="margin-top:12px;text-align:center;">
								<?php if ( ! empty( $unsubscribe_text ) ) : ?>
									<span><?php echo esc_html( $unsubscribe_text ); ?></span>
								<?php endif; ?>
								<a href="<?php echo esc_url( $unsubscribe ); ?>" style="color:#94A3B8;text-decoration:underline;">
									<?php echo esc_html( $unsubscribe_cta ?: __( 'Unsubscribe', 'suitemkt3k' ) ); ?>
								</a>
							</div>
						<?php endif; ?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>
