<?php
/**
 * Blog Over Pro Feature Cards — Customizer Notices
 *
 * Registers contextual Pro feature cards in every relevant Customizer section.
 * Each card lists the REAL features unlocked by Blog Over Pro for that section.
 *
 * WordPress.org compliant:
 *  - No disabled controls, no locked UI, no trialware.
 *  - Purely informational notices with an external link.
 *  - All cards removed automatically when Blog Over Pro plugin is active.
 *
 * @package Blog_Over
 * @since   2.2.0
 */

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

/**
 * Register section-specific Pro feature cards in the Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function blog_over_register_pro_info_notices( $wp_customize ) {

	// Remove all Pro cards if Pro plugin is active — real controls take over.
	if ( blog_over_is_pro_active() ) {
		return;
	}

	// Load both control classes.
	require_once BLOG_OVER_DIR . '/inc/controls/class-blog-over-pro-feature-control.php';
	require_once BLOG_OVER_DIR . '/inc/controls/class-blog-over-pro-card-control.php';

	$pro_url = 'https://awplife.com/wordpress-themes/blog-over/';

	/**
	 * Section definitions.
	 *
	 * Each entry: section_id => array(
	 *   'label'    => Human-readable section name,
	 *   'features' => Real Pro features from class-blog-over-pro-customizer.php,
	 * )
	 *
	 * Features are verified against Blog Over Pro v2.2.0.
	 */
	$sections = array(

		// ── Header: Menu Settings ────────────────────────────────────────────
		'blog_over_menu_section' => array(
			'label'    => __( 'Menu & Header', 'blog-over' ),
			'features' => array(
				__( 'Menu Layout 2 — Centered Logo', 'blog-over' ),
				__( 'Menu Layout 3 — Split Navigation', 'blog-over' ),
				__( 'Sticky Header (smart scroll-based)', 'blog-over' ),
				__( 'Menu Height control (50 – 150 px)', 'blog-over' ),
				__( 'Hover Effects: Underline, Overline, Background Block', 'blog-over' ),
				__( 'Submenu Animation: Fade, Slide Up, Zoom In', 'blog-over' ),
			),
		),

		// ── Header: Announcement Bar ─────────────────────────────────────────
		'blog_over_announcement_bar_section' => array(
			'label'    => __( 'Announcement Bar', 'blog-over' ),
			'features' => array(
				__( 'Unlimited Announcement Bars (Free: max 1)', 'blog-over' ),
				__( '3 Design Layouts (Classic, Gradient Wave, Split Highlight)', 'blog-over' ),
				__( 'Auto-rotation with configurable interval', 'blog-over' ),
				__( 'Sticky mode & Dismiss buttons', 'blog-over' ),
				__( 'Entrance Animations', 'blog-over' ),
			),
		),

		// ── Header: Search Settings ──────────────────────────────────────────
		'blog_over_search_section' => array(
			'label'    => __( 'Search', 'blog-over' ),
			'features' => array(
				__( 'Inline Expand Search style', 'blog-over' ),
				__( 'Slide Panel (Left → Right)', 'blog-over' ),
				__( 'Slide Panel (Right → Left)', 'blog-over' ),
			),
		),

		// ── Front Page: Ticker ───────────────────────────────────────────────
		'blog_over_ticker_section' => array(
			'label'    => __( 'News Ticker', 'blog-over' ),
			'features' => array(
				__( 'Category-based ticker source', 'blog-over' ),
				__( 'Right (→) scroll direction', 'blog-over' ),
				__( 'Ticker Layout: Minimal', 'blog-over' ),
				__( 'Ticker Layout: Pill / Rounded', 'blog-over' ),
				__( 'Ticker Layout: Gradient Alert', 'blog-over' ),
				__( 'Ticker Layout: Spotlight (circular thumbs)', 'blog-over' ),
			),
		),

		// ── Front Page: Hero Slider ──────────────────────────────────────────
		'blog_over_hero_section' => array(
			'label'    => __( 'Hero Slider', 'blog-over' ),
			'features' => array(
				__( 'Fade slide transition effect', 'blog-over' ),
				__( 'Zoom slide transition effect', 'blog-over' ),
			),
		),

		// ── Front Page: Featured Links ───────────────────────────────────────
		'blog_over_featured_section' => array(
			'label'    => __( 'Featured Links', 'blog-over' ),
			'features' => array(
				__( 'Diagonal Split layout ⚡', 'blog-over' ),
				__( 'Up to 8 featured links (vs 4 in Free)', 'blog-over' ),
			),
		),

		// ── Front Page: Big Feature Story ────────────────────────────────────
		'blog_over_feature_story_section' => array(
			'label'    => __( 'Big Feature Story', 'blog-over' ),
			'features' => array(
				__( 'Custom Image upload (override post image)', 'blog-over' ),
				__( 'Video background — YouTube URL', 'blog-over' ),
				__( 'Video background — Vimeo URL', 'blog-over' ),
				__( 'Video background — Self-hosted MP4', 'blog-over' ),
			),
		),

		// ── Front Page: Tabbed Magazine ──────────────────────────────────────
		'blog_over_tabbed_magazine_section' => array(
			'label'    => __( 'Tabbed Magazine', 'blog-over' ),
			'features' => array(
				__( 'Up to 8 tabs (Free: max 3)', 'blog-over' ),
				__( 'Grid Columns: 2, 3, or 4 columns', 'blog-over' ),
				__( 'Tabs Position: Left, Center, Right', 'blog-over' ),
				__( 'Card Style: Overlay', 'blog-over' ),
				__( 'Card Style: Minimal', 'blog-over' ),
			),
		),

		// ── Front Page: You Missed ───────────────────────────────────────────
		'blog_over_missed_section' => array(
			'label'    => __( 'You Missed', 'blog-over' ),
			'features' => array(
				__( 'Modern layout style', 'blog-over' ),
				__( 'Overlay layout style', 'blog-over' ),
				__( 'Column options: 2, 3, 4, or 6', 'blog-over' ),
			),
		),

		// ── Front Page: Advertisement Banners ────────────────────────────────
		'blog_over_advertisement_section' => array(
			'label'    => __( 'Advertisement Banners', 'blog-over' ),
			'features' => array(
				__( 'Unlimited banners (Free: only 1)', 'blog-over' ),
				__( 'Banner Layout: Split, Overlay, Strip', 'blog-over' ),
				__( 'Banner Layout: Sponsored, Cinematic', 'blog-over' ),
				__( '7 placement zones across the full site', 'blog-over' ),
				__( 'Custom HTML / Google AdSense support', 'blog-over' ),
				__( 'Separate mobile image per banner', 'blog-over' ),
				__( 'Dismiss button + page visibility rules', 'blog-over' ),
			),
		),

		// ── Blog Panel: Blog Settings ────────────────────────────────────────
		'Blog_Over_section' => array(
			'label'    => __( 'Blog Settings', 'blog-over' ),
			'features' => array(
				__( 'Infinite Scroll (AJAX Load More)', 'blog-over' ),
				__( 'Blog Image Ratio: Square, Landscape, Wide, Portrait', 'blog-over' ),
				__( 'Editorial (Z-Pattern) Blog Layout', 'blog-over' ),
			),
		),

		// ── Blog Panel: Single Post ──────────────────────────────────────────
		'blog_over_single_section' => array(
			'label'    => __( 'Single Post', 'blog-over' ),
			'features' => array(
				__( 'Reading Progress Bar (Top of Screen)', 'blog-over' ),
				__( 'Estimated Reading Time Display', 'blog-over' ),
				__( 'Floating Social Share Bar', 'blog-over' ),
			),
		),

		// ── Blog Panel: Author Box ───────────────────────────────────────────
		'blog_over_author_box_section' => array(
			'label'    => __( 'Author Box', 'blog-over' ),
			'features' => array(
				__( 'Centered style', 'blog-over' ),
				__( 'Minimal style', 'blog-over' ),
				__( 'Glassmorphism style', 'blog-over' ),
				__( 'Gradient style', 'blog-over' ),
			),
		),

		// ── Blog Panel: Post Navigation ──────────────────────────────────────
		'blog_over_postnav_section' => array(
			'label'    => __( 'Post Navigation', 'blog-over' ),
			'features' => array(
				__( 'Simple style', 'blog-over' ),
				__( 'Full Width style', 'blog-over' ),
				__( 'Minimal style', 'blog-over' ),
				__( 'Gradient style', 'blog-over' ),
				__( 'Glassmorphism style', 'blog-over' ),
			),
		),

		// ── Blog Panel: Related Posts ─────────────────────────────────────────
		'blog_over_related_section' => array(
			'label'    => __( 'Related Posts', 'blog-over' ),
			'features' => array(
				__( 'Filter by Tags', 'blog-over' ),
				__( 'Random posts', 'blog-over' ),
				__( 'Custom Category filter', 'blog-over' ),
				__( 'Custom Tag filter', 'blog-over' ),
			),
		),

		// ── Sidebar ───────────────────────────────────────────────────────────
		'blog_over_sidebar_section' => array(
			'label'    => __( 'Sidebar', 'blog-over' ),
			'features' => array(
				__( 'Widget Title: Underline style', 'blog-over' ),
				__( 'Widget Title: Accent Bar style', 'blog-over' ),
				__( 'Widget Title: Background style', 'blog-over' ),
				__( 'Widget Title: Bordered style', 'blog-over' ),
			),
		),

		// ── Loading Screen ────────────────────────────────────────────────────
		'blog_over_loading_screen_section' => array(
			'label'    => __( 'Loading Screen', 'blog-over' ),
			'features' => array(
				__( 'Bouncing Dots animation', 'blog-over' ),
				__( 'Pulse Circle animation', 'blog-over' ),
				__( 'Single Ring animation', 'blog-over' ),
				__( 'Animated Bars animation', 'blog-over' ),
				__( '3D Cube animation', 'blog-over' ),
			),
		),

		// ── Go to Top ─────────────────────────────────────────────────────────
		'blog_over_scrolltop_section' => array(
			'label'    => __( 'Go to Top', 'blog-over' ),
			'features' => array(
				__( 'Rocket icon style', 'blog-over' ),
				__( 'Additional icon options', 'blog-over' ),
			),
		),

		// ── Trending Posts Section ────────────────────────────────────────────
		'blog_over_trending_section' => array(
			'label'    => __( 'Trending Posts', 'blog-over' ),
			'features' => array(
				__( 'Card Grid layout — beautiful card-based trending posts', 'blog-over' ),
				__( 'Horizontal Scroll Strip layout', 'blog-over' ),
				__( 'Sort by: Most Viewed (view count tracking)', 'blog-over' ),
				__( 'Sort by: Recent Popular (last 7 days)', 'blog-over' ),
				__( 'Sort by: Random picks', 'blog-over' ),
				__( 'Time period filter: This Week / This Month / Last 30 Days', 'blog-over' ),
				__( 'Up to 3 columns for Card Grid layout', 'blog-over' ),
			),
		),

		// ── Newsletter / CTA Section ──────────────────────────────────────────
		'blog_over_newsletter_section' => array(
			'label'    => __( 'Newsletter / CTA', 'blog-over' ),
			'features' => array(
				__( 'Split layout — text on left, form on right', 'blog-over' ),
				__( 'Card layout — floating card with shadow', 'blog-over' ),
				__( 'Glassmorphism layout — frosted glass effect', 'blog-over' ),
				__( 'Background Image with custom overlay opacity', 'blog-over' ),
				__( 'Dark Glass background style', 'blog-over' ),
				__( 'Custom button color & border radius', 'blog-over' ),
			),
		),

		// ── Category Showcase Section ─────────────────────────────────────────
		'blog_over_catshowcase_section' => array(
			'label'    => __( 'Category Showcase', 'blog-over' ),
			'features' => array(
				__( 'Masonry layout — Pinterest-style dynamic heights', 'blog-over' ),
				__( 'List layout — text-first category list view', 'blog-over' ),
				__( 'Feature Grid — 1 large + small remaining tiles', 'blog-over' ),
				__( 'Minimal card style — clean text-only look', 'blog-over' ),
				__( 'Glassmorphism card style — frosted glass tiles', 'blog-over' ),
				__( 'Bordered card style — elegant outlined tiles', 'blog-over' ),
				__( 'Manually pick & reorder categories to display', 'blog-over' ),
				__( 'Custom icon per category', 'blog-over' ),
			),
		),

		// ── Frontpage Panel Promo Section ────────────────────────────────────
		'blog_over_frontpage_promo_section' => array(
			'label'    => __( '🚀 More Frontpage Sections', 'blog-over' ),
			'features' => array(
				__( 'Newsletter / CTA Section (Exclusive styles in Pro)', 'blog-over' ),
				__( 'Category Showcase (Masonry, List & Feature Grid)', 'blog-over' ),
				__( 'Advanced Tabbed Magazine (Up to 15 tabs)', 'blog-over' ),
				__( 'Advanced Trending Posts (Grid Layout & View Sorting)', 'blog-over' ),
				__( 'Plus: Unlimited Advertisement Banners', 'blog-over' ),
			),
		),

	);

	// Register dummy section for the frontpage panel promo
	$wp_customize->add_section(
		'blog_over_frontpage_promo_section',
		array(
			'title'    => __( '🌟 Unlock More Sections (Pro)', 'blog-over' ),
			'panel'    => 'blog_over_frontpage_panel',
			'priority' => 999,
		)
	);

	// Register a card control for each section.
	foreach ( $sections as $section_id => $data ) {
		$setting_id = 'blog_over_pro_card_' . $section_id;

		$wp_customize->add_setting(
			$setting_id,
			array(
				'sanitize_callback' => 'sanitize_text_field',
			)
		);

		$wp_customize->add_control(
			new Blog_Over_Pro_Card_Control(
				$wp_customize,
				$setting_id,
				array(
					'section'       => $section_id,
					'priority'      => 999,
					'section_label' => isset( $data['label'] ) ? $data['label'] : '',
					'features'      => isset( $data['features'] ) ? $data['features'] : array(),
					'pro_url'       => $pro_url,
				)
			)
		);
	}
}
add_action( 'customize_register', 'blog_over_register_pro_info_notices', 99 );
