<?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: Plugin Settings (REGISTERED) -->
		<div id="mbs-panel-settings"
		     class="mbs-imp-exp-panel"
		     role="tabpanel"
		     hidden>
			<h3><?php esc_html_e( 'Plugin Settings — Import / Export', 'my-book-showroom' ); ?></h3>

			<?php if ( $is_registered ) : ?>

				<p class="mbs-panel-lead"><?php esc_html_e( 'Export your current plugin settings to JSON for backup, or import a previously exported file to restore them.', 'my-book-showroom' ); ?></p>

				<div class="mbs-settings-io-grid">

					<div>
						<h4><?php esc_html_e( 'Export Settings', 'my-book-showroom' ); ?></h4>
						<p><?php esc_html_e( 'Download all plugin settings as a JSON file.', 'my-book-showroom' ); ?></p>
						<button type="button"
						        id="mbs-export-settings-btn"
						        class="button"
						        data-nonce="<?php echo esc_attr( $nonce ); ?>">
							<?php esc_html_e( 'Export Settings as JSON', 'my-book-showroom' ); ?>
						</button>
					</div>

					<div id="mbs-settings-import-area" data-nonce="<?php echo esc_attr( $nonce ); ?>">
						<h4><?php esc_html_e( 'Import Settings', 'my-book-showroom' ); ?></h4>
						<p><?php esc_html_e( 'Upload a previously exported settings JSON file.', 'my-book-showroom' ); ?></p>
						<input type="file"
						       id="mbs-settings-file"
						       accept=".json"
						       data-nonce="<?php echo esc_attr( $nonce ); ?>" />
						<p style="margin-top:8px;">
							<button type="button"
							        id="mbs-settings-import-btn"
							        class="button button-primary">
								<?php esc_html_e( 'Import Settings JSON', 'my-book-showroom' ); ?>
							</button>
						</p>
					</div>

				</div><!-- .mbs-settings-io-grid -->

			<?php else : ?>
					<!-- MBS: Plugin Settings import/export requires a registered license (FREE registered or PRO). -->
				<div class="mbs-imp-exp-soon">
					<span class="dashicons dashicons-lock"></span>
					<p><?php esc_html_e( 'Settings import/export requires a registered license. Registration is free — visit the License tab to activate.', 'my-book-showroom' ); ?></p>
				</div>
			<?php endif; ?>
		</div><!-- #mbs-panel-settings -->
