<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Variables in scope (injected via mbs_get_template_part from imp-exp-ui.php).
 * @var bool   $is_registered
 * @var bool   $is_pro
 * @var string $nonce
 * @var string $template_url
 */
?>

		<!-- Panel: Import from EPUB (PRO) -->
		<div id="mbs-panel-epub"
		     class="mbs-imp-exp-panel"
		     role="tabpanel"
		     hidden>
			<h3><?php esc_html_e( 'Import from EPUB', 'my-book-showroom' ); ?></h3>

			<?php if ( $is_pro ) : ?>

				<p class="mbs-panel-lead"><?php esc_html_e( 'Upload an .epub file to pre-populate a new book draft. Title, author, publisher, cover, description, TOC, classifications, contributors, and an EPUB format row are all extracted automatically.', 'my-book-showroom' ); ?></p>

				<div id="mbs-epub-upload-area" style="margin-bottom:12px;">
					<input type="file"
					       id="mbs-epub-file"
					       accept=".epub"
					       data-nonce="<?php echo esc_attr( $nonce ); ?>" />
					<button type="button"
					        id="mbs-epub-upload-btn"
					        class="button button-primary"
					        style="margin-left:8px;">
						<?php esc_html_e( 'Upload &amp; Parse EPUB', 'my-book-showroom' ); ?>
					</button>
				</div>

				<div id="mbs-epub-status" class="notice" style="display:none;padding:8px 12px;margin:12px 0;"></div>

				<!-- Preview panel — populated by mbs-import-epub.js after Phase 1 parse -->
				<div id="mbs-epub-preview" style="display:none;margin-top:16px;">
					<h4><?php esc_html_e( 'Extracted Data Preview', 'my-book-showroom' ); ?></h4>
					<table class="widefat" style="margin-bottom:12px;">
						<tbody id="mbs-epub-preview-table"></tbody>
					</table>

					<div id="mbs-epub-dup-notice"
					     class="notice notice-warning inline"
					     style="display:none;padding:8px 12px;margin-bottom:12px;"></div>

					<p>
						<button type="button"
						        id="mbs-epub-import-btn"
						        class="button button-primary"
						        style="display:none;">
							<?php esc_html_e( 'Create Book from EPUB', 'my-book-showroom' ); ?>
						</button>
						<button type="button"
						        id="mbs-epub-force-btn"
						        class="button"
						        style="display:none;margin-left:8px;">
							<?php esc_html_e( 'Create Anyway', 'my-book-showroom' ); ?>
						</button>
					</p>
				</div><!-- #mbs-epub-preview -->

			<?php else : ?>
				<?php MBS_Pro_Gate::comment( 'EPUB Import' ); ?>
				<div class="mbs-imp-exp-soon">
					<span class="dashicons dashicons-lock"></span>
					<p><?php esc_html_e( 'EPUB Import requires a PRO license.', 'my-book-showroom' ); ?></p>
				</div>
			<?php endif; ?>
		</div><!-- #mbs-panel-epub -->
