<?php
/**
 * FAQ Page — Gmind Institute
 *
 * Frequently asked questions with category tabs/filters,
 * accordion items, and a contact CTA at bottom.
 *
 * Expected PHP variables:
 *   $faqs        — array of FAQ records
 *   $categories  — array of FAQ categories
 *   $currentCat  — string current category filter (optional)
 *   $csrfToken   — CSRF token string
 *   $currentPage — string 'faq'
 *   $title       — page title
 */

$faqs       = $faqs       ?? [];
$categories = $categories ?? ['general', 'courses', 'admission', 'exam', 'certificate'];
$currentCat = $currentCat ?? 'all';
?>

<?php include __DIR__ . '/../layouts/header.php'; ?>

<!-- ============================================================
     Page Banner
     ============================================================ -->
<section class="page-banner" aria-label="Page heading">
    <div class="container">
        <h1>Frequently Asked Questions</h1>
        <p>Find answers to common queries about our courses, admissions, exams, and more</p>
        <nav class="breadcrumb" aria-label="Breadcrumb">
            <a href="<?= url('/') ?>">Home</a>
            <span aria-hidden="true">/</span>
            <span>FAQ</span>
        </nav>
    </div>
</section>

<!-- ============================================================
     FAQ Section
     ============================================================ -->
<section class="faq-page-section section-white" aria-label="FAQs">
    <div class="container">
        <!-- Category Tabs -->
        <div class="course-filters faq-category-filters" role="tablist" aria-label="Filter FAQs by category">
            <a href="<?= url('/faq') ?>" class="course-filter-btn<?= $currentCat === 'all' ? ' active' : '' ?>" role="tab" aria-selected="<?= $currentCat === 'all' ? 'true' : 'false' ?>">All</a>
            <?php foreach ($categories as $cat): ?>
            <a href="<?= url('/faq') ?>?category=<?= htmlspecialchars($cat, ENT_QUOTES, 'UTF-8') ?>" class="course-filter-btn<?= $currentCat === $cat ? ' active' : '' ?>" role="tab" aria-selected="<?= $currentCat === $cat ? 'true' : 'false' ?>">
                <?= htmlspecialchars(ucfirst($cat), ENT_QUOTES, 'UTF-8') ?>
            </a>
            <?php endforeach; ?>
        </div>

        <!-- FAQ Accordion -->
        <div class="faq-list faq-page-list">
            <?php if (!empty($faqs)): ?>
                <?php foreach ($faqs as $faq): ?>
                <details class="faq-item">
                    <summary>
                        <?= htmlspecialchars($faq['question'] ?? 'Question', ENT_QUOTES, 'UTF-8') ?>
                        <span class="faq-chevron" aria-hidden="true"></span>
                    </summary>
                    <div class="faq-answer">
                        <?= htmlspecialchars($faq['answer'] ?? '', ENT_QUOTES, 'UTF-8') ?>
                    </div>
                </details>
                <?php endforeach; ?>
            <?php else: ?>
                <!-- Fallback FAQs -->
                <details class="faq-item" open>
                    <summary>
                        What courses does Gmind Institute offer?
                        <span class="faq-chevron" aria-hidden="true"></span>
                    </summary>
                    <div class="faq-answer">
                        Gmind Institute offers a wide range of computer courses including ADCA, DCA, Tally Prime, Python Programming, Web Design, Graphic Design, CCC, Java Full Stack, and Digital Marketing. Each course is designed with industry-relevant curriculum and government-recognised certification.
                    </div>
                </details>
                <details class="faq-item">
                    <summary>
                        Is Gmind Institute government recognised?
                        <span class="faq-chevron" aria-hidden="true"></span>
                    </summary>
                    <div class="faq-answer">
                        Yes, Gmind Institute is a government-recognised computer education institute. All our courses come with valid certifications that are accepted across India for both employment and further education purposes.
                    </div>
                </details>
                <details class="faq-item">
                    <summary>
                        How do I enroll in a course?
                        <span class="faq-chevron" aria-hidden="true"></span>
                    </summary>
                    <div class="faq-answer">
                        You can enroll online through our Admission page or visit your nearest Gmind Institute branch. Our counsellors will guide you through the course selection and enrollment process. You will need to fill out the admission form, submit required documents, and pay the course fee.
                    </div>
                </details>
                <details class="faq-item">
                    <summary>
                        Does Gmind Institute provide job placement?
                        <span class="faq-chevron" aria-hidden="true"></span>
                    </summary>
                    <div class="faq-answer">
                        Yes, we provide 100% job placement assistance to all our students. Our dedicated placement cell works with top companies across India to help students find suitable employment after course completion.
                    </div>
                </details>
                <details class="faq-item">
                    <summary>
                        Can I pay the course fee in instalments?
                        <span class="faq-chevron" aria-hidden="true"></span>
                    </summary>
                    <div class="faq-answer">
                        Yes, Gmind Institute offers flexible payment options. You can pay the course fee in easy instalments. We accept payments via cash, UPI, and bank transfer. Contact your nearest branch for specific instalment plans.
                    </div>
                </details>
                <details class="faq-item">
                    <summary>
                        How does the Online Exam Portal work?
                        <span class="faq-chevron" aria-hidden="true"></span>
                    </summary>
                    <div class="faq-answer">
                        Our Online Exam Portal allows students to practise and appear for exams digitally. After enrolling in a course, you will receive login credentials. You can take practice exams and final assessments online from anywhere, with instant results and performance analytics.
                    </div>
                </details>
            <?php endif; ?>
        </div>
    </div>
</section>

<!-- ============================================================
     Contact CTA Section
     ============================================================ -->
<section class="faq-cta-section section-navy" aria-label="Still have questions">
    <div class="container">
        <div class="faq-cta-content">
            <h2>Still Have Questions?</h2>
            <p>Our team is here to help. Reach out to us and we'll get back to you as soon as possible.</p>
            <div class="faq-cta-buttons">
                <a href="<?= url('/contact') ?>" class="btn-primary" style="background-color:#ffffff;color:#1a4fa0;">Contact Us</a>
                <a href="tel:9305640290" class="btn-outline-white">
                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.5 19.5 0 01-6-6 19.79 19.79 0 01-3.07-8.67A2 2 0 014.11 2h3a2 2 0 012 1.72c.127.96.361 1.903.7 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0122 16.92z"/></svg>
                    Call: 9305640290
                </a>
            </div>
        </div>
    </div>
</section>

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