<?php
/**
 * Templates View
 */
if ( ! defined( 'ABSPATH' ) ) { exit; }

$cloudi7_icg_selected_template = get_option( 'cloudi7_icg_template_skin', 'modern' );

// Artifact paths for previews (using generated images)
$cloudi7_icg_modern_preview  = plugins_url( 'assets/images/modern_template_preview.png', dirname( dirname( __FILE__ ) ) );
$cloudi7_icg_classic_preview = plugins_url( 'assets/images/classic_template_preview.png', dirname( dirname( __FILE__ ) ) );

// If images don't exist yet, we'll use placeholders for the UI
?>
<div class="wrap">
	<h1><?php echo esc_html__( 'ID Card Templates', 'cloudi7-id-card-generator' ); ?></h1>
	<p><?php esc_html_e( 'Select a visual style for your ID cards. All organization types will use this skin.', 'cloudi7-id-card-generator' ); ?></p>

	<form method="post" action="">
		<?php wp_nonce_field( 'cloudi7_icg_action', 'cloudi7_icg_nonce' ); ?>
		
		<div class="cloudi7-icg-template-grid">
			<div class="cloudi7-icg-template-item <?php echo ( $cloudi7_icg_selected_template === 'modern' ) ? 'active' : ''; ?>">
				<label>
					<div class="cloudi7-icg-template-preview">
						<img src="<?php echo esc_url( $cloudi7_icg_modern_preview ); ?>" alt="Modern Template">
					</div>
					<div class="cloudi7-icg-template-info">
						<input type="radio" name="cloudi7_icg_template_skin" value="modern" <?php checked( $cloudi7_icg_selected_template, 'modern' ); ?>>
						<strong><?php esc_html_e( 'Modern Design', 'cloudi7-id-card-generator' ); ?></strong>
						<p><?php esc_html_e( 'Gradient headers, rounded corners, and clean typography.', 'cloudi7-id-card-generator' ); ?></p>
					</div>
				</label>
			</div>

			<div class="cloudi7-icg-template-item <?php echo ( $cloudi7_icg_selected_template === 'classic' ) ? 'active' : ''; ?>">
				<label>
					<div class="cloudi7-icg-template-preview">
						<img src="<?php echo esc_url( $cloudi7_icg_classic_preview ); ?>" alt="Classic Template">
					</div>
					<div class="cloudi7-icg-template-info">
						<input type="radio" name="cloudi7_icg_template_skin" value="classic" <?php checked( $cloudi7_icg_selected_template, 'classic' ); ?>>
						<strong><?php esc_html_e( 'Classic Design', 'cloudi7-id-card-generator' ); ?></strong>
						<p><?php esc_html_e( 'Traditional borders, structured fields, and formal layout.', 'cloudi7-id-card-generator' ); ?></p>
					</div>
				</label>
			</div>
		</div>

		<p class="submit">
			<input type="submit" name="cloudi7_icg_save_template" class="button button-primary button-large" value="<?php echo esc_attr__( 'Apply Selected Template', 'cloudi7-id-card-generator' ); ?>">
		</p>
	</form>
</div>


