<?php
/**
 * Chat Escalation email template
 *
 * This template can be overridden by copying it to yourtheme/storeagent-ai-for-woocommerce/emails/escalation-email.php.
 *
 * @package SAAI/Templates/Emails
 * @var string $email_heading  The email heading
 * @var string $store_name     The store name
 * @var string $customer_name  The customer name
 * @var string $customer_email The customer email
 * @var string $intro          The custom intro text from settings
 * @var string $summary        The AI-generated conversation summary
 * @var string $trigger        The escalation trigger type
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Output the email header.
 *
 * @hooked WC_Emails::email_header() Output the email header
 */
do_action( 'woocommerce_email_header', $email_heading, null );
?>

<p>
    <?php
    /* translators: %s: Store name */
    printf( esc_html__( 'Hello %s,', 'storeagent-ai-for-woocommerce' ), esc_html( $store_name ) );
    ?>
</p>

<p><?php echo esc_html( $intro ); ?></p>

<h2 style='color: #96588a; display: block; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 130%; margin: 0 0 18px; text-align: left;'>
    <?php esc_html_e( 'Customer Information', 'storeagent-ai-for-woocommerce' ); ?>
</h2>

<table cellspacing="0" cellpadding="8" style="width: 100%; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; color: #636363; border: 1px solid #e5e5e5; margin-bottom: 24px;">
    <tr>
        <td style="border-bottom: 1px solid #e5e5e5; background: #f8f8f8; font-weight: bold; width: 30%;">
            <?php esc_html_e( 'Name', 'storeagent-ai-for-woocommerce' ); ?>
        </td>
        <td style="border-bottom: 1px solid #e5e5e5;">
            <?php echo esc_html( $customer_name ); ?>
        </td>
    </tr>
    <tr>
        <td style="background: #f8f8f8; font-weight: bold;">
            <?php esc_html_e( 'Email', 'storeagent-ai-for-woocommerce' ); ?>
        </td>
        <td>
            <a href="mailto:<?php echo esc_attr( $customer_email ); ?>"><?php echo esc_html( $customer_email ); ?></a>
        </td>
    </tr>
</table>

<h2 style='color: #96588a; display: block; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 130%; margin: 0 0 18px; text-align: left;'>
    <?php esc_html_e( 'Conversation Summary', 'storeagent-ai-for-woocommerce' ); ?>
</h2>

<div style='padding: 16px; background: #f8f8f8; border-left: 4px solid #96588a; margin-bottom: 24px; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-size: 14px; line-height: 1.6; color: #636363;'>
    <?php echo wp_kses_post( nl2br( $summary ) ); ?>
</div>

<div style="padding: 16px; background: #e6f7ff; border: 1px solid #91d5ff; border-radius: 4px; margin-bottom: 24px; text-align: center;">
    <p style='margin: 0; font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; font-size: 14px; font-weight: 500; color: #1890ff;'>
        <?php esc_html_e( 'Reply to this email to respond directly to the customer.', 'storeagent-ai-for-woocommerce' ); ?>
    </p>
</div>

<hr style="border: none; border-top: 1px solid #e5e5e5; margin: 26px 0;" />

<p style="font-size: 12px; color: #99999e;">
    <?php esc_html_e( 'This is an automated notification from your AI Chat assistant. The customer requested human support during a chat conversation.', 'storeagent-ai-for-woocommerce' ); ?>
</p>

<?php
/**
 * Output the email footer.
 *
 * @hooked WC_Emails::email_footer() Output the email footer
 */
do_action( 'woocommerce_email_footer', null );
?>
