<?php
/**
 * Pro themes grid + activation redirect.
 *
 * @package soledad-blog-lite
 */

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

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

	return array(
		array(
			'title' => __( 'Auto Parts Shop WordPress Theme', 'soledad-blog-lite' ),
			'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', 'soledad-blog-lite' ),
			'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', 'soledad-blog-lite' ),
			'image' => $image_uri . 'Auto-Parts-WooCommerce-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/auto-parts-wordpress-theme/',
		),
		array(
			'title' => __( 'Nusa Business Consulting Theme', 'soledad-blog-lite' ),
			'image' => $image_uri . 'Business-Consulting-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/nusa-business-consulting-wordpress-theme/',
		),
		array(
			'title' => __( 'Construction Building Theme', 'soledad-blog-lite' ),
			'image' => $image_uri . 'Construction-Building-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/construction-and-building-wordpress-theme/',
		),
		array(
			'title' => __( 'Constructo Construction Theme', 'soledad-blog-lite' ),
			'image' => $image_uri . 'Constructo-Construction-WordPress-Theme.jpg',
			'url'   => 'https://www.templatehouse.net/themes/constructo-construction-wordpress-theme/',
		),
		array(
			'title' => __( 'Grocery Store WooCommerce Theme', 'soledad-blog-lite' ),
			'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', 'soledad-blog-lite' ),
			'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', 'soledad-blog-lite' ),
			'image' => $image_uri . 'info-1.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/food-menu-ordering-for-woocommerce/',
		),
		array(
			'title' => __( 'Soledad Personal Blog Theme', 'soledad-blog-lite' ),
			'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', 'soledad-blog-lite' ),
			'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', 'soledad-blog-lite' ),
			'image' => $image_uri . 'Timelinex-ai-Story-Timeline-Builder.jpg',
			'url'   => 'https://www.templatehouse.net/plugins/ai-story-timeline-builder-for-wordpress/',
		),
	);
}

function soledad_blog_lite_render_pro_themes_section() {
	$pro_themes = soledad_blog_lite_get_pro_themes();
	?>
	<div class="pro-themes-section">
		<h2 class="pro-themes-heading"><?php esc_html_e( 'Our Pro Themes & Plugins', 'soledad-blog-lite' ); ?></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.', 'soledad-blog-lite' ); ?></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 soledad_blog_lite_enqueue_pro_themes_assets( $hook ) {
	wp_enqueue_style(
		'soledad-blog-lite-pro-themes',
		get_template_directory_uri() . '/assets/css/pro-themes.css',
		array(),
		wp_get_theme()->get( 'Version' )
	);
}
add_action( 'admin_enqueue_scripts', 'soledad_blog_lite_enqueue_pro_themes_assets' );
