<style>
    /* Premium Footer Styling */
    .footer-main {
        background: linear-gradient(135deg, #0f0f0f 0%, #1a0505 100%);
        color: #e2e8f0;
        position: relative;
        overflow: hidden;
        border-top: 1px solid rgba(255, 193, 7, 0.1);
    }

    .footer-main::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: radial-gradient(circle at 10% 20%, rgba(176, 0, 0, 0.05) 0%, transparent 40%),
                    radial-gradient(circle at 90% 80%, rgba(255, 193, 7, 0.03) 0%, transparent 40%);
        pointer-events: none;
    }

    .footer-brand-logo {
        text-decoration: none;
        transition: transform 0.3s ease;
        display: inline-block;
    }

    .footer-brand-logo:hover {
        transform: scale(1.02);
    }

    .footer-heading {
        color: #fff;
        font-family: 'ABC Ginto Nord Unlicensed Trial Bold', sans-serif;
        font-size: 0.9rem;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        margin-bottom: 25px;
        position: relative;
        padding-bottom: 10px;
    }

    .footer-heading::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 30px;
        height: 2px;
        background: var(--bs-gold);
        transition: width 0.3s ease;
    }

    .footer-link-group:hover .footer-heading::after {
        width: 50px;
    }

    .footer-links {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .footer-links li {
        margin-bottom: 12px;
    }

    .footer-links a {
        color: rgba(226, 232, 240, 0.7) !important;
        text-decoration: none !important;
        transition: all 0.3s ease;
        display: inline-flex;
        align-items: center;
        font-weight: 500;
        font-size: 0.9rem;
    }

    .footer-links a i {
        font-size: 0.7rem;
        margin-right: 8px;
        opacity: 0.5;
        transition: transform 0.3s ease;
    }

    .footer-links a:hover {
        color: var(--bs-gold) !important;
        transform: translateX(5px);
    }

    .footer-links a:hover i {
        transform: translateX(3px);
        opacity: 1;
        color: var(--bs-gold);
    }

    .footer-social-icons {
        display: flex;
        gap: 12px;
        margin-top: 20px;
    }

    .social-icon-btn {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.05);
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff !important;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .social-icon-btn:hover {
        background: var(--bs-crimson-light);
        border-color: var(--bs-crimson-light);
        transform: translateY(-5px);
        box-shadow: 0 5px 15px rgba(176, 0, 0, 0.4);
        color: #fff !important;
    }

    .footer-bottom {
        background: rgba(0, 0, 0, 0.3);
        padding: 20px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .contact-card-footer {
        background: rgba(255, 255, 255, 0.03);
        border-radius: 12px;
        padding: 15px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        margin-top: 20px;
    }

    .contact-item-footer {
        display: flex;
        align-items: center;
        margin-bottom: 10px;
        font-size: 0.85rem;
    }

    .contact-item-footer i {
        width: 30px;
        height: 30px;
        background: rgba(255, 193, 7, 0.1);
        color: var(--bs-gold);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 12px;
    }

    /* Fixed Social Bar Styling */
    .fixed-social-bar {
        position: fixed;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
        z-index: 1050;
        display: flex;
        flex-direction: column;
        box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.3);
        border-radius: 0 10px 10px 0;
        overflow: hidden;
    }

    .social-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        color: #fff;
        font-size: 1.3rem;
        transition: all 0.3s ease;
        text-decoration: none;
        position: relative;
    }

    .social-btn:hover {
        width: 140px;
        justify-content: flex-start;
        padding-left: 15px;
    }

    .social-btn span {
        white-space: nowrap;
        opacity: 0;
        position: absolute;
        left: 50px;
        transition: opacity 0.3s ease;
        font-size: 0.8rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .social-btn:hover span {
        opacity: 1;
    }

    .social-btn.telegram { background-color: #0088CC; }
    .social-btn.whatsapp { background-color: #25D366; }

    @media (max-width: 991px) {
        .footer-main { text-align: center; }
        .footer-heading::after { left: 50%; transform: translateX(-50%); }
        .footer-social-icons { justify-content: center; }
        .contact-item-footer { justify-content: center; }
    }
</style>

<footer class="footer-main pt-5 mt-5">
    <div class="container pb-4">


        <div class="row g-4">
            
            <!-- Column 1: About & Visual identity -->
            <div class="col-lg-4 col-md-6 footer-link-group">
                <h5 class="footer-heading">Our Logistics Network</h5>
                
                <?php if ($use_logo): ?>
                    <div class="mb-4">
                        <img src="<?php echo $logo_path; ?>" alt="Branding" style="max-height: 48px; width: auto; object-fit: contain;">
                    </div>
                <?php else: ?>
                    <div class="d-flex align-items-center mb-4">
                        <i class="fa-light fa-plane-departure fs-3 text-gold me-3"></i>
                        <div class="text-start" style="line-height: 1.1;">
                            <span class="fs-6 fw-900 text-white" style="font-family: 'ABC Ginto Nord Unlicensed Trial Black';">
                                <?php echo strtoupper(htmlspecialchars($site_settings['site_title'] ?? 'RELI PARCEL')); ?>
                            </span><br>
                            <span class="text-gold fw-bold" style="font-size: 9px; letter-spacing: 1.5px;"> WORLDWIDE LOGISTICS </span>
                        </div>
                    </div>
                <?php endif; ?>

                <p class="small text-white-50 pe-lg-4 mb-4" style="line-height: 1.8;">
                    Empowering global trade through smarter, faster, and more reliable logistics solutions. We bridge continents with precision and care, ensuring every package is a promise delivered on time, every time.
                </p>
                <div class="footer-social-icons">
                    <?php if ($facebook_enabled): ?>
                        <a href="<?php echo $facebook_url; ?>" class="social-icon-btn"><i class="bi bi-facebook"></i></a>
                    <?php endif; ?>
                    <?php if ($instagram_enabled): ?>
                        <a href="<?php echo $instagram_url; ?>" class="social-icon-btn"><i class="bi bi-instagram"></i></a>
                    <?php endif; ?>
                    <?php if ($twitter_enabled): ?>
                        <a href="<?php echo $twitter_url; ?>" class="social-icon-btn"><i class="bi bi-twitter-x"></i></a>
                    <?php endif; ?>
                    <?php if ($youtube_enabled): ?>
                        <a href="<?php echo $youtube_url; ?>" class="social-icon-btn"><i class="bi bi-youtube"></i></a>
                    <?php endif; ?>
                </div>
            </div>

            <!-- Column 2: Core Services -->
            <div class="col-lg-2 col-md-6 footer-link-group">
                <h5 class="footer-heading">Services</h5>
                <ul class="footer-links">
                    <li><a href="services.php"><i class="bi bi-chevron-right"></i> Express Delivery</a></li>
                    <li><a href="services.php"><i class="bi bi-chevron-right"></i> Ocean Freight</a></li>
                    <li><a href="services.php"><i class="bi bi-chevron-right"></i> Air Freight</a></li>
                    <li><a href="services.php"><i class="bi bi-chevron-right"></i> Warehousing</a></li>
                    <li><a href="services.php"><i class="bi bi-chevron-right"></i> Cold Chain</a></li>
                    <li><a href="track.php"><i class="bi bi-chevron-right"></i> Global Tracking</a></li>
                </ul>
            </div>

            <!-- Column 3: Quick Links -->
            <div class="col-lg-2 col-md-6 footer-link-group">
                <h5 class="footer-heading">Company</h5>
                <ul class="footer-links">
                    <li><a href="about.php"><i class="bi bi-chevron-right"></i> Our Story</a></li>
                    <li><a href="careers.php"><i class="bi bi-chevron-right"></i> Careers</a></li>
                    <li><a href="contact.php"><i class="bi bi-chevron-right"></i> Contact Us</a></li>
                    <li><a href="quote.php"><i class="bi bi-chevron-right"></i> Get a Quote</a></li>
                    <li><a href="faq.php"><i class="bi bi-chevron-right"></i> Help Center</a></li>
                    <li><a href="index.php#testimonials"><i class="bi bi-chevron-right"></i> Reviews</a></li>
                </ul>
            </div>

            <!-- Column 4: Contact & Support -->
            <div class="col-lg-4 col-md-6 footer-link-group">
                <h5 class="footer-heading">Support Hub</h5>
                <p class="small text-white-50 mb-3">Available 24/7 for all your logistics inquiries.</p>
                <div class="contact-card-footer">
                    <?php if ($whatsapp_enabled): ?>
                        <div class="contact-item-footer">
                            <i class="bi bi-whatsapp"></i>
                            <span><span class="fw-bold">Office Number:</span> +<?php echo ltrim(htmlspecialchars($site_settings['whatsapp_number']), '+'); ?></span>
                        </div>
                    <?php endif; ?>
                    <div class="contact-item-footer">
                        <i class="bi bi-envelope"></i>
                        <span>support@<?php echo str_replace(' ', '', strtolower($site_settings['site_title'] ?? 'reliparcel')); ?>.com</span>
                    </div>
                    <div class="contact-item-footer">
                        <i class="bi bi-shield-check"></i>
                        <span>Fully Licensed & Insured Carrier</span>
                    </div>
                </div>
                <div class="mt-4 pt-2">
                    <a href="track.php" class="btn btn-warning btn-sm fw-bold w-100 rounded-pill py-2 shadow">
                        <i class="bi bi-geo-alt-fill me-2"></i> TRACK SHIPMENT
                    </a>
                </div>
            </div>

        </div>
    </div>

    <!-- Bottom Bar -->
    <div class="footer-bottom">
        <div class="container text-center">
            <div class="row align-items-center">
                <div class="col-lg-6 text-lg-start mb-3 mb-lg-0">
                    <p class="small text-white-50 mb-0">
                    &copy; <?php echo date("Y"); ?> <span class="text-white fw-bold"><?php echo htmlspecialchars($site_settings['site_title'] ?? 'ReliParcel'); ?></span>. 
                    <span class="d-none d-md-inline">Professional Logistics Network.</span> All Rights Reserved.
                    </p>
                </div>
                <div class="col-lg-6 text-lg-end">
                    <div class="small">
                        <a href="#" data-bs-toggle="modal" data-bs-target="#rulesModal" class="text-white-50 mx-2">Shipping Policy</a>
                        <span class="text-white-50 opacity-25">|</span>
                        <a href="#" data-bs-toggle="modal" data-bs-target="#privacyModal" class="text-white-50 mx-2">Privacy</a>
                        <span class="text-white-50 opacity-25">|</span>
                        <a href="#" data-bs-toggle="modal" data-bs-target="#termsModal" class="text-white-50 mx-2">Terms</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>

<!-- Floating Social Bar -->
<div class="fixed-social-bar d-none d-md-flex">
    <?php if ($telegram_enabled): ?>
        <a href="<?php echo $telegram_link; ?>" class="social-btn telegram" target="_blank" rel="noopener noreferrer">
            <i class="fab fa-telegram-plane"></i>
            <span>Telegram</span> 
        </a>
    <?php endif; ?>

    <?php if ($whatsapp_enabled): ?>
        <a href="<?php echo $whatsapp_link; ?>" class="social-btn whatsapp" target="_blank" rel="noopener noreferrer">
            <i class="fab fa-whatsapp"></i>
            <span>WhatsApp</span>
        </a>
    <?php endif; ?>
</div>

<!-- Smartsupp Integration -->
<?php if ($smartsupp_enabled): ?>
    <?php echo $smartsupp_script; ?>
<?php endif; ?>

<!-- Modals (Policy, Privacy, Terms) -->
<div class="modal fade" id="rulesModal" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content bg-dark text-white border-0 shadow-lg">
            <div class="modal-header border-secondary bg-primary-900">
                <h5 class="modal-title text-white fw-bold">Shipping Policy</h5>
                <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body" style="font-size: 0.95rem; line-height: 1.8;">
                <p>All shipments are processed and handled with the utmost care and professionalism. <strong>Delivery timelines</strong> are estimates and may vary due to customs, weather, or unforeseen logistical issues.</p>
                <p>The customer is responsible for providing <strong>accurate and complete recipient information</strong>. Packages returned due to incorrect addresses may incur additional shipping charges or redelivery fees.</p>
                <p>Our liability for loss or damage is limited to the declared value of the item, subject to our maximum insurance coverage.</p>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="privacyModal" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content bg-dark text-white border-0 shadow-lg">
            <div class="modal-header border-secondary bg-primary-900">
                <h5 class="modal-title text-white fw-bold">Privacy Policy</h5>
                <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body" style="font-size: 0.95rem; line-height: 1.8;">
                <p>We are committed to protecting your privacy. We collect data (names, addresses, contact numbers) solely for the purpose of <strong>processing, tracking, and delivering your shipments</strong>.</p>
                <p>We <strong>do not sell or rent</strong> your personal data for marketing purposes. All collected data is secured using industry-standard encryption.</p>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="termsModal" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg">
        <div class="modal-content bg-dark text-white border-0 shadow-lg">
            <div class="modal-header border-secondary bg-primary-900">
                <h5 class="modal-title text-white fw-bold">Terms of Service</h5>
                <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body" style="font-size: 0.95rem; line-height: 1.8;">
                <p>By using our logistics and courier services, you agree to be bound by these <strong>Terms of Service</strong> and all applicable laws and regulations.</p>
                <p>The client is solely responsible for the accurate description and lawful contents of all packages. We reserve the right to <strong>inspect any shipment</strong> for security reasons.</p>
            </div>
        </div>
    </div>
</div>


<script>
    document.addEventListener('DOMContentLoaded', function() {
        const scrollBtn = document.getElementById('scrollToTop');
        const progressPath = document.querySelector('.progress-circle path');
        const pathLength = progressPath.getTotalLength();

        progressPath.style.strokeDasharray = `${pathLength} ${pathLength}`;
        progressPath.style.transition = 'stroke-dashoffset 10ms linear';

        const updateProgress = () => {
            const scroll = window.pageYOffset;
            const height = document.documentElement.scrollHeight - window.innerHeight;
            const progress = pathLength - (scroll * pathLength / height);
            progressPath.style.strokeDashoffset = progress;

            if (scroll > 300) {
                scrollBtn.classList.add('active');
            } else {
                scrollBtn.classList.remove('active');
            }
        };

        window.addEventListener('scroll', updateProgress);
        
        scrollBtn.addEventListener('click', () => {
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            });
        });

        updateProgress();
    });
</script>
