<?php
if ( ! defined( 'ABSPATH' ) ) exit;   
   
function sifency_addons_render_new_template_modal( $tabs, $active_tab ) { ?>
        <div id="sifency-new-template-modal" class="sifency-modal-overlay">
			<div class="sifency-modal-wrap sifency-new-template-wrap">
				<div class="sifency-modal-header">
					<h2> 
                    <?php
                        if ( 'all' !== $active_tab && isset( $tabs[ $active_tab ] ) ) {
                            printf(
                                /* translators: %s: Create New template type label */
                                esc_html__( 'Create New %s', 'sifency-addons' ),
                                esc_html( $tabs[ $active_tab ]['label'] )
                            );
                        } else {
                            esc_html_e( 'Create New Template', 'sifency-addons' );
                        }
                        ?></h2>
					<button class="sifency-modal-close">⛌</button>
				</div>
				<div class="sifency-modal-body">
                    <div class="sifency-form-group">
                        <label for="sifency-template-title"><?php esc_html_e( 'Template Name', 'sifency-addons' ); ?></label>
					    <input type="text" id="sifency-template-title" placeholder="<?php esc_attr_e( 'Enter your title here...', 'sifency-addons' ); ?>" />
                    </div>
                    <div class="sifency-form-group">
                        <label for="sifency-template-type"><?php esc_html_e( 'Change Template Type', 'sifency-addons' ); ?></label>
                        <select id="sifency-template-type">
                            <?php
                            foreach ( $tabs as $slug => $data ) {
                                if ( 'all' === $slug ) continue;
                                echo '<option value="' . esc_attr( $slug ) . '" ' . selected( $slug, ( 'all' === $active_tab ? 'header' : $active_tab ), false ) . '>'. esc_html( $data['label'] ) . '</option>';
                            }
                            ?>
                        </select>
                    </div>
				</div>
                <div class="sifency-modal-footer">
                    <button id="sifency-create-and-save" class="button sifency-admin-btn sifency-secondary-btn">
                        <span class="spinner"></span>
						<?php esc_html_e( 'Save as Draft', 'sifency-addons' ); ?>
					</button>
					<button id="sifency-create-and-edit" class="button button-primary sifency-admin-btn sifency-admin-accent-btn">
                        <span class="spinner"></span>
						<?php esc_html_e( 'Create & Edit with Elementor', 'sifency-addons' ); ?>
					</button>
				</div>
			</div>
		</div>
    <?php }