<?php
require_once __DIR__ . '/db.php';
?>
    <!-- WhatsApp Floating Button -->
    <?php if (!empty($settings['whatsapp_number'])): ?>
        <a href="https://wa.me/<?php echo $settings['whatsapp_number']; ?>?text=Halo%20PT%20Namora%20Nexa%20Niaga%2C%20saya%20tertarik%20dengan%20produk%20batu%20split%20dan%20material%20konstruksi%20Anda." 
           class="whatsapp-float" 
           target="_blank" 
           rel="noopener noreferrer"
           aria-label="Hubungi kami di WhatsApp">
            <i class="fab fa-whatsapp"></i>
        </a>
    <?php endif; ?>

    <!-- Footer -->
    <footer>
        <div class="container">
            <div class="footer-grid">
                <!-- Company Info -->
                <div class="footer-col">
                    <a href="index.php" class="logo" style="margin-bottom: 20px; display: inline-block;">
                        <span class="brand-name" style="color: #fff;"><?php echo $settings['company_name']; ?></span>
                        <span class="brand-tagline"><?php echo $settings['tagline']; ?></span>
                    </a>
                    <p><?php echo $settings['about_short']; ?></p>
                    <div class="social-links">
                        <?php if (!empty($settings['facebook'])): ?>
                            <a href="<?php echo $settings['facebook']; ?>" class="social-link" target="_blank" rel="noopener noreferrer"><i class="fab fa-facebook-f"></i></a>
                        <?php endif; ?>
                        <?php if (!empty($settings['instagram'])): ?>
                            <a href="<?php echo $settings['instagram']; ?>" class="social-link" target="_blank" rel="noopener noreferrer"><i class="fab fa-instagram"></i></a>
                        <?php endif; ?>
                        <a href="https://wa.me/<?php echo $settings['whatsapp_number']; ?>" class="social-link" target="_blank" rel="noopener noreferrer"><i class="fab fa-whatsapp"></i></a>
                    </div>
                </div>

                <!-- Navigation Links -->
                <div class="footer-col">
                    <h3>Navigasi</h3>
                    <div class="footer-links">
                        <a href="index.php">Beranda</a>
                        <?php if (isset($settings['menu_about_visible']) && $settings['menu_about_visible'] == 1): ?>
                            <a href="about.php">Tentang Kami</a>
                        <?php endif; ?>
                        <?php if (isset($settings['menu_products_visible']) && $settings['menu_products_visible'] == 1): ?>
                            <a href="products.php">Produk Material</a>
                        <?php endif; ?>
                        <?php if (isset($settings['menu_gallery_visible']) && $settings['menu_gallery_visible'] == 1): ?>
                            <a href="gallery.php">Galeri Proyek</a>
                        <?php endif; ?>
                        <?php if (isset($settings['menu_blog_visible']) && $settings['menu_blog_visible'] == 1): ?>
                            <a href="blog.php">Artikel & Blog</a>
                        <?php endif; ?>
                        <?php if (isset($settings['menu_contact_visible']) && $settings['menu_contact_visible'] == 1): ?>
                            <a href="contact.php">Hubungi Kami</a>
                        <?php endif; ?>
                    </div>
                </div>

                <!-- Product Categories -->
                <?php if (isset($settings['menu_products_visible']) && $settings['menu_products_visible'] == 1): ?>
                    <div class="footer-col">
                        <h3>Produk Utama</h3>
                        <div class="footer-links">
                            <a href="products.php?cat=Batu+Split">Batu Split</a>
                            <a href="products.php?cat=Batu+Belah">Batu Belah Pondasi</a>
                            <a href="products.php?cat=Abu+Batu">Abu Batu</a>
                            <a href="products.php?cat=Makadam">Batu Makadam</a>
                            <a href="products.php?cat=Lainnya">Material Agregat Lain</a>
                        </div>
                    </div>
                <?php endif; ?>

                <!-- Contact details -->
                <div class="footer-col">
                    <h3>Hubungi Kami</h3>
                    <p style="margin-bottom: 12px;"><i class="fas fa-map-marker-alt" style="color: var(--primary); margin-right: 10px;"></i> <?php echo $settings['address']; ?></p>
                    <p style="margin-bottom: 12px;"><i class="fas fa-phone-alt" style="color: var(--primary); margin-right: 10px;"></i> <?php echo $settings['phone']; ?></p>
                    <p style="margin-bottom: 12px;"><i class="fas fa-envelope" style="color: var(--primary); margin-right: 10px;"></i> <?php echo $settings['email']; ?></p>
                </div>
            </div>

            <!-- Footer Bottom -->
            <div class="footer-bottom">
                <p>&copy; <?php echo date('Y'); ?> <?php echo $settings['company_name']; ?>. All rights reserved. Powered by Premium Construction Aggregates.</p>
            </div>
        </div>
    </footer>

    <!-- Main JavaScript -->
    <script src="assets/js/main.js"></script>
</body>
</html>
