<?php
/**
 * Shared Footer Include for Service Pages
 */
?>
<!-- FOOTER -->
<footer class="footer" role="contentinfo">
    <div class="container">
        <div class="footer-top">
            <div class="footer-column">
                <div class="footer-logo">
                    <svg width="36" height="36" viewBox="0 0 50 50" aria-hidden="true">
                        <circle cx="25" cy="25" r="23" fill="#4361ee"/>
                        <path d="M15,15 L35,15 L35,35 L15,35 Z" fill="none" stroke="#fff" stroke-width="3"/>
                        <path d="M18,20 L32,20" stroke="#fff" stroke-width="2"/>
                        <path d="M18,25 L32,25" stroke="#fff" stroke-width="2"/>
                        <path d="M18,30 L28,30" stroke="#fff" stroke-width="2"/>
                    </svg>
                    <span>Print<span class="highlight">Portal</span></span>
                </div>
                <p>India's trusted platform for printing Aadhaar, PAN, Voter ID, Driving License and more. Designed for Jan Seva Kendras and Cyber Cafes across India.</p>
                <div class="footer-social">
                    <a href="#" class="social-icon" aria-label="Facebook"><i class="fab fa-facebook-f"></i></a>
                    <a href="#" class="social-icon" aria-label="Instagram"><i class="fab fa-instagram"></i></a>
                    <a href="#" class="social-icon" aria-label="Twitter"><i class="fab fa-twitter"></i></a>
                    <a href="https://wa.me/91<?php echo htmlspecialchars($phone); ?>" class="social-icon" aria-label="WhatsApp"><i class="fab fa-whatsapp"></i></a>
                </div>
            </div>

            <div class="footer-column">
                <h3>Quick Links</h3>
                <ul class="footer-links">
                    <li><a href="<?php echo $base; ?>index.php">Home</a></li>
                    <li><a href="<?php echo $base; ?>index.php#how-it-works">How It Works</a></li>
                    <li><a href="<?php echo $base; ?>index.php#contact">Contact Us</a></li>
                    <li><a href="<?php echo $base; ?>about">About Us</a></li>
                    <li><a href="<?php echo $base; ?>dashboard/login.php">Login</a></li>
                    <li><a href="<?php echo $base; ?>dashboard/register.php">Register</a></li>
                </ul>
            </div>

            <div class="footer-column">
                <h3>Our Services</h3>
                <ul class="footer-links">
                    <li><a href="<?php echo $base; ?>services/aadhaar-titan-print.php">Aadhaar Titan Print</a></li>
                    <li><a href="<?php echo $base; ?>services/voter-id-print.php">Voter ID Card Print</a></li>
                    <li><a href="<?php echo $base; ?>services/driving-license-print.php">Driving License Print</a></li>
                    <li><a href="<?php echo $base; ?>services/pan-find-portal.php">PAN No. Find Portal</a></li>
                    <li><a href="<?php echo $base; ?>services/rc-titan-print.php">RC Titan Print</a></li>
                    <li><a href="<?php echo $base; ?>services/csc-titan-print.php">CSC Titan Print</a></li>
                </ul>
            </div>

            <div class="footer-column">
                <h3>Contact Us</h3>
                <ul class="footer-contact">
                    <li><i class="fas fa-phone"></i> +91 <?php echo htmlspecialchars($phone); ?></li>
                    <li><i class="fas fa-envelope"></i> <a href="mailto:<?php echo htmlspecialchars($email); ?>" style="color:inherit;text-decoration:none;"><?php echo htmlspecialchars($email); ?></a></li>
                    <li><i class="fas fa-clock"></i> Mon–Sat: 10 AM – 7 PM IST</li>
                    <li><i class="fas fa-map-marker-alt"></i> All India Service</li>
                </ul>
                <a href="https://wa.me/91<?php echo htmlspecialchars($phone); ?>" class="footer-whatsapp">
                    <i class="fab fa-whatsapp"></i> Chat on WhatsApp
                </a>
            </div>
        </div>

        <div class="footer-bottom">
            <div class="copyright">
                <p>&copy; <?php echo date('Y'); ?> <?php echo htmlspecialchars($site_name); ?>. All rights reserved.</p>
            </div>
            <div class="footer-bottom-links">
                <a href="<?php echo $base; ?>privacy">Privacy Policy</a>
                <a href="<?php echo $base; ?>terms">Terms of Use</a>
                <a href="<?php echo $base; ?>news">Latest News</a>
            </div>
        </div>
    </div>
</footer>

<!-- Floating WhatsApp -->
<a href="https://wa.me/91<?php echo htmlspecialchars($phone); ?>" class="floating-whatsapp" aria-label="Contact on WhatsApp">
    <i class="fab fa-whatsapp" aria-hidden="true"></i>
</a>

<!-- Back to Top -->
<button id="back-to-top" title="Back to Top" aria-label="Back to top">
    <i class="fas fa-arrow-up" aria-hidden="true"></i>
</button>

<!-- Shared JS -->
<script>
(function() {
    const header = document.getElementById('site-header');
    const mobileBtn = document.getElementById('mobileMenuBtn');
    const navLinks = document.getElementById('navLinks');
    const backTopBtn = document.getElementById('back-to-top');

    // Scroll handler
    let ticking = false;
    window.addEventListener('scroll', () => {
        if (!ticking) {
            requestAnimationFrame(() => {
                const scrollY = window.scrollY;
                if (header) header.classList.toggle('scrolled', scrollY > 50);
                if (backTopBtn) backTopBtn.classList.toggle('visible', scrollY > 400);
                ticking = false;
            });
            ticking = true;
        }
    });

    // Mobile menu
    if (mobileBtn && navLinks) {
        mobileBtn.addEventListener('click', () => {
            const expanded = mobileBtn.getAttribute('aria-expanded') === 'true';
            mobileBtn.setAttribute('aria-expanded', !expanded);
            mobileBtn.classList.toggle('active');
            navLinks.classList.toggle('active');
        });
        document.addEventListener('click', (e) => {
            if (!mobileBtn.contains(e.target) && !navLinks.contains(e.target)) {
                mobileBtn.classList.remove('active');
                navLinks.classList.remove('active');
                mobileBtn.setAttribute('aria-expanded', 'false');
                document.querySelectorAll('.nav-dropdown.open').forEach(openMenu => {
                    openMenu.classList.remove('open');
                    const toggle = openMenu.querySelector('> a');
                    if (toggle) toggle.setAttribute('aria-expanded', 'false');
                });
            }
        });

        // Mobile dropdown toggle on small screens
        document.querySelectorAll('.nav-dropdown > a').forEach(toggle => {
            toggle.addEventListener('click', (e) => {
                if (window.matchMedia('(max-width: 980px)').matches) {
                    e.preventDefault();
                    const parent = toggle.parentElement;
                    const isOpen = parent.classList.toggle('open');
                    toggle.setAttribute('aria-expanded', isOpen);
                }
            });
        });
    }

    // Back to top
    if (backTopBtn) {
        backTopBtn.addEventListener('click', () => window.scrollTo({ top: 0, behavior: 'smooth' }));
    }

    // Fade-in on scroll
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('visible');
                observer.unobserve(entry.target);
            }
        });
    }, { threshold: 0.12, rootMargin: '0px 0px -40px 0px' });

    document.querySelectorAll('.fade-in').forEach(el => observer.observe(el));

    // FAQ Accordion
    document.querySelectorAll('.faq-question').forEach(q => {
        q.addEventListener('click', () => {
            const item = q.closest('.faq-item');
            const isOpen = item.classList.contains('open');
            document.querySelectorAll('.faq-item.open').forEach(openItem => {
                if (openItem !== item) openItem.classList.remove('open');
            });
            item.classList.toggle('open', !isOpen);
        });
    });

    // Active nav link for current service
    const currentPath = window.location.pathname.split('/').pop();
    document.querySelectorAll('.nav-dropdown-menu a').forEach(link => {
        if (link.getAttribute('href') && link.getAttribute('href').includes(currentPath)) {
            link.style.color = 'var(--primary-color)';
            link.style.background = 'rgba(67,97,238,0.06)';
        }
    });
})();
</script>
</body>
</html>
