<?php
/**
 * CartCue — Integrations (Free tier).
 *
 * CRM and email platform connections are a Pro feature.
 *
 * @package CartCue\Admin
 */
defined( 'ABSPATH' ) || exit;

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template scope.

$platforms = [
	[
		'name' => 'FluentCRM',
		'desc' => __( 'Self-hosted CRM for WordPress', 'cartcue-sales-automation' ),
		'icon' => 'ap-int-icon--purple',
	],
	[
		'name' => 'Mailchimp',
		'desc' => __( 'Email marketing platform', 'cartcue-sales-automation' ),
		'icon' => 'ap-int-icon--yellow',
	],
	[
		'name' => 'ActiveCampaign',
		'desc' => __( 'Email marketing & CRM automation', 'cartcue-sales-automation' ),
		'icon' => 'ap-int-icon--green',
	],
	[
		'name' => 'Klaviyo',
		'desc' => __( 'Email & SMS marketing platform', 'cartcue-sales-automation' ),
		'icon' => 'ap-int-icon--pink',
	],
	[
		'name' => 'MailPoet',
		'desc' => __( 'Email newsletters for WordPress', 'cartcue-sales-automation' ),
		'icon' => 'ap-int-icon--blue',
	],
];
?>
<div class="ap-wrap">
	<div class="ap-page-header">
		<div>
			<h1 class="ap-page-title"><?php esc_html_e( 'Integrations', 'cartcue-sales-automation' ); ?></h1>
			<p class="ap-page-sub"><?php esc_html_e( 'Connect your CRM and email platforms. Active integrations appear as new actions in the automation editor.', 'cartcue-sales-automation' ); ?></p>
		</div>
		<a href="<?php echo esc_url( \CartCue\Plugin::upgrade_url( 'integrations' ) ); ?>" target="_blank" rel="noopener noreferrer" class="ap-btn ap-btn-primary">
			<?php esc_html_e( 'Upgrade to Pro →', 'cartcue-sales-automation' ); ?>
		</a>
	</div>

	<div class="ap-notice-card" style="margin-bottom:24px">
		<strong><?php esc_html_e( 'CRM sync is a Pro feature', 'cartcue-sales-automation' ); ?></strong>
		<p><?php esc_html_e( 'Upgrade to CartCue Pro to connect FluentCRM, Mailchimp, ActiveCampaign, Klaviyo, and MailPoet — then add subscribe, tag, and list actions directly in your automations.', 'cartcue-sales-automation' ); ?></p>
	</div>

	<div class="ap-integrations-grid">
		<?php foreach ( $platforms as $platform ) : ?>
		<div class="ap-int-card">
			<div class="ap-int-card__header">
				<div class="ap-int-icon <?php echo esc_attr( $platform['icon'] ); ?>">
					<i class="ti ti-plug-connected" aria-hidden="true"></i>
				</div>
				<div>
					<div class="ap-int-name"><?php echo esc_html( $platform['name'] ); ?></div>
					<div class="ap-int-desc"><?php echo esc_html( $platform['desc'] ); ?></div>
				</div>
				<div class="ap-int-status">
					<span class="ap-badge ap-badge--off"><?php esc_html_e( 'Pro', 'cartcue-sales-automation' ); ?></span>
				</div>
			</div>
			<div class="ap-int-card__body">
				<p class="ap-int-detail">
					<?php
					printf(
						/* translators: %s: integration platform name */
						esc_html__( 'Unlock %s actions in CartCue Pro.', 'cartcue-sales-automation' ),
						esc_html( $platform['name'] )
					);
					?>
				</p>
			</div>
		</div>
		<?php endforeach; ?>
	</div>
</div>
