    <footer class="main-footer">
        <div class="container">
            <div class="footer-grid">
                <div class="footer-col">
                    <h4><?= htmlspecialchars($settings['site_name'] ?? 'Alpha Genomics') ?></h4>
                    <p><?= htmlspecialchars(substr($settings['about_text'] ?? '', 0, 200)) ?>...</p>
                    <div class="footer-social">
                        <a href="<?= htmlspecialchars($settings['facebook_url'] ?? '#') ?>" title="Facebook" target="_blank" rel="noopener"><i class="fab fa-facebook-f"></i></a>
                        <a href="<?= htmlspecialchars($settings['twitter_url'] ?? '#') ?>" title="Twitter" target="_blank" rel="noopener"><i class="fab fa-twitter"></i></a>
                        <a href="<?= htmlspecialchars($settings['linkedin_url'] ?? '#') ?>" title="LinkedIn" target="_blank" rel="noopener"><i class="fab fa-linkedin-in"></i></a>
                        <a href="<?= htmlspecialchars($settings['youtube_channel'] ?? '#') ?>" title="YouTube" target="_blank" rel="noopener"><i class="fab fa-youtube"></i></a>
                    </div>
                </div>
                <div class="footer-col">
                    <h4>Quick Links</h4>
                    <ul>
                        <li><a href="/">Home</a></li>
                        <li><a href="/about">About Us</a></li>
                        <li><a href="/services">Services</a></li>
                        <li><a href="/workshops">Workshops</a></li>
                        <li><a href="/articles">Library</a></li>
                        <li><a href="/contact">Contact</a></li>
                    </ul>
                </div>
                <div class="footer-col">
                    <h4>Our Sections</h4>
                    <ul>
                        <?php
                        $db = getDB();
                        $footerSections = $db->query("SELECT title, slug FROM sections WHERE active = TRUE ORDER BY sort_order ASC LIMIT 5")->fetchAll();
                        foreach ($footerSections as $fs): ?>
                        <li><a href="/section/<?= htmlspecialchars($fs['slug']) ?>"><?= htmlspecialchars($fs['title']) ?></a></li>
                        <?php endforeach; ?>
                    </ul>
                </div>
                <div class="footer-col">
                    <h4>Newsletter & Contact</h4>
                    <div class="footer-newsletter">
                        <p>Subscribe for the latest updates and research news.</p>
                        <form action="/newsletter/subscribe" method="post">
                            <?= csrfField() ?>
                            <input type="email" name="email" placeholder="Enter your email" required>
                            <div style="display:flex; gap:6px; margin-top:6px; align-items:center;">
                                <label style="font-size:12px; color:rgba(255,255,255,0.7); white-space:nowrap;"><?= generateCaptcha() ?></label>
                                <input type="number" name="captcha" placeholder="?" required style="width:60px; padding:4px 8px; font-size:13px; border-radius:4px; border:1px solid rgba(255,255,255,0.3);">
                            </div>
                            <button type="submit"><i class="fas fa-paper-plane"></i></button>
                        </form>
                    </div>
                    <div class="footer-contact-item">
                        <span class="icon"><i class="fas fa-map-marker-alt"></i></span>
                        <span><?= htmlspecialchars($settings['address'] ?? '') ?></span>
                    </div>
                    <div class="footer-contact-item">
                        <span class="icon"><i class="fas fa-phone"></i></span>
                        <span><?= htmlspecialchars($settings['phone'] ?? '') ?></span>
                    </div>
                    <div class="footer-contact-item">
                        <span class="icon"><i class="fas fa-envelope"></i></span>
                        <span><?= htmlspecialchars($settings['email'] ?? '') ?></span>
                    </div>
                </div>
            </div>
            <div class="footer-bottom">
                <p><?= htmlspecialchars($settings['footer_text'] ?? '') ?></p>
            </div>
        </div>
    </footer>

    <button class="back-to-top" aria-label="Back to top"><i class="fas fa-arrow-up"></i></button>

    <script src="/assets/js/main.js"></script>
</body>
</html>
