<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>

<?php
    $home_url = home_url();
?>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><?php echo esc_html($subject); ?></title>
</head>
<body style="font-family: Arial, sans-serif; color: #333; line-height: 1.6; margin: 0; padding: 0;">
    <div style="max-width: 600px; margin: 0 auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background: #f9f9f9;">
        
        <?php if(!$isAdmin): ?>
            
            <h2><?php echo esc_html__('Welcome to', 'ehx-members') . ' ' . esc_html($fromName); ?>!</h2>
            <p>
                <?php 
                    /* translators: %s: User's display name wrapped in <strong> tags */
                    printf(esc_html__('Dear %s,', 'ehx-members'), '<strong>' . esc_html($userData['display_name']) . '</strong>'); 
                ?>
            </p>

            <p><?php esc_html_e('We are thrilled to have you join our community. Your registration was successful, and you now have access to our platform. Here are your details:', 'ehx-members'); ?></p>

            <div style="background: #fff; padding: 15px; border-radius: 6px; margin: 15px 0;">
                <p><strong><?php esc_html_e('Username:', 'ehx-members'); ?></strong> <?php echo esc_html($userData['user_login']); ?></p>
                <p><strong><?php esc_html_e('Email:', 'ehx-members'); ?></strong> <?php echo esc_html($userData['user_email']); ?></p>
                <p><strong><?php esc_html_e('Registration Date:', 'ehx-members'); ?></strong> <?php echo esc_html(wp_date('F j, Y')); ?></p>
            </div>

            <p><?php esc_html_e('To get started, visit your account dashboard and explore all the features available to you.', 'ehx-members'); ?></p>

            <p><?php esc_html_e('If you have any questions, feel free to reach out to our support team.', 'ehx-members'); ?></p>

            <p><?php esc_html_e('Best Regards,', 'ehx-members'); ?></p>
            <p><strong><?php echo esc_html($fromName); ?></strong><br>
            <a href='<?php echo esc_url($home_url); ?>'><?php echo esc_url($home_url); ?></a></p>

        <?php else: ?>

            <h2 style="color: #0073aa; margin-top: 0;"><?php esc_html_e('New User Registration', 'ehx-members'); ?></h2>
            <p>
                <?php 
                    /* translators: * %s: The name of the website/organization */
                    printf(esc_html__('A new user has registered on %s. Below are the details:', 'ehx-members'), esc_html($fromName)); 
                ?>
            </p>

            <div style="background: #fff; padding: 15px; border-radius: 6px; margin: 15px 0;">
                <p><strong><?php esc_html_e('Name:', 'ehx-members'); ?></strong> <?php echo esc_html($userData['display_name']); ?></p>
                <p><strong><?php esc_html_e('Username:', 'ehx-members'); ?></strong> <?php echo esc_html($userData['user_login']); ?></p>
                <p><strong><?php esc_html_e('Email:', 'ehx-members'); ?></strong> <?php echo esc_html($userData['user_email']); ?></p>
                <p><strong><?php esc_html_e('Registration Date:', 'ehx-members'); ?></strong> <?php echo esc_html(wp_date('F j, Y')); ?></p>
            </div>

            <p><?php esc_html_e('You can manage this user in the admin dashboard.', 'ehx-members'); ?></p>

            <p>
                <a href="<?php echo esc_url($home_url . '/wp-admin'); ?>" style="display: inline-block;padding: 10px 20px;background: #2271b1;color: #fff !important;text-decoration: none;border-radius: 4px;margin: 15px 0;"><?php esc_html_e('Go to Admin Dashboard', 'ehx-members'); ?></a>
            </p>

            <p><?php esc_html_e('Best Regards,', 'ehx-members'); ?></p>
            <p><strong><?php echo esc_html($fromName); ?></strong></p>

        <?php endif ?>

        <p style="font-size: 12px; color: #666; margin-top: 20px;"><?php esc_html_e('This is an automated message. Please do not reply directly.', 'ehx-members'); ?></p>
    </div>
</body>
</html>