<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
$data       = SftcyWordaiBase::sc_wordai_get_current_content_settings();
$image_data = SftcyWordaiBase::sc_wordai_get_current_image_settings();

$image_save_to_gallery = isset( $image_data['sc-wordai-imagesave-togallery'] ) ? (int) $image_data['sc-wordai-imagesave-togallery'] : 0;
$image_set_featured    = isset( $image_data['sc-wordai-set-feature-image'] ) ? (int) $image_data['sc-wordai-set-feature-image'] : 0;
$image_number          = isset( $image_data['sc-wordai-image-number'] ) ? (int) $image_data['sc-wordai-image-number'] : 1;
$seo_generation_locked = class_exists( 'SftcyWordaiFeatures' ) && ! SftcyWordaiFeatures::wordai_is_feature_available( 'seo_generation_options' );
$prompt_assistant_limited = class_exists( 'SftcyWordaiFeatures' ) && SftcyWordaiFeatures::wordai_is_feature_limited( 'prompt_assistant' );
$prompt_assistant_upgrade_url = class_exists( 'SftcyWordaiFeatures' ) ? SftcyWordaiFeatures::wordai_get_upgrade_url() : 'https://softcoy.com/products/wordai-pro/checkout';
$wordai_pro_checkout_url = class_exists( 'SftcyWordaiFeatures' ) ? SftcyWordaiFeatures::wordai_get_upgrade_url() : 'https://softcoy.com/products/wordai-pro/checkout';
$wordai_docs_base_url = defined( 'SFTCY_WORDAI_DOCS_BASE_URL' ) && SFTCY_WORDAI_DOCS_BASE_URL ? SFTCY_WORDAI_DOCS_BASE_URL : '';
if ( '' === $wordai_docs_base_url ) {
	$wordai_site_host = wp_parse_url( home_url(), PHP_URL_HOST );
	if ( $wordai_site_host && ( in_array( $wordai_site_host, array( '127.0.0.1', '::1' ), true ) || false !== strpos( $wordai_site_host, 'local' . 'host' ) ) ) {
		$wordai_docs_base_url = 'http://' . $wordai_site_host . '/' . 'softcoy' . '-new' . '-site' . '/docs';
	} else {
		$wordai_docs_base_url = 'https://softcoy.com/docs';
	}
}
$wordai_content_docs_url = trailingslashit( esc_url_raw( $wordai_docs_base_url ) ) . 'wordai-pro-content-generation-modal';
$wordai_prompt_templates = array(
	array(
		'key'         => 'blog_post',
		'label'       => __( 'SEO Blog Post', 'wordai-pro' ),
		'description' => __( 'Structured article prompt for posts and guides.', 'wordai-pro' ),
		'prompt'      => __( 'Write a helpful SEO-friendly blog post about [topic] for [audience]. Cover the main problem, practical guidance, examples, and a clear conclusion. Use natural headings, short paragraphs, and a confident professional tone.', 'wordai-pro' ),
		'basic'       => true,
	),
	array(
		'key'         => 'page_content',
		'label'       => __( 'Website Page', 'wordai-pro' ),
		'description' => __( 'Clear service or landing page copy.', 'wordai-pro' ),
		'prompt'      => __( 'Create website page content for [service or topic]. Explain the value, who it helps, key benefits, trust points, and a clear call to action. Keep the wording persuasive, readable, and suitable for a WordPress page.', 'wordai-pro' ),
		'basic'       => true,
	),
	array(
		'key'         => 'image_prompt',
		'label'       => __( 'Image Prompt', 'wordai-pro' ),
		'description' => __( 'Prompt for generating a relevant visual.', 'wordai-pro' ),
		'prompt'      => __( 'Generate a high-quality image for [topic]. The image should be relevant to the article, visually clear, professional, and suitable as a WordPress featured image. Avoid text overlays, distorted objects, and unrelated elements.', 'wordai-pro' ),
		'basic'       => true,
	),
	array(
		'key'         => 'product_copy',
		'label'       => __( 'Product Copy', 'wordai-pro' ),
		'description' => __( 'WooCommerce title and sales copy guidance.', 'wordai-pro' ),
		'prompt'      => __( 'Write WooCommerce product content for [product name]. Include the product value, ideal customer, practical benefits, important features, usage context, and a purchase-focused call to action. Keep claims realistic and conversion-focused.', 'wordai-pro' ),
		'basic'       => false,
	),
	array(
		'key'         => 'seo_brief',
		'label'       => __( 'SEO Content Brief', 'wordai-pro' ),
		'description' => __( 'Search intent, keyword, heading, and answer guidance.', 'wordai-pro' ),
		'prompt'      => __( 'Create SEO-ready content for [topic] targeting [focus keyword]. Match the likely search intent, use strong H2 and H3 headings, address likely reader concerns naturally, include practical examples, and write a meta-friendly introduction and conclusion.', 'wordai-pro' ),
		'basic'       => false,
	),
	array(
		'key'         => 'faq_content',
		'label'       => __( 'FAQ Section', 'wordai-pro' ),
		'description' => __( 'Question and answer content for support pages.', 'wordai-pro' ),
		'prompt'      => __( 'Create a helpful FAQ section for [topic]. Include common customer questions, concise answers, and practical guidance. Keep the answers accurate, friendly, and easy to scan.', 'wordai-pro' ),
		'basic'       => false,
	),
);
?>

<!-- Metabox trigger button -->
<button class="button button-primary button-large metabox-content-writer-btn">
	<i class="sc-wordai-metabox-button-custom-icon"></i>
	<span class="metabox-content-writer-btn__label"><?php esc_html_e( 'WordAI', 'wordai-pro' ); ?></span>
</button>

<!-- Modal Window -->
<div id="metabox-button-click-dialog" class="sc-wordai-global-dialog">
	<div class="wordai-content-modal-shell">
		<div class="wordai-content-modal-top">
			<div class="wordai-section wordai-prompt-section">


					    <!-- ===================== Provider Selector ===================== -->
						<div class="sc-wordai-popup-provider-block">
							<div class="sc-wordai-popup-provider-row sc-wordai-popup-provider-row--right">
								<?php
								SftcyWordaiBase::sc_wordai_render_provider_selector([
								'id'      => 'sc-wordai-ai-provider-suggest-popup', // change id per modal
								'context' => 'content_popup',                       // change context per modal
								'show_label' => true,
								]);
								?>
							</div>

							<div class="sc-wordai-popup-provider-row sc-wordai-popup-provider-row--right">
								<div class="sc-wordai-provider-switch-msg" style="display:none;"></div>
							</div>
						</div>


						<h4 class="wordai-prompt-hints-label"><?php esc_html_e( 'Prompt / Hints', 'wordai-pro' ); ?></h4>
						<p class="prompt-alert-msg"></p>
						<textarea name="scwordai-prompt" class="scwordai-prompt" rows="5" placeholder="<?php esc_attr_e( 'Write your prompt / hints words...', 'wordai-pro' ); ?>"></textarea>

						<div class="wordai-actions-row">
							<?php if ( SftcyWordaiOpenai::sc_wordai_streaming_status() && ! SftcyWordaiOpenai::sc_wordai_current_model_uses_responses_api() ) { ?>
								<button class="button button-primary sc-wordai-generate-content-streaming-btn">
									<i class="fa-solid fa-wand-magic-sparkles" aria-hidden="true"></i>
									<span><?php esc_html_e( 'Generate', 'wordai-pro' ); ?></span>
								</button>
							<?php } else { ?>
								<button class="button button-primary sc-wordai-generate-content-btn">
									<i class="fa-solid fa-wand-magic-sparkles" aria-hidden="true"></i>
									<span><?php esc_html_e( 'Generate', 'wordai-pro' ); ?></span>
								</button>
							<?php } ?>
								<button class="button button-secondary sc-wordai-generate-cancel-requests-content-btn" style="display:none;">
									<i class="fa-solid fa-xmark" aria-hidden="true"></i>
									<span><?php esc_html_e( 'Cancel', 'wordai-pro' ); ?></span>
								</button>
								<button type="button" class="button button-secondary wordai-prompt-assistant-toggle" aria-expanded="false">
									<span class="dashicons dashicons-lightbulb" aria-hidden="true"></span>
									<span><?php esc_html_e( 'Prompt Assistant', 'wordai-pro' ); ?></span>
								</button>
								<a class="button button-secondary wordai-content-docs-link" href="<?php echo esc_url( $wordai_content_docs_url ); ?>" target="_blank" rel="noopener">
									<span class="dashicons dashicons-media-document" aria-hidden="true"></span>
									<span><?php esc_html_e( 'Content Help', 'wordai-pro' ); ?></span>
								</a>
						</div>

						<div class="wordai-prompt-assistant-panel" hidden>
							<div class="wordai-prompt-assistant-head">
								<div>
									<h5><?php esc_html_e( 'Choose a strong starting prompt', 'wordai-pro' ); ?></h5>
									<p><?php esc_html_e( 'Use an example or build a clear prompt with topic, audience, goal, keywords, and call to action before generating.', 'wordai-pro' ); ?></p>
								</div>
								<?php if ( $prompt_assistant_limited ) : ?>
									<a class="wordai-prompt-assistant-upgrade" href="<?php echo esc_url( $prompt_assistant_upgrade_url ); ?>" target="_blank" rel="noopener">
										<span class="dashicons dashicons-lock" aria-hidden="true"></span>
										<?php esc_html_e( 'Unlock Pro prompts', 'wordai-pro' ); ?>
									</a>
								<?php endif; ?>
							</div>

							<div class="wordai-prompt-assistant-grid">
								<div class="wordai-prompt-template-list" aria-label="<?php esc_attr_e( 'Prompt examples', 'wordai-pro' ); ?>">
									<?php foreach ( $wordai_prompt_templates as $template ) : ?>
										<?php $template_locked = $prompt_assistant_limited && empty( $template['basic'] ); ?>
										<button
											type="button"
											class="wordai-prompt-template-card <?php echo $template_locked ? esc_attr( 'is-locked' ) : ''; ?>"
											data-template-prompt="<?php echo esc_attr( $template['prompt'] ); ?>"
											data-template-locked="<?php echo $template_locked ? '1' : '0'; ?>"
										>
											<span class="wordai-prompt-template-title">
												<?php echo esc_html( $template['label'] ); ?>
												<?php if ( $template_locked ) : ?>
													<span class="wordai-prompt-template-badge"><?php esc_html_e( 'Pro', 'wordai-pro' ); ?></span>
												<?php endif; ?>
											</span>
											<span class="wordai-prompt-template-desc"><?php echo esc_html( $template['description'] ); ?></span>
										</button>
									<?php endforeach; ?>
								</div>

								<div class="wordai-prompt-builder">
									<div class="wordai-prompt-builder-fields">
										<label>
											<span><?php esc_html_e( 'Topic', 'wordai-pro' ); ?></span>
											<input type="text" class="wordai-prompt-builder-input" data-prompt-field="topic" placeholder="<?php esc_attr_e( 'Example: AI tools for small business', 'wordai-pro' ); ?>">
										</label>
										<label>
											<span><?php esc_html_e( 'Audience', 'wordai-pro' ); ?></span>
											<input type="text" class="wordai-prompt-builder-input" data-prompt-field="audience" placeholder="<?php esc_attr_e( 'Example: WordPress site owners', 'wordai-pro' ); ?>">
										</label>
										<label>
											<span><?php esc_html_e( 'Goal', 'wordai-pro' ); ?></span>
											<input type="text" class="wordai-prompt-builder-input" data-prompt-field="goal" placeholder="<?php esc_attr_e( 'Example: educate and encourage signups', 'wordai-pro' ); ?>">
										</label>
										<label class="<?php echo $prompt_assistant_limited ? esc_attr( 'is-pro-field' ) : ''; ?>">
											<span><?php esc_html_e( 'Focus keyword', 'wordai-pro' ); ?></span>
											<input type="text" class="wordai-prompt-builder-input" data-prompt-field="keyword" placeholder="<?php esc_attr_e( 'Example: AI content generator', 'wordai-pro' ); ?>" <?php disabled( $prompt_assistant_limited ); ?>>
										</label>
										<label class="<?php echo $prompt_assistant_limited ? esc_attr( 'is-pro-field' ) : ''; ?>">
											<span><?php esc_html_e( 'Key points', 'wordai-pro' ); ?></span>
											<input type="text" class="wordai-prompt-builder-input" data-prompt-field="points" placeholder="<?php esc_attr_e( 'Example: benefits, setup, examples, mistakes to avoid', 'wordai-pro' ); ?>" <?php disabled( $prompt_assistant_limited ); ?>>
										</label>
										<label class="<?php echo $prompt_assistant_limited ? esc_attr( 'is-pro-field' ) : ''; ?>">
											<span><?php esc_html_e( 'Call to action', 'wordai-pro' ); ?></span>
											<input type="text" class="wordai-prompt-builder-input" data-prompt-field="cta" placeholder="<?php esc_attr_e( 'Example: invite readers to try the product', 'wordai-pro' ); ?>" <?php disabled( $prompt_assistant_limited ); ?>>
										</label>
									</div>
									<textarea class="wordai-prompt-builder-preview" rows="4" readonly placeholder="<?php esc_attr_e( 'Your built prompt will appear here.', 'wordai-pro' ); ?>"></textarea>
									<div class="wordai-prompt-builder-actions">
										<button type="button" class="button button-primary wordai-prompt-builder-insert">
											<span class="dashicons dashicons-insert" aria-hidden="true"></span>
											<span><?php esc_html_e( 'Use Prompt', 'wordai-pro' ); ?></span>
										</button>
										<button type="button" class="button button-secondary wordai-prompt-builder-clear">
											<span class="dashicons dashicons-dismiss" aria-hidden="true"></span>
											<span><?php esc_html_e( 'Clear', 'wordai-pro' ); ?></span>
										</button>
									</div>
								</div>
							</div>
						</div>
					</div>
		</div>

		<div class="wordai-content-modal-toolbar">
			<div class="wordai-options-grid">
						<!-- Content Options -->
						<div class="wordai-card">
							<h4 class="wordai-card-header"><?php esc_html_e( 'Content Options', 'wordai-pro' ); ?></h4>
							<div class="wordai-checkbox-group">
								<label for="wordAITitleOptionChkBox">
									<input type="checkbox" id="wordAITitleOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-post-title"
										value="title" checked />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'Title', 'wordai-pro' ); ?></span>
								</label>

								<label for="wordAIContentOptionChkBox">
									<input type="checkbox" id="wordAIContentOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-post-content"
										value="content" checked />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'Content', 'wordai-pro' ); ?></span>
								</label>

								<label for="wordAIExcerptOptionChkBox">
									<input type="checkbox" id="wordAIExcerptOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-post-excerpt"
										value="excerpt" checked />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'Excerpt', 'wordai-pro' ); ?></span>
								</label>

								<label for="wordAITagsOptionChkBox">
									<input type="checkbox" id="wordAITagsOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-post-tags"
										value="tags" checked />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'Tags', 'wordai-pro' ); ?></span>
								</label>
							</div>
						</div>

						<!-- SEO Options -->
						<div class="wordai-card">
							<h4 class="wordai-card-header"><?php esc_html_e( 'SEO Options', 'wordai-pro' ); ?></h4>
							<div class="wordai-checkbox-group">
								<label for="wordAIseoTitleOptionChkBox" class="<?php echo $seo_generation_locked ? esc_attr( 'wordai-tier-option-locked' ) : ''; ?>">
									<input type="checkbox" id="wordAIseoTitleOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-seo-title"
										value="seotitle" <?php checked( ! $seo_generation_locked ); ?> <?php disabled( $seo_generation_locked ); ?> />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'SEO Title', 'wordai-pro' ); ?></span>
									<?php if ( $seo_generation_locked ) : ?>
										<a class="wordai-option-lock-badge wordai-option-lock-badge-link" href="<?php echo esc_url( $wordai_pro_checkout_url ); ?>" target="_blank" rel="noopener"><i class="fa-solid fa-lock" aria-hidden="true"></i><?php esc_html_e( 'Pro', 'wordai' ); ?></a>
									<?php endif; ?>
								</label>

								<label for="wordAIseoMetaDescriptionOptionChkBox" class="<?php echo $seo_generation_locked ? esc_attr( 'wordai-tier-option-locked' ) : ''; ?>">
									<input type="checkbox" id="wordAIseoMetaDescriptionOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-seo-meta-description"
										value="seometadescription" <?php checked( ! $seo_generation_locked ); ?> <?php disabled( $seo_generation_locked ); ?> />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'SEO Meta Description', 'wordai-pro' ); ?></span>
									<?php if ( $seo_generation_locked ) : ?>
										<a class="wordai-option-lock-badge wordai-option-lock-badge-link" href="<?php echo esc_url( $wordai_pro_checkout_url ); ?>" target="_blank" rel="noopener"><i class="fa-solid fa-lock" aria-hidden="true"></i><?php esc_html_e( 'Pro', 'wordai' ); ?></a>
									<?php endif; ?>
								</label>

								<label for="wordAIseoMetaFocusKeywrordChkBox" class="<?php echo $seo_generation_locked ? esc_attr( 'wordai-tier-option-locked' ) : ''; ?>">
									<input type="checkbox" id="wordAIseoMetaFocusKeywrordChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-seo-meta-focus-keyword"
										value="seometafocuskeyword" <?php checked( ! $seo_generation_locked ); ?> <?php disabled( $seo_generation_locked ); ?> />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'SEO Focus Keyword', 'wordai-pro' ); ?></span>
									<?php if ( $seo_generation_locked ) : ?>
										<a class="wordai-option-lock-badge wordai-option-lock-badge-link" href="<?php echo esc_url( $wordai_pro_checkout_url ); ?>" target="_blank" rel="noopener"><i class="fa-solid fa-lock" aria-hidden="true"></i><?php esc_html_e( 'Pro', 'wordai' ); ?></a>
									<?php endif; ?>
								</label>

								<label for="wordAIImageAltTextOptionChkBox" class="<?php echo $seo_generation_locked ? esc_attr( 'wordai-tier-option-locked' ) : ''; ?>">
									<input type="checkbox" id="wordAIImageAltTextOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-image-alt-text"
										value="imagealttext" <?php checked( ! $seo_generation_locked ); ?> <?php disabled( $seo_generation_locked ); ?> />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'Image Alt Text', 'wordai-pro' ); ?></span>
									<?php if ( $seo_generation_locked ) : ?>
										<a class="wordai-option-lock-badge wordai-option-lock-badge-link" href="<?php echo esc_url( $wordai_pro_checkout_url ); ?>" target="_blank" rel="noopener"><i class="fa-solid fa-lock" aria-hidden="true"></i><?php esc_html_e( 'Pro', 'wordai' ); ?></a>
									<?php endif; ?>
								</label>
							</div>
							<?php if ( $seo_generation_locked ) : ?>
								<p class="wordai-tier-option-hint"><?php esc_html_e( 'SEO generation options are locked in WordAI Free. Unlock WordAI Pro to generate SEO title, meta description, focus keyword, and image alt text from this modal.', 'wordai' ); ?></p>
							<?php endif; ?>
						</div>

						<!-- Image Option -->
						<div class="wordai-card">
							<h4 class="wordai-card-header"><?php esc_html_e( 'Image Option', 'wordai-pro' ); ?></h4>
							<div class="wordai-checkbox-group">
								<label for="wordAIImagesOptionChkBox">
									<input type="checkbox" id="wordAIImagesOptionChkBox"
										class="sc-wordai-content-generate-options sc-wordai-generate-content-post-images"
										value="images" checked />
									<span class="sc-wordai-items-label"><?php esc_html_e( 'Images', 'wordai-pro' ); ?></span>
								</label>
							</div>
						</div>
			</div>
		</div>

		<div class="wordai-results-shell">
			<div class="wordai-results-nav" hidden>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="title" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Title', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="content" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Content', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="excerpt" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Excerpt', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="tags" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Tags', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="seo-title" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'SEO Title', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="seo-meta-description" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Meta Description', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="seo-meta-focus-keyword" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Focus Keyword', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="image-alt-text" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Image Alt Text', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
				<button type="button" class="button button-secondary wordai-results-nav-btn" data-result-target="images" hidden><span class="wordai-results-nav-label"><?php esc_html_e( 'Images', 'wordai-pro' ); ?></span><span class="wordai-results-nav-badge" hidden></span></button>
			</div>

			<div class="wordai-results-panels">
					<!-- Title -->
					<div class="scwordai-title wordai-generated-block wordai-result-panel" data-result-target="title" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated Title', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-title" rows="2"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-title-copy-btn" data-clipboard-target=".sc-wordai-generated-title"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-title-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<input type="hidden" class="sc-wordai-generated-title-auto-insert-status" value="<?php echo esc_attr( $data['sc-wordai-insert-title'] ); ?>" />
					</div>

					<!-- Content -->
					<div class="scwordai-content wordai-generated-block wordai-result-panel" data-result-target="content" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated Content', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-content" rows="10"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-content-copy-btn" data-clipboard-target=".sc-wordai-generated-content"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-content-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<input type="hidden" class="sc-wordai-replace-withbr-response-format-content" />
						<input type="hidden" class="sc-wordai-generated-content-auto-insert-status" value="<?php echo esc_attr( $data['sc-wordai-insert-content'] ); ?>" />
					</div>

					<!-- Excerpt -->
					<div class="scwordai-excerpt wordai-generated-block wordai-result-panel" data-result-target="excerpt" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated Excerpt', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-excerpt" rows="3"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-excerpt-copy-btn" data-clipboard-target=".sc-wordai-generated-excerpt"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-excerpt-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<input type="hidden" class="sc-wordai-replace-withbr-response-format-excerpt" />
						<input type="hidden" class="sc-wordai-generated-excerpt-auto-insert-status" value="<?php echo esc_attr( $data['sc-wordai-insert-excerpt'] ); ?>" />
					</div>

					<!-- Tags -->
					<div class="scwordai-tags wordai-generated-block wordai-result-panel" data-result-target="tags" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated Tags', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-tags" rows="2"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-tags-copy-btn" data-clipboard-target=".sc-wordai-generated-tags"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-tags-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<input type="hidden" class="sc-wordai-generated-tags-auto-insert-status" value="<?php echo esc_attr( $data['sc-wordai-insert-tags'] ); ?>" />
					</div>

					<!-- SEO Title -->
					<div class="scwordai-seo-title wordai-generated-block wordai-result-panel" data-result-target="seo-title" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated SEO Title', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-seo-title" rows="2"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-seo-title-copy-btn" data-clipboard-target=".sc-wordai-generated-seo-title"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-seo-title-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<input type="hidden" class="sc-wordai-generated-seo-title-auto-insert-status" value="<?php echo esc_attr( $data['sc-wordai-insert-seo-title'] ); ?>" />
					</div>

					<!-- SEO Meta Description -->
					<div class="scwordai-seo-meta-description wordai-generated-block wordai-result-panel" data-result-target="seo-meta-description" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated SEO Meta Description', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-seo-meta-description" rows="3"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-seo-meta-description-copy-btn" data-clipboard-target=".sc-wordai-generated-seo-meta-description"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-seo-meta-description-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<input type="hidden" class="sc-wordai-generated-seo-meta-description-auto-insert-status" value="<?php echo esc_attr( $data['sc-wordai-insert-seo-meta-description'] ); ?>" />
					</div>

					<!-- SEO Meta Focus Keyword -->
					<div class="scwordai-seo-meta-focus-keyword wordai-generated-block wordai-result-panel" data-result-target="seo-meta-focus-keyword" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated SEO Meta Focus Keyword', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-seo-meta-focus-keyword" rows="2"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-seo-meta-focus-keyword-copy-btn" data-clipboard-target=".sc-wordai-generated-seo-meta-focus-keyword"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-seo-meta-focus-keyword-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<input type="hidden" class="sc-wordai-generated-seo-meta-focus-keyword-auto-insert-status" value="<?php echo esc_attr( $data['sc-wordai-insert-seo-meta-focus-keyword'] ); ?>" />
					</div>

					<!-- Image Alt Text -->
					<div class="scwordai-image-alt-text wordai-generated-block wordai-result-panel" data-result-target="image-alt-text" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated Image Alt Text', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<textarea class="sc-wordai-generated-image-alt-text" rows="2"></textarea>
						<br />
						<button class="button button-secondary small-btn sc-wordai-image-alt-text-copy-btn" data-clipboard-target=".sc-wordai-generated-image-alt-text"><?php esc_html_e( 'Copy', 'wordai-pro' ); ?></button>
						<button class="button button-secondary small-btn sc-wordai-image-alt-text-insert-btn"><?php esc_html_e( 'Insert', 'wordai-pro' ); ?></button>
						<p class="description"><?php esc_html_e( 'This alt text will be applied to generated images when they are saved to the media library.', 'wordai-pro' ); ?></p>
					</div>

					<!-- Images -->
					<div class="scwordai-image wordai-generated-block wordai-result-panel" data-result-target="images" style="display:none;">
						<div class="wordai-result-header"><h5><?php esc_html_e( 'Generated Image(s)', 'wordai-pro' ); ?></h5><span class="wordai-result-status" hidden></span></div>
						<div class="sc-wordai-generated-image-wrapper"></div>
						<?php //if ( isset( $image_data['sc-wordai-imagesave-togallery'] ) && $image_data['sc-wordai-imagesave-togallery'] == 0 ) { ?>
							<!-- <br /> -->
							<!-- <button class="button button-secondary small-btn sc-wordai-upload-image-btn"><?php //esc_html_e( 'Save to Gallery', 'wordai-pro' ); ?></button>
							<span class="save-image-to-gallery-icon dashicons dashicons-format-image" style="display:none;"></span> -->
						<?php //} ?>

						<br />
						<div class="sc-wordai-save-to-gallery-row" style="<?php echo ( 1 === $image_save_to_gallery ) ? 'display:none;' : ''; ?>">
						<button class="button button-secondary small-btn sc-wordai-upload-image-btn">
							<?php esc_html_e( 'Save to Gallery', 'wordai-pro' ); ?>
						</button>
						<span class="save-image-to-gallery-icon dashicons dashicons-format-image" style="display:none;"></span>
						</div>


						<input type="hidden" class="sc-wordai-generated-images-urls" />
						<input type="hidden" class="sc-wordai-generated-images-model-name" />
						<input type="hidden" class="sc-wordai-generated-images-save-to-gallery-status" value="<?php echo esc_attr( $image_save_to_gallery ); ?>" />
						<input type="hidden" class="sc-wordai-generated-image-set-feature-status" value="<?php echo esc_attr( $image_set_featured ); ?>" />
						<input type="hidden" class="sc-wordai-will-generate-images-number" value="<?php echo esc_attr( $image_number ); ?>" />
					</div>
			</div>
		</div>
	</div>
</div>
