<?php
if(!isset($pdo) && file_exists(__DIR__ . '/includes/config.php')) {
    require_once __DIR__ . '/includes/config.php';
}

$site_name = getSetting('site_name', $pdo, 'ESC Rental');
$footer_copyright_text = getSetting('footer_copyright_text', $pdo, '© 2026 ESC Rental Albania. All rights reserved.');
$footer_about_text = getSetting('footer_about_text', $pdo, 'Premium car rental services in Albania. Quality vehicles, competitive prices, and exceptional customer service.');
$site_phone = getSetting('site_phone', $pdo, '+355 69 123 4567');
$site_email = getSetting('site_email', $pdo, 'info@carrental.com');
$site_address = getSetting('site_address', $pdo, 'Tirana, Albania');
$working_hours_start = getSetting('working_hours_start', $pdo, '08:00');
$working_hours_end = getSetting('working_hours_end', $pdo, '20:00');
$facebook_url = getSetting('facebook_url', $pdo, '');
$instagram_url = getSetting('instagram_url', $pdo, '');
$whatsapp_number = getSetting('whatsapp_number', $pdo, '');
?>
<footer class="footer" style="background: var(--secondary); color: #94a3b8; padding: 60px 5% 30px;">
    <div class="footer-grid" style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; max-width: 1400px; margin: 0 auto;">
        <div class="footer-col">
            <h3 style="color: white; font-size: 18px; margin-bottom: 20px;"><?php echo sanitize($site_name); ?></h3>
            <p style="font-size: 14px; line-height: 1.6; margin-bottom: 12px;"><?php echo t('footer_about_text', sanitize($footer_about_text)); ?></p>
            <div class="footer-social" style="display: flex; gap: 15px; margin-top: 20px;">
                <?php if($facebook_url): ?>
                    <a href="<?php echo sanitize($facebook_url); ?>" target="_blank" style="width: 36px; height: 36px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; transition: all 0.3s;"><i class="fab fa-facebook-f"></i></a>
                <?php endif; ?>
                <?php if($instagram_url): ?>
                    <a href="<?php echo sanitize($instagram_url); ?>" target="_blank" style="width: 36px; height: 36px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; transition: all 0.3s;"><i class="fab fa-instagram"></i></a>
                <?php endif; ?>
                <?php if($whatsapp_number): ?>
                    <a href="https://wa.me/<?php echo preg_replace('/[^0-9]/', '', $whatsapp_number); ?>" target="_blank" style="width: 36px; height: 36px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; transition: all 0.3s;"><i class="fab fa-whatsapp"></i></a>
                <?php endif; ?>
            </div>
        </div>
        <div class="footer-col">
            <h3 style="color: white; font-size: 18px; margin-bottom: 20px;"><?php echo t('footer_quick_links'); ?></h3>
            <p style="margin-bottom: 12px;"><a href="index.php" style="color: #94a3b8; text-decoration: none;"><?php echo t('nav_home'); ?></a></p>
            <p style="margin-bottom: 12px;"><a href="all-cars.php" style="color: #94a3b8; text-decoration: none;"><?php echo t('nav_all_cars'); ?></a></p>
            <p style="margin-bottom: 12px;"><a href="faq.php" style="color: #94a3b8; text-decoration: none;"><?php echo t('nav_faq'); ?></a></p>
        </div>
        <div class="footer-col">
            <h3 style="color: white; font-size: 18px; margin-bottom: 20px;"><?php echo t('footer_contact_info'); ?></h3>
            <p style="margin-bottom: 12px;"><i class="fas fa-map-marker-alt"></i> <?php echo sanitize($site_address); ?></p>
            <p style="margin-bottom: 12px;"><i class="fas fa-phone"></i> <?php echo sanitize($site_phone); ?></p>
            <p style="margin-bottom: 12px;"><i class="fas fa-envelope"></i> <?php echo sanitize($site_email); ?></p>
            <p style="margin-bottom: 12px;"><i class="far fa-clock"></i> <?php echo sanitize($working_hours_start); ?> - <?php echo sanitize($working_hours_end); ?></p>
        </div>
    </div>
    <div class="footer-bottom" style="text-align: center; padding-top: 30px; margin-top: 40px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 13px;">
        <p><?php echo t('footer_copyright', sanitize($footer_copyright_text)); ?></p>
    </div>
</footer>