<?php
/**
 * GFB Email Template Frontend.
 *
 * @package GFB.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

// Define email styles as variables for reuse
$body_style = 'background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;';
$container_style = 'font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; margin: 0 auto; max-width: 640px; padding: 10px; width: 640px;';
$content_style = 'box-sizing: border-box; display: block; margin: 0 auto; max-width: 640px; padding: 10px;';
$table_style = 'border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f6f6f6;';
$header_style = 'font-family: sans-serif; font-weight: bold; font-size: 24px; line-height: 30px; margin: 0;';
$cell_style = 'font-family: sans-serif; font-size: 14px; vertical-align: top;';
?>
<!doctype html>
<html>
  <head>
	<meta name="viewport" content="width=device-width">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title><?php echo esc_html( $template_title ); ?></title>
  </head>
  <body style="<?php echo esc_attr( $body_style ); ?>">
	<table border="0" cellpadding="0" cellspacing="0" class="body" style="<?php echo esc_attr( $table_style ); ?>">
	  <tr>
		<td style="<?php echo esc_attr( $cell_style ); ?>">&nbsp;</td>
		<td class="container" style="<?php echo esc_attr( $container_style ); ?>">
		  <div class="content" style="<?php echo esc_attr( $content_style ); ?>">

			<!-- START CENTERED WHITE CONTAINER -->
			<table class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background: #ffffff; border-radius: 3px;">

			  <!-- START HEADER -->
			  <tr>
				<td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px; border-bottom: 1px solid #eee;">
				  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
					<tr>
					  <td style="font-family: sans-serif; font-size: 14px; color: #333; vertical-align: middle; text-align: center;">
						<h1 style="<?php echo esc_attr( $header_style ); ?>"><?php echo esc_html( $template_subject ); ?></h1>
					  </td>
					</tr>
				  </table>
				</td>
			  </tr>
			  <!-- END HEADER -->

			  <!-- START MAIN CONTENT AREA -->
			  <tr>
				<td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px 30px;">
				  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
					<tr>
					  <td style="font-family: sans-serif; font-size: 14px; line-height: 28px; color: #333; vertical-align: top;">
						<?php echo wp_kses_post( wpautop( stripslashes($template_message) ) ); ?>
					  </td>
					</tr>
					<tr>
					  <td style="font-family: sans-serif; font-size: 14px; line-height: 28px; color: #333; vertical-align: top;">
						<?php do_action('apbgf_email_template_frontend', $appointment_id, $template_id); ?>
					  </td>
					</tr>
				  </table>
				</td>
			  </tr>

			<!-- END MAIN CONTENT AREA -->
			</table>

			<!-- START FOOTER -->
			<div class="footer" style="clear: both; margin-top: 10px; text-align: center; width: 100%;">
			  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;">
				<tr>
				  <td class="content-block" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; font-size: 12px; color: #999999; text-align: center;">
					<span class="apple-link" style="color: #999999; font-size: 12px; text-align: center;"><?php echo wp_kses_post($data['footer']); ?></span>
				  </td>
				</tr>
			  </table>
			</div>
			<!-- END FOOTER -->

		  <!-- END CENTERED WHITE CONTAINER -->
		  </div>
		</td>
		<td style="<?php echo esc_attr( $cell_style ); ?>">&nbsp;</td>
	  </tr>
	</table>
  </body>
</html>
