<?php

defined( 'ABSPATH' ) || exit;
/**
 * Specs Highlights template part — horizontal bar with key specs + taxonomy icons.
 *
 * Expected variables (via extract in getTemplatePart):
 * @var array  $items  Array of spec items: [ ['icon' => html, 'label' => string, 'value' => string], ... ]
 * @var string $title  Section title (default: 'Technical Specifications').
 *
 * @package ThemeREX\AutoDealer
 */

if ( empty( $items ) ) {
	return;
}

$title = $title ?? __( 'Technical Specifications', 'trx-auto-dealer' );
?>
<div class="trx-ad-specs-highlights">
	<?php if ( '' !== $title ) : ?>
		<h2 class="trx-ad-specs-highlights__title"><?php echo esc_html( $title ); ?></h2>
	<?php endif; ?>

	<div class="trx-ad-specs-highlights__grid">
		<?php foreach ( $items as $item ) : ?>
			<div class="trx-ad-specs-highlights__item">
				<?php if ( ! empty( $item['icon'] ) ) : ?>
					<span class="trx-ad-specs-highlights__icon">
						<?php echo wp_kses( $item['icon'], \ThemeREX\AutoDealer\allowedHtml() ); ?>
					</span>
				<?php endif; ?>
				<span class="trx-ad-specs-highlights__text">
					<span class="trx-ad-specs-highlights__label"><?php echo esc_html( $item['label'] ); ?></span>
					<span class="trx-ad-specs-highlights__value"><?php echo esc_html( $item['value'] ); ?></span>
				</span>
			</div>
		<?php endforeach; ?>
	</div>
</div>
