<?php
/**
 * Upsell notice partial
 *
 * @package SlideMind
 * @since 2.1.0
 *
 * @var string $required_plan  Plan slug (dialogue, memory, pro, agency, dialogue+memory)
 * @var string $feature_label  Human-readable feature name (already translated)
 * @var string $message        Optional custom message (already translated)
 */

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

$required_plan = $required_plan ?? 'pro';
$feature_label = $feature_label ?? '';
$message       = $message ?? '';

$compound_labels = [
    'dialogue+memory' => __('Pro', 'slidemind'),
];
$plan_label = $compound_labels[$required_plan] ?? ucfirst($required_plan);
$upgrade_url   = \SlideMind\Core\FeatureGate::get_upgrade_url();
?>
<div class="sm-upsell-card">
    <div class="sm-upsell-card-content">
        <p class="sm-upsell-card-text">
            <?php
            if (!empty($message)) {
                echo esc_html($message);
            } elseif (!empty($feature_label)) {
                echo wp_kses(
                    sprintf(
                        /* translators: 1: feature name (bold), 2: plan name */
                        __('%1$s requires the %2$s plan.', 'slidemind'),
                        '<strong>' . esc_html($feature_label) . '</strong>',
                        esc_html($plan_label)
                    ),
                    ['strong' => []]
                );
            }
            ?>
        </p>
        <?php if ($upgrade_url) : ?>
            <a href="<?php echo esc_url($upgrade_url); ?>" class="sm-btn sm-btn-primary sm-btn-sm">
                <?php esc_html_e('View Plans & Pricing', 'slidemind'); ?>
            </a>
        <?php endif; ?>
    </div>
</div>
