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

/**
 * HTML Template: User Registration Email
 *
 * Sent to the admin when a new user registers on the platform.
 *
 * @var string   $email_heading
 * @var string   $user_name
 * @var string   $user_email
 * @var int      $user_id
 * @var string   $profile_name
 * @var string   $profile_type
 * @var string   $employer_label
 * @var string   $freelancer_label
 * @var string   $site_title
 * @var bool     $sent_to_admin
 * @var bool     $plain_text
 * @var WC_Email $email
 */
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
do_action( 'woocommerce_email_header', $email_heading, $email );
?>

<table role="presentation" cellspacing="0" cellpadding="0" style="width: 100%; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;">
	<tr >
		<td style="padding: 40px 20px;">

			<!-- Greeting -->
			<p style="margin: 0 0 20px 0;">
				<?php echo esc_html__( 'Hello,', 'gigneo' ); ?>
			</p>

			<!-- Introduction -->
			<p style="margin: 0 0 30px 0;">
				<?php
				printf(
					// translators: %s: Site title.
					esc_html__( 'A new account has been successfully created on %s. Here are the registration details for your review.', 'gigneo' ),
					'<strong>' . esc_html( get_bloginfo( 'name' ) ) . '</strong>'
				);
				?>
			</p>

			<!-- Section heading -->
			<h3 style="margin: 0 0 15px 0;">
				<?php echo esc_html__( 'Account details', 'gigneo' ); ?>
			</h3>

			<!-- Details table (matching reference design) -->
			<table role="presentation" cellspacing="0" cellpadding="0" style="width: 100%;  background: #F7F7F7; border: 1px solid #f0f0f0; border-radius: 12px; margin: 0 0 30px 0;">
				<!-- Username -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; width: 50%;">
						<?php echo esc_html__( 'Username', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo esc_html( $user_name ); ?>
					</td>
				</tr>

				<!-- Profile name (conditional) -->
				<?php if ( ! empty( $profile_name ) ) { ?>
					<tr>
						<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
							<?php echo esc_html__( 'Full name', 'gigneo' ); ?>
						</td>
						<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
							<?php echo esc_html( $profile_name ); ?>
						</td>
					</tr>
				<?php } ?>

				<!-- Email address -->
				<tr>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
						<?php echo esc_html__( 'Email address', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
						<?php echo esc_html( $user_email ); ?>
					</td>
				</tr>

				<!-- Account type (conditional) -->
				<?php if ( ! empty( $profile_type ) ) { ?>
					<tr>
						<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0;">
							<?php echo esc_html__( 'Account type', 'gigneo' ); ?>
						</td>
						<td style="padding: 14px 16px; border-bottom: 1px solid #f0f0f0; text-align: right;">
							<?php
							if ( 'freelancer' === $profile_type ) {
								echo esc_html( $freelancer_label );
							} elseif ( 'employer' === $profile_type ) {
								echo esc_html( $employer_label );
							} else {
								echo esc_html( ucfirst( $profile_type ) );
							}
							?>
						</td>
					</tr>
				<?php } ?>

				<!-- Registration date -->
				<tr>
					<td style="padding: 14px 16px;">
						<?php echo esc_html__( 'Registered on', 'gigneo' ); ?>
					</td>
					<td style="padding: 14px 16px; text-align: right;">
						<?php echo esc_html( wp_date( get_option( 'date_format' ) . ' · ' . get_option( 'time_format' ) ) ); ?>
					</td>
				</tr>
			</table>
			<!-- Closing note -->
			<p style="margin: 0 0 10px 0;">
				<?php echo esc_html__( 'You can manage this account directly from your WordPress admin dashboard. No further action is required unless manual approval is enabled.', 'gigneo' ); ?>
			</p>

		</td>
	</tr>
</table>

<?php
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
do_action( 'woocommerce_email_footer', $email );