<?php
require_once __DIR__ . '/includes/functions.php';
$settings = getSettings();
$faqs = getData('faq');

$pageTitle = $settings['seo_faq_title'];
$pageDesc = $settings['seo_faq_desc'];

include __DIR__ . '/includes/header.php';
?>

<section class="page-hero">
    <div class="container">
        <span class="section-label">Help</span>
        <h1 class="section-title">Frequently Asked Questions</h1>
        <nav class="breadcrumb-nav mt-2">
            <a href="<?php echo BASE_URL; ?>/index.php">Home</a>
            <span>/</span>
            FAQ
        </nav>
    </div>
</section>

<section class="section">
    <div class="container">
        <?php if (!empty($faqs)): ?>
        <div class="row justify-content-center reveal">
            <div class="col-lg-8">
                <div class="accordion" id="faqAccordion">
                    <?php foreach ($faqs as $index => $faq): ?>
                    <div class="accordion-item">
                        <h2 class="accordion-header">
                            <button class="accordion-button <?php echo $index > 0 ? 'collapsed' : ''; ?>" type="button" data-bs-toggle="collapse" data-bs-target="#faq<?php echo $faq['id']; ?>">
                                <?php echo e($faq['question']); ?>
                            </button>
                        </h2>
                        <div id="faq<?php echo $faq['id']; ?>" class="accordion-collapse collapse <?php echo $index === 0 ? 'show' : ''; ?>" data-bs-parent="#faqAccordion">
                            <div class="accordion-body">
                                <?php echo nl2br(e($faq['answer'])); ?>
                            </div>
                        </div>
                    </div>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>
        <?php else: ?>
        <div class="empty-state">
            <span class="empty-state-icon">❓</span>
            <p>FAQ content will be added soon.</p>
        </div>
        <?php endif; ?>
    </div>
</section>

<section class="section-alt">
    <div class="container">
        <div class="row justify-content-center reveal">
            <div class="col-lg-8">
                <div class="section-card text-center">
                    <h3 style="font-family:var(--font-heading);font-size:1.1rem;text-transform:uppercase;color:var(--text-dark);margin-bottom:0.75rem;">Still Have Questions?</h3>
                    <p style="font-size:0.9rem;color:var(--text-secondary);margin-bottom:1.25rem;">Our team is happy to help with any questions about exhibiting, visiting, or attending Ethiopia Food Expo 2026.</p>
                    <a href="<?php echo BASE_URL; ?>/contact.php" class="btn-green me-2 mb-2">Contact Us</a>
                    <a href="https://wa.me/<?php echo e($settings['whatsapp']); ?>" class="btn-outline-green mb-2" target="_blank">WhatsApp</a>
                </div>
            </div>
        </div>
    </div>
</section>

<?php include __DIR__ . '/includes/footer.php'; ?>
