<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
/** create_account.php */
if ( isset( $args ) && is_array( $args ) ) {
	extract( $args, EXTR_SKIP );
}
?>
<div class="form-row" style="float: unset;">
	<div id="simplyin-phone-checkbox">
		<div class="simplyin-checkbox-row <?php if ( $checked ) {
			echo 'show';
		} ?>">
			<label class="simplyin-checkbox">
				<input type="checkbox"
					   id="simply-save-checkbox" <?php echo( $checked ? 'checked' : '' ); ?>
					   name="simply-save-checkbox" class="ps-shown-by-js"/>
				<input type="hidden" name="simplyin_create_account_token"
					   value="<?php echo esc_attr( wp_create_nonce( 'simplyin_create_account_nonce' ) ) ?>">
				<span class="simplyin-checkbox-text">
					<strong><?php esc_html_e( 'Remember your details with Simply.IN',
							'simplyin' ); ?></strong><span
						class="simplyin-badge-new"><?php esc_html_e( 'New',
							'simplyin' ); ?></span>
				</span>
				<div class="simplyin-logo">
					<img
						src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../../../public/img/logo_signet.svg' ); ?>?v=1.0"
						alt="<?php esc_attr_e( 'Simply.IN', 'simplyin' ); ?>"/>
				</div>
			</label>
			<ul class="simplyin-benefits-list">
				<li><?php esc_html_e( 'Your complete purchase history and returns from multiple stores in one place',
						'simplyin' ); ?></li>
				<li><?php esc_html_e( 'Fast checkout with saved details, no passwords required',
						'simplyin' ); ?></li>
			</ul>
		</div>
		<div class="simplyin-phone-input" <?php if ( ! $checked ) {
			echo 'style="display: none;"';
		} ?>>
			<div class="phone-input-container">
				<div class="phone-country-select">
					<select id="simplyin-phone-country"
							name="simplyin-phone-country"
							aria-label="<?php esc_attr_e( 'Select country',
								'simplyin' ); ?>">
						<?php foreach ( $countries as $country_item ) : ?>
							<option <?php if ( $country_item['dial_code'] == $selected_prefix ) {
								echo ' selected';
							} ?>
								value="<?php echo esc_attr( $country_item['code'] ); ?>"
								data-flag="<?php echo esc_attr( $country_item['code'] ); ?>"
								data-prefix="<?php echo esc_attr( $country_item['dial_code'] ); ?>">
								<?php echo esc_attr( $country_item['name'] ); ?>
							</option>
						<?php endforeach; ?>
					</select>
					<div class="simplyin-flag-display">
						<img
							src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../../../public/img/poland.svg' ); ?>"
							alt="" width="24" height="16"/>
					</div>
					<span
						class="prefix"><?php echo esc_html( $selected_prefix ); ?></span>
				</div>
				<div class="phone-input">
					<input type="tel" id="simplyin-phone-input"
						   name="simplyin-phone"
						   placeholder="<?php esc_attr_e( 'Phone number',
							   'simplyin' ); ?>"
						   autocomplete="off"
						   value="<?php echo esc_attr( $phone ); ?>"/>
				</div>
				<input type="hidden" name="simplyin-phone-prefix"
					   value="<?php echo esc_attr( $selected_prefix ); ?>">
			</div>
			<div class="phone-input-warning"
				 data-invalid="<?php esc_attr_e( 'The phone number is invalid.',
					 'simplyin' ); ?>"
				 data-empty="<?php esc_attr_e( 'The phone number is required.',
					 'simplyin' ); ?>">
				<?php esc_html_e( 'The phone number is required.',
					'simplyin' ); ?>
			</div>
			<div class="simplyin-description">
				<p>
					<?php esc_html_e( "Next time in Simply.IN stores, you'll confirm your details using your phone (SMS/APP)",
						'simplyin' ); ?>
				</p>
			</div>
		</div>
		<div class="simplyin-terms" <?php if ( ! $checked ) {
			echo 'style="display: none;"';
		} ?>>
			<div class="simplyin-terms-inner">
				<?php esc_html_e( 'By completing your purchase, you agree to', 'simplyin' ); ?>  
				<a href="<?php echo esc_url( $privacy_link ); ?>" target="_blank">
					<?php esc_html_e( 'Privacy Policy', 'simplyin' ); ?>
				</a>
				<?php esc_html_e( 'and', 'simplyin' ); ?> 
				<a href="<?php echo esc_url( $terms_link ); ?>" target="_blank">
					<?php esc_html_e( 'Terms and Conditions', 'simplyin' ); ?>
				</a>
			</div>
			<div class="simplyin-terms-additional-text">
				<span>🔒 <?php esc_html_e( 'PCI - Bank level security', 'simplyin' ); ?></span>
			</div>
		</div>
	</div>
</div>
