<?php
/**
 * Pro themes grid + activation redirect.
 *
 * @package nas-organic-food-store
 */

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

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

	return array(
		array(
			'title' => __( 'Auto Parts Shop WordPress Theme', 'nas-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'image' => $image_uri . 'info-1.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/food-menu-ordering-for-woocommerce/',
		),
		array(
			'title' => __( 'Soledad Personal Blog Theme', 'nas-organic-food-store' ),
			'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-organic-food-store' ),
			'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-organic-food-store' ),
			'image' => $image_uri . 'Timelinex-ai-Story-Timeline-Builder.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/ai-story-timeline-builder-for-wordpress/',
		),
	);
}

function nas_organic_food_store_render_pro_themes_section() {
	$pro_themes = nas_organic_food_store_get_pro_themes();
	?>
	<div class="pro-themes-section">
		<h2 class="pro-themes-heading"><?php esc_html_e( 'Our Pro Themes & Plugins', 'nas-organic-food-store' ); ?></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-organic-food-store' ); ?></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_organic_food_store_enqueue_pro_themes_assets( $hook ) {
	wp_enqueue_style(
		'nas-organic-food-store-pro-themes',
		get_template_directory_uri() . '/assets/css/pro-themes.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);
}
add_action( 'admin_enqueue_scripts', 'nas_organic_food_store_enqueue_pro_themes_assets' );
