<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
$data =	SftcyWordaiBase::sc_wordai_get_current_content_settings();
?>
<!-- Start Suggest titles popup dialog -->
<!-- <div id="suggest-titles-button-click-dialog" style="padding: 15px; display: none; background-color: #FEE6FF;">     -->
<div id="suggest-titles-button-click-dialog" class="sc-wordai-global-dialog">
	<div class="wordai-suggest-modal-shell">
		<div class="wordai-suggest-modal-topbar">
			<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',
						'context'    => 'suggest_title_popup',
						'show_label' => true,
					]);
					?>
				</div>
				<div class="sc-wordai-popup-provider-row sc-wordai-popup-provider-row--right">
					<div class="sc-wordai-provider-switch-msg"></div>
				</div>
			</div>
		</div>

		<div class="wordai-suggest-modal-form">
			<div class="wordai-suggest-modal-field">
				<div class="wordai-modal-section-head">
					<h4><?php esc_html_e( 'Prompt / Hints', 'wordai-pro' ); ?></h4>
					<span class="wordai-modal-section-note"><?php esc_html_e( 'Use your current post title or a short prompt to generate alternatives.', 'wordai-pro' ); ?></span>
				</div>
				<p class="prompt-alert-msg"></p>
				<input type="text" name="scwordai-suggest-title-prompt" class="scwordai-suggest-title-prompt" placeholder="<?php esc_html_e( 'Write your prompt for title...', 'wordai-pro' ); ?>" />
			</div>

			<div class="wordai-suggest-modal-actions">
				<div class="wordai-suggest-modal-actions-main">
					<?php
					if ( SftcyWordaiOpenai::sc_wordai_streaming_status() && ! SftcyWordaiOpenai::sc_wordai_current_model_uses_responses_api() ) {
						echo '<button class="button button-primary sc-wordai-write-suggest-titles-streaming-btn">' . esc_html__( 'Suggest Title(s)', 'wordai-pro' ) . '</button>';
					} else {
						echo '<button class="button button-primary sc-wordai-write-suggest-titles-btn">' . esc_html__( 'Suggest Title(s)', 'wordai-pro' ) . '</button>';
					}
					?>
					<button class="button button-secondary sc-wordai-write-suggest-titles-cancel-btn" style="display: none;"><?php esc_html_e( 'Cancel', 'wordai-pro' ); ?></button>
				</div>

				<label class="wordai-suggest-count-control" for="scwordai-suggested-titles-number">
					<span><?php esc_html_e( 'Titles', 'wordai-pro' ); ?></span>
					<select id="scwordai-suggested-titles-number" name="wordai-suggested-title-number">
						<?php
						for ( $i = 1; $i < 11; $i++ ) {
							$selected = isset( $data['wordai-suggested-title-number'] ) ? selected( $data['wordai-suggested-title-number'], $i, false ) : selected( $i, 2, false );
							echo '<option value="' . esc_attr( $i ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $i ) . '</option>';
						}
						?>
					</select>
				</label>
			</div>
		</div>

		<div class="wave-animation-row" style="display:none;">
			<div class="sc-wave">
				<?php
				for ( $i = 0; $i < 10; $i++ ) {
					echo '<div class="wave"></div>';
				}
				?>
			</div>
			<div class="sc-wave-label">Generating&hellip;</div>
		</div>

		<div class="scwordai-suggested-title-wrapper" style="display: none;">
			<div class="wordai-modal-section-head">
				<h5><?php esc_html_e( 'Generated Title(s)', 'wordai-pro' ); ?></h5>
				<span class="wordai-modal-section-note"><?php esc_html_e( 'Pick one option, then update the editor title in one click.', 'wordai-pro' ); ?></span>
			</div>
			<ul class="sc-wordai-suggested-titles-list"></ul>
			<div class="wordai-suggest-results-footer">
				<button class="button button-primary sc-wordai-suggested-title-update-btn">
					<i class="dashicons dashicons-update"></i>
					<?php esc_html_e( 'Update Title', 'wordai-pro' ); ?>
				</button>
				<span class="update-suggested-title-msg"></span>
			</div>
		</div>
	</div>
</div>
<!-- End Suggest titles popup dialog -->
