<?php
include 'db.php'; // your db connection
include 'phpqrcode/qrlib.php'; // path to qrlib.php

$footer = $conn->query("SELECT * FROM footer_info WHERE element_name='footer'")->fetch_assoc();

// Generate QR code image as base64
ob_start();
QRcode::png($footer['phone'], null, QR_ECLEVEL_L, 3); // 3 = size of QR code
$imageData = ob_get_clean();
$qrBase64 = base64_encode($imageData);
?>

<footer style="background:#25A9C2; color:#fff; padding:50px 10%;">
    <div class="footer-container" style="max-width:1200px; margin:0 auto; display:flex; flex-wrap:wrap; gap:30px;">
        <!-- Contact Info -->
        <div class="footer-contact" style="flex:1; min-width:250px;">
            <h3>Contact Us</h3>
            <p><?= $footer['address']; ?></p>

            <!-- Phone with QR code -->
       <p style="display:flex; align-items:center; gap:10px;">
    Phone: <?= $footer['phone']; ?>
    <img src="assets/sigalphonewhatsp.jpg" alt="WhatsApp" style="height:80px; width:auto;">
</p>



            <p>Email: <?= $footer['email']; ?></p>

            <div class="social-links" style="margin-top:10px;">
                <a href="<?= $footer['facebook']; ?>" target="_blank" style="color:#fff;margin-right:10px;">Facebook</a>
                <a href="<?= $footer['twitter']; ?>" target="_blank" style="color:#fff;margin-right:10px;">Twitter</a>
                <a href="<?= $footer['linkedin']; ?>" target="_blank" style="color:#fff;margin-right:10px;">LinkedIn</a>
                <a href="<?= $footer['instagram']; ?>" target="_blank" style="color:#fff;">Instagram</a>
            </div>
        </div>

        <!-- Map -->
        <div class="footer-map" style="flex:1; min-width:300px;">
            <iframe 
                src="<?= $footer['map_embed_url']; ?>" 
                width="100%" 
                height="250" 
                style="border:0;" 
                allowfullscreen 
                loading="lazy">
            </iframe>
        </div>
    </div>

    <div style="text-align:center; margin-top:30px; font-size: 1.5rem;">
        <?= $footer['content']; ?>
    </div>
</footer>
