<?php
/**
 * Shared admin FAQ section.
 *
 * @package FoodOrd
 */

defined('ABSPATH') || exit;

if (!function_exists('foodord_admin_render_faq_section')) {
	/**
	 * Render the shared FAQ section for FoodOrd admin pages.
	 *
	 * @param string $context Admin page context used for modifier classes and heading IDs.
	 */
	function foodord_admin_render_faq_section(string $context = 'default'): void
	{
		$context = sanitize_html_class($context);
		if ('' === $context) {
			$context = 'default';
		}

		$title_id = 'foodord-admin-faq-title-' . $context;
		$contact_url = 'https://www.foodord.com/contact-us/';
		$subscription_answer = __('Yes. You can cancel your subscription at any time. There is no contract or long-term agreement.', 'foodord');
		$support_url = 'https://www.foodord.com/support/';
		?>
		<section class="foodord-admin-faq foodord-admin-faq--<?php echo esc_attr($context); ?>" aria-labelledby="<?php echo esc_attr($title_id); ?>">
			<h2 id="<?php echo esc_attr($title_id); ?>" class="foodord-admin-faq__title">
				<?php echo esc_html__('Frequently Asked Questions', 'foodord'); ?>
			</h2>

			<div class="foodord-admin-faq__grid">
				<article class="foodord-admin-faq__item">
					<h3 class="foodord-admin-faq__question"><?php echo esc_html__('Can you make FoodOrd work with my existing WordPress theme?', 'foodord'); ?></h3>
					<div class="foodord-admin-faq__answer">
						<p class="foodord-admin-faq__text">
							<?php echo esc_html__('Yes. If you already have your own WordPress theme, we can adapt it to work properly with the FoodOrd plugin. This customization service is not included for free and requires an additional fee. Please contact us through the', 'foodord'); ?>
							<a href="<?php echo esc_url($contact_url); ?>" target="_blank" rel="noopener noreferrer">
								<?php echo esc_html__('contact page', 'foodord'); ?>
							</a>
							<?php echo esc_html__('so we can review your website and provide more details.', 'foodord'); ?>
						</p>
					</div>
				</article>

				<article class="foodord-admin-faq__item">
					<h3 class="foodord-admin-faq__question"><?php echo esc_html__('Do you offer a complete setup service for non-technical users?', 'foodord'); ?></h3>
					<div class="foodord-admin-faq__answer">
						<p class="foodord-admin-faq__text">
							<?php echo esc_html__('Yes. If you are not familiar with WordPress, plugins, themes, or technical setup, we can prepare everything for you and deliver a ready-to-use FoodOrd system. This setup service requires an additional fee. Please contact us through the', 'foodord'); ?>
							<a href="<?php echo esc_url($contact_url); ?>" target="_blank" rel="noopener noreferrer">
								<?php echo esc_html__('contact page', 'foodord'); ?>
							</a>
							<?php echo esc_html__('so we can discuss your needs and provide more information.', 'foodord'); ?>
						</p>
					</div>
				</article>

				<article class="foodord-admin-faq__item">
					<h3 class="foodord-admin-faq__question"><?php echo esc_html__('Can I cancel my subscription at any time?', 'foodord'); ?></h3>
					<div class="foodord-admin-faq__answer">
						<p class="foodord-admin-faq__text"><?php echo esc_html($subscription_answer); ?></p>
					</div>
				</article>

				<article class="foodord-admin-faq__item">
					<h3 class="foodord-admin-faq__question"><?php echo esc_html__('I have other pre-sale questions, can you help?', 'foodord'); ?></h3>
					<div class="foodord-admin-faq__answer">
						<p class="foodord-admin-faq__text">
							<?php echo esc_html__('Yes! You can ask us any question through our', 'foodord'); ?>
							<a href="<?php echo esc_url($support_url); ?>" target="_blank" rel="noopener noreferrer">
								<?php echo esc_html__('support page', 'foodord'); ?>
							</a>.
						</p>
					</div>
				</article>
			</div>
		</section>
		<?php
	}
}
