<?php
/**
 * File Path: templates/admin/blocks-card.php
 *
 * Template partial — Gutenberg Blocks card for the Blocks & Shortcodes settings tab.
 *
 * Loaded via mbs_get_template_part( 'admin/blocks-card' ).
 *
 * No dynamic PHP variables required — all builder options are static HTML.
 *
 * R-05 (2026-04-25): Extracted from MBS_Tab_Shortcodes::render_blocks_card().
 *
 * @package    My_Book_Showroom
 * @subpackage Templates/Admin
 * @since      1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<div class="mbs-settings-card">
	<h3><?php esc_html_e( 'Gutenberg Blocks', 'my-book-showroom' ); ?></h3>
	<p class="mbs-ref-intro">
		<?php esc_html_e( 'Configure each block below, then click Copy to get the serialized block markup. In the WordPress block editor, open the three-dot menu (⋮) and choose Code editor, then paste the copied snippet directly into the page.', 'my-book-showroom' ); ?>
	</p>
	<p class="mbs-ref-intro">
		<?php esc_html_e( 'You can also insert blocks directly in the editor by typing a forward slash followed by the block name, e.g. /book-grid.', 'my-book-showroom' ); ?>
	</p>

	<?php /* ── mbs/book-grid ──────────────────────────────────── */ ?>
	<div class="mbs-ref-entry">
		<div class="mbs-ref-header">
			<span class="mbs-ref-tag"><?php esc_html_e( 'Book Grid', 'my-book-showroom' ); ?></span>
			<span class="mbs-ref-block-name">mbs/book-grid</span>
		</div>
		<p class="mbs-ref-desc">
			<?php esc_html_e( 'Displays multiple books in a grid. Renders using your default layout from Formatting settings.', 'my-book-showroom' ); ?>
		</p>

		<form class="mbs-builder" data-block="mbs/book-grid">
			<div class="mbs-builder-fields">
				<div class="mbs-builder-row">
					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Number of books', 'my-book-showroom' ); ?></label>
						<input type="number" min="1" max="100" value="6"
						       data-attr="limit" data-type="number">
					</div>

					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Order by', 'my-book-showroom' ); ?></label>
						<select data-attr="orderby" data-type="string">
							<option value="date"><?php esc_html_e( 'Date added', 'my-book-showroom' ); ?></option>
							<option value="title"><?php esc_html_e( 'Title (A–Z)', 'my-book-showroom' ); ?></option>
							<option value="menu_order"><?php esc_html_e( 'Custom order', 'my-book-showroom' ); ?></option>
							<option value="rand"><?php esc_html_e( 'Random', 'my-book-showroom' ); ?></option>
						</select>
					</div>
				</div>

				<div class="mbs-builder-row">
					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Author slug', 'my-book-showroom' ); ?></label>
						<input type="text" placeholder="<?php esc_attr_e( 'all', 'my-book-showroom' ); ?>"
						       data-attr="author" data-type="string">
					</div>

					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Series slug', 'my-book-showroom' ); ?></label>
						<input type="text" placeholder="<?php esc_attr_e( 'all', 'my-book-showroom' ); ?>"
						       data-attr="series" data-type="string">
					</div>

					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Genre slug', 'my-book-showroom' ); ?></label>
						<input type="text" placeholder="<?php esc_attr_e( 'all', 'my-book-showroom' ); ?>"
						       data-attr="genre" data-type="string">
					</div>

					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Tag slug', 'my-book-showroom' ); ?></label>
						<input type="text" placeholder="<?php esc_attr_e( 'all', 'my-book-showroom' ); ?>"
						       data-attr="tag" data-type="string">
					</div>
				</div>
			</div>

			<div class="mbs-builder-preview">
				<code class="mbs-builder-output"></code>
				<button type="button" class="button button-primary mbs-copy-btn"><?php esc_html_e( 'Copy', 'my-book-showroom' ); ?></button>
			</div>
		</form>
	</div>

	<hr class="mbs-card-divider">

	<?php /* ── mbs/featured-book ───────────────────────────────── */ ?>
	<div class="mbs-ref-entry">
		<div class="mbs-ref-header">
			<span class="mbs-ref-tag"><?php esc_html_e( 'Featured Book', 'my-book-showroom' ); ?></span>
			<span class="mbs-ref-block-name">mbs/featured-book</span>
		</div>
		<p class="mbs-ref-desc">
			<?php esc_html_e( 'Highlights a single book. Great for homepage hero sections and sidebar callouts.', 'my-book-showroom' ); ?>
		</p>

		<form class="mbs-builder" data-block="mbs/featured-book">
			<div class="mbs-builder-fields">
				<div class="mbs-builder-row">
					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Book ID', 'my-book-showroom' ); ?> <span class="mbs-required">*</span></label>
						<input type="number" min="1" value="0"
						       placeholder="e.g. 42"
						       data-attr="bookId" data-type="number">
					</div>
				</div>
			</div>

			<div class="mbs-builder-preview">
				<code class="mbs-builder-output"></code>
				<button type="button" class="button button-primary mbs-copy-btn"><?php esc_html_e( 'Copy', 'my-book-showroom' ); ?></button>
			</div>
		</form>
	</div>

	<hr class="mbs-card-divider">

	<?php /* ── mbs/buy-links ─────────────────────────────────── */ ?>
	<div class="mbs-ref-entry">
		<div class="mbs-ref-header">
			<span class="mbs-ref-tag"><?php esc_html_e( 'Buy Links', 'my-book-showroom' ); ?></span>
			<span class="mbs-ref-block-name">mbs/buy-links</span>
		</div>
		<p class="mbs-ref-desc">
			<?php esc_html_e( 'Renders the full set of buy buttons for a specific book. Embed purchase options inside any page or post.', 'my-book-showroom' ); ?>
		</p>

		<form class="mbs-builder" data-block="mbs/buy-links">
			<div class="mbs-builder-fields">
				<div class="mbs-builder-row">
					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Book ID', 'my-book-showroom' ); ?> <span class="mbs-required">*</span></label>
						<input type="number" min="1" value="0"
						       placeholder="e.g. 42"
						       data-attr="bookId" data-type="number">
					</div>

					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Display context', 'my-book-showroom' ); ?></label>
						<select data-attr="context" data-type="string">
							<option value="single"><?php esc_html_e( 'Single — full buttons', 'my-book-showroom' ); ?></option>
							<option value="card"><?php esc_html_e( 'Card — compact', 'my-book-showroom' ); ?></option>
						</select>
					</div>
				</div>
			</div>

			<div class="mbs-builder-preview">
				<code class="mbs-builder-output"></code>
				<button type="button" class="button button-primary mbs-copy-btn"><?php esc_html_e( 'Copy', 'my-book-showroom' ); ?></button>
			</div>
		</form>
	</div>

	<hr class="mbs-card-divider">

	<?php /* ── mbs/term-list ──────────────────────────────────── */ ?>
	<div class="mbs-ref-entry">
		<div class="mbs-ref-header">
			<span class="mbs-ref-tag"><?php esc_html_e( 'Term List', 'my-book-showroom' ); ?></span>
			<span class="mbs-ref-block-name">mbs/term-list</span>
		</div>
		<p class="mbs-ref-desc">
			<?php esc_html_e( 'Displays all terms from one of your MBS taxonomies (Authors, Series, Genres, or Tags) as a responsive linked grid. Each term links to its archive page.', 'my-book-showroom' ); ?>
		</p>

		<form class="mbs-builder" data-block="mbs/term-list">
			<div class="mbs-builder-fields">
				<div class="mbs-builder-row">
					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Taxonomy', 'my-book-showroom' ); ?></label>
						<select data-attr="taxonomy" data-type="string">
							<option value="mbs_author"><?php esc_html_e( 'Authors', 'my-book-showroom' ); ?></option>
							<option value="mbs_series"><?php esc_html_e( 'Series', 'my-book-showroom' ); ?></option>
							<option value="mbs_genre"><?php esc_html_e( 'Genres', 'my-book-showroom' ); ?></option>
							<option value="mbs_tag"><?php esc_html_e( 'Tags', 'my-book-showroom' ); ?></option>
						</select>
					</div>

					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Columns', 'my-book-showroom' ); ?></label>
						<input type="number" min="1" max="6" value="3"
						       data-attr="columns" data-type="number">
					</div>

					<div class="mbs-builder-field">
						<label><?php esc_html_e( 'Show book count', 'my-book-showroom' ); ?></label>
						<select data-attr="show_count" data-type="bool">
							<option value="false"><?php esc_html_e( 'No', 'my-book-showroom' ); ?></option>
							<option value="true"><?php esc_html_e( 'Yes', 'my-book-showroom' ); ?></option>
						</select>
					</div>
				</div>
			</div>

			<div class="mbs-builder-preview">
				<code class="mbs-builder-output"></code>
				<button type="button" class="button button-primary mbs-copy-btn"><?php esc_html_e( 'Copy', 'my-book-showroom' ); ?></button>
			</div>
		</form>
	</div>

</div>
