<?php
/**
 * Pro themes grid + activation redirect.
 *
 * @package nas-construction-build
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

function nas_construction_build_get_pro_themes() {
	$image_uri = get_template_directory_uri() . '/assets/images/pro-theme/';

	return array(
		array(
			'title' => __( 'Auto Parts Shop WordPress Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Auto-Parts-Shop-WordPress-Elementor-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/auto-parts-woocommerce-theme/',
		),
		array(
			'title' => __( 'Motors Auto Parts Custom Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Motors-Auto-Parts-Custom-WooCommerce-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/auto-parts-custom-woocommerce-wordpress-theme/',
		),
		array(
			'title' => __( 'Auto Parts WooCommerce Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Auto-Parts-WooCommerce-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/auto-parts-wordpress-theme/',
		),
		array(
			'title' => __( 'Nusa Business Consulting Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Business-Consulting-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/nusa-business-consulting-wordpress-theme/',
		),
		array(
			'title' => __( 'Construction Building Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Construction-Building-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/construction-and-building-wordpress-theme/',
		),
		array(
			'title' => __( 'Constructo Construction Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Constructo-Construction-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/constructo-construction-wordpress-theme/',
		),
		array(
			'title' => __( 'Grocery Store WooCommerce Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Grocery-Store-and-Organic-Food-WooCommerce-eCommerce-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/grocery-store-wordpress-theme/',
		),
		array(
			'title' => __( 'HotelBooking Resort Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'HotelBooking-Hotel-and-Resort-Booking-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/hotelbooking-hotel-and-resort-booking-wordpress-theme/',
		),
		array(
			'title' => __( 'Food Menu Ordering Plugin', 'nas-construction-build' ),
			'image' => $image_uri . 'info-1.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/food-menu-ordering-for-woocommerce/',
		),
		array(
			'title' => __( 'Soledad Personal Blog Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'Soledad-Optimized-Personal-Blog-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/soledad-optimized-personal-blog-wordpress-theme/',
		),
		array(
			'title' => __( 'SpaciaN Real Estate Theme', 'nas-construction-build' ),
			'image' => $image_uri . 'SpaciaN-Real-Estate-Construction-Group-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/real-estate-and-construction-group-wordpress-theme/',
		),
		array(
			'title' => __( 'TimelineX AI Story Timeline Builder', 'nas-construction-build' ),
			'image' => $image_uri . 'Timelinex-ai-Story-Timeline-Builder.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/ai-story-timeline-builder-for-wordpress/',
		),
	);
}

function nas_construction_build_render_pro_themes_section() {
	$pro_themes = nas_construction_build_get_pro_themes();
	?>
	<div class="pro-themes-section">
		<h2 class="pro-themes-heading"><?php esc_html_e( 'Our Pro Themes & Plugins', 'nas-construction-build' ); ?></h2>
		<p class="pro-themes-intro"><?php esc_html_e( 'Explore our premium WordPress themes and plugins. Click any screenshot to view full details on our website.', 'nas-construction-build' ); ?></p>
		<div class="pro-themes-grid">
			<?php foreach ( $pro_themes as $pro_theme ) : ?>
				<a class="pro-theme-card" href="<?php echo esc_url( $pro_theme['url'] ); ?>" target="_blank" rel="noopener noreferrer">
					<span class="pro-theme-thumb">
						<img src="<?php echo esc_url( $pro_theme['image'] ); ?>" alt="<?php echo esc_attr( $pro_theme['title'] ); ?>" loading="lazy" />
					</span>
					<span class="pro-theme-title"><?php echo esc_html( $pro_theme['title'] ); ?></span>
				</a>
			<?php endforeach; ?>
		</div>
	</div>
	<?php
}

function nas_construction_build_enqueue_pro_themes_assets( $hook ) {
	wp_enqueue_style(
		'nas-construction-build-pro-themes',
		get_template_directory_uri() . '/assets/css/pro-themes.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);
}
add_action( 'admin_enqueue_scripts', 'nas_construction_build_enqueue_pro_themes_assets' );
