<?php
/** Title: Campaign Rewards (Horizontal)
 * Slug: crowdfunding-platform/campaign-rewards-horizontal
 * Categories: call-to-action, crowdfunding_platform
 * Description: Display reward tiers for crowdfunding campaigns in a compact horizontal layout
 */

// Rewards section data - can be filtered by plugins for dynamic content  
$rewards_data = array(
    'title'       => apply_filters( 'crowdfunding_platform_rewards_section_title', __( 'Select Your Support Level', 'crowdfunding-platform' ) ),
    'description' => apply_filters( 'crowdfunding_platform_rewards_section_description', __( 'Choose your reward level and help make this project a reality.', 'crowdfunding-platform' ) ),
    'rewards'     => apply_filters( 'crowdfunding_platform_campaign_rewards', array() ),
);
?>

<!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var(--wp--preset--spacing--60)","bottom":"var(--wp--preset--spacing--60)"}}},"backgroundColor":"base","layout":{"type":"constrained"},"className":"crowdfunding-dynamic-rewards"} -->
<div class="wp-block-group alignfull has-base-background-color has-background crowdfunding-dynamic-rewards" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60)">

	<!-- wp:heading {"textAlign":"center","style":{"spacing":{"margin":{"bottom":"var(--wp--preset--spacing--20)"}}},"fontSize":"biggest"} -->
	<h2 class="wp-block-heading has-text-align-center has-biggest-font-size" style="margin-bottom:var(--wp--preset--spacing--20)"><?php echo esc_html( $rewards_data['title'] ); ?></h2>
	<!-- /wp:heading -->

	<!-- wp:paragraph {"align":"center","style":{"spacing":{"margin":{"bottom":"var(--wp--preset--spacing--50)"}}},"textColor":"secondary"} -->
	<p class="has-text-align-center has-secondary-color has-text-color" style="margin-bottom:var(--wp--preset--spacing--50)"><?php echo esc_html( $rewards_data['description'] ); ?></p>
	<!-- /wp:paragraph -->

	<!-- wp:group {"align":"wide","layout":{"type":"flex","flexWrap":"wrap","justifyContent":"center"}} -->
	<div class="wp-block-group alignwide">

		<?php if ( !empty( $rewards_data['rewards'] ) ) : ?>
			<?php foreach ( $rewards_data['rewards'] as $index => $reward ) : ?>

		<!-- wp:group {"borderColor":"secondary","backgroundColor":"accent-5","layout":{"type":"default"},"className":"pattern-reward-card<?php echo esc_attr( $reward->css_class ); ?>"<?php if ( $index > 0 ) : ?> style="margin-left:var(--wp--preset--spacing--30)"<?php endif; ?>} -->
		<div class="wp-block-group has-border-color has-secondary-border-color has-accent-5-background-color has-background pattern-reward-card<?php echo esc_attr( $reward->css_class ); ?>"<?php if ( $index > 0 ) : ?> style="margin-left:var(--wp--preset--spacing--30)"<?php endif; ?>>
			
			<!-- wp:heading {"level":3,"textAlign":"center","style":{"typography":{"fontWeight":"700"}},"textColor":"contrast","fontSize":"biggest"} -->
			<h3 class="wp-block-heading has-text-align-center has-contrast-color has-text-color has-biggest-font-size" style="font-weight:700"><?php echo esc_html( $reward->price ); ?></h3>
			<!-- /wp:heading -->
			
			<!-- wp:heading {"level":4,"textAlign":"center","style":{"spacing":{"margin":{"top":"var(--wp--preset--spacing--20)","bottom":"var(--wp--preset--spacing--20)"}}},"textColor":"contrast","fontSize":"big"} -->
			<h4 class="wp-block-heading has-text-align-center has-contrast-color has-text-color has-big-font-size" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><?php echo esc_html( $reward->title ); ?></h4>
			<!-- /wp:heading -->
			
			<!-- wp:paragraph {"align":"center","style":{"typography":{"fontWeight":"500"}},"textColor":"secondary","fontSize":"tiny"} -->
			<p class="has-text-align-center has-secondary-color has-text-color has-tiny-font-size" style="font-weight:500"><?php
				/* translators: %s: number of backers */
				printf( esc_html__( '%s backers', 'crowdfunding-platform' ), esc_html( $reward->backers ) );
			?></p>
			<!-- /wp:paragraph -->
			
			<!-- wp:paragraph {"align":"center","textColor":"accent","fontSize":"tiny","style":{"spacing":{"margin":{"top":"var(--wp--preset--spacing--20)","bottom":"var(--wp--preset--spacing--20)"}}}} -->
			<p class="has-text-align-center has-accent-color has-text-color has-tiny-font-size" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)"><?php echo esc_html( $reward->availability_text ); ?></p>
			<!-- /wp:paragraph -->
			
			<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
			<div class="wp-block-buttons">
				<!-- wp:button {"width":100} -->
				<div class="wp-block-button has-custom-width wp-block-button__width-100"><?php echo wp_kses_post( $reward->button_html ); ?></div>
				<!-- /wp:button -->
			</div>
			<!-- /wp:buttons -->
			
		</div>
		<!-- /wp:group -->
		
			<?php endforeach; ?>
		<?php else : ?>
			<!-- wp:pattern {"slug":"crowdfunding-platform/reward-card-standard-horizontal"} /-->

			<!-- wp:pattern {"slug":"crowdfunding-platform/reward-card-featured-horizontal"} /-->

			<!-- wp:pattern {"slug":"crowdfunding-platform/reward-card-custom-horizontal"} /-->
		<?php endif; ?>

	</div>
	<!-- /wp:group -->

</div>
<!-- /wp:group -->