<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/**
 * Storefront fallback shown when the free plan limit is reached and no Pro
 * license is active. No chat build is loaded here — only a light upgrade CTA.
 *
 * @var array $appearance
 */
$upgrade_url         = dc_v2_ls_checkout_url();
$upgrade_url_yearly  = dc_v2_ls_checkout_url_yearly();
$store_name          = get_bloginfo( 'name' );
$bg                  = $appearance['background'] ?? '#0b0b0f';
$fg                  = $appearance['foreground'] ?? '#f5f5f5';
$card                = $appearance['card'] ?? '#18181b';
$primary             = $appearance['primary'] ?? '#7c3aed';
$primary_fg          = $appearance['primary_foreground'] ?? '#ffffff';
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
	<meta name="robots" content="noindex,nofollow">
	<title><?php echo esc_html( $store_name ); ?></title>
	<style>
		:root{--bg:<?php echo esc_attr( $bg ); ?>;--fg:<?php echo esc_attr( $fg ); ?>;--card:<?php echo esc_attr( $card ); ?>;--primary:<?php echo esc_attr( $primary ); ?>;--primary-fg:<?php echo esc_attr( $primary_fg ); ?>;}
		*{box-sizing:border-box;}
		body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--bg);color:var(--fg);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;}
		.card{max-width:420px;width:100%;background:var(--card);border-radius:20px;padding:32px 26px;text-align:center;box-shadow:0 10px 40px rgba(0,0,0,.25);}
		.emoji{font-size:44px;line-height:1;margin-bottom:14px;}
		h1{font-size:20px;margin:0 0 10px;font-weight:700;}
		p{margin:0 0 22px;font-size:15px;line-height:1.55;opacity:.8;}
		.actions{display:flex;flex-direction:column;gap:10px;}
		.btn{display:inline-block;width:100%;padding:14px 18px;border-radius:12px;background:var(--primary);color:var(--primary-fg);font-weight:600;font-size:15px;text-decoration:none;}
		.btn--secondary{background:transparent;color:var(--fg);border:1.5px solid rgba(255,255,255,.28);}
		.btn[aria-disabled="true"]{opacity:.5;pointer-events:none;}
		.foot{margin-top:18px;font-size:12px;opacity:.55;}
		.foot a{color:inherit;}
	</style>
</head>
<body>
	<div class="card">
		<div class="emoji">🚀</div>
		<h1><?php echo esc_html__( 'This checkout is paused', 'order-from-dm' ); ?></h1>
		<p><?php echo esc_html__( 'This store reached the free plan limit. Upgrade to Order From DM Pro to keep receiving orders through chat.', 'order-from-dm' ); ?></p>
		<div class="actions">
			<?php if ( $upgrade_url ) : ?>
				<a class="btn btn--secondary" href="<?php echo esc_url( $upgrade_url ); ?>" target="_blank" rel="noopener"><?php echo esc_html__( 'Pro — $9/mo', 'order-from-dm' ); ?></a>
			<?php endif; ?>
			<?php if ( $upgrade_url_yearly ) : ?>
				<a class="btn" href="<?php echo esc_url( $upgrade_url_yearly ); ?>" target="_blank" rel="noopener"><?php echo esc_html__( 'Pro — $79/yr', 'order-from-dm' ); ?></a>
			<?php endif; ?>
			<?php if ( ! $upgrade_url && ! $upgrade_url_yearly ) : ?>
				<a class="btn" aria-disabled="true" href="#"><?php echo esc_html__( 'Upgrade to Pro', 'order-from-dm' ); ?></a>
			<?php endif; ?>
		</div>
		<p class="foot">
			<a href="<?php echo esc_url( dc_v2_powered_by_url() ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html( dc_v2_powered_by_label() ); ?></a>
		</p>
	</div>
</body>
</html>
