<?php
$neatnote_footer_logo = get_theme_mod('neatnote_footer_logo', '');
$neatnote_footer_logo_title = '';
if ($neatnote_footer_logo) {
    $image_id = attachment_url_to_postid($neatnote_footer_logo);
    $neatnote_footer_logo_title = $image_id ? get_the_title($image_id) : '';
}
$facebook_url =  get_theme_mod('neatnote_facebook_url', '');
$twitter_url =  get_theme_mod('neatnote_twitter_url', '');
$instagram_url =  get_theme_mod('neatnote_instagram_url', '');
$linkedin_url =  get_theme_mod('neatnote_linkedIn_url', '');
?>
</div>
<footer id="colophon" class="site-footer">
    <div class="neatnote_footerSection NeatNote-altBg">
        <div class="NeatNote-wrapper">
            <div class="neatnote_footerParent NeatNote-mobile-center">
                <div class="neatnote_FooterTop">
                    <div class="neatnote_footerLeft NeatNote-w40 NeatNote-mw100 NeatNote-ib NeatNote-vt">
                        <?php if ($neatnote_footer_logo): ?>
                            <div class="neatnote_FooterLogo">
                                <a href="<?php echo esc_url(home_url('/')); ?>"><img
                                        src="<?php echo esc_url($neatnote_footer_logo); ?>" alt='<?php echo esc_attr($neatnote_footer_logo_title); ?>'></a>
                            </div>
                        <?php elseif (has_custom_logo()): ?>
                            <div class="neatnote_FooterLogo">
                                <a href="<?php echo esc_url(home_url('/')); ?>"><?php the_custom_logo(); ?></a>
                            </div>
                        <?php else: ?>
                            <div class="neatnote_FooterLogo">
                                <h4><a href='<?php echo esc_url(home_url('/')); ?>'><?php echo esc_html(get_bloginfo('name')); ?></a></h4>
                            </div>
                        <?php endif; ?>
                        <div class="neatnote_footerLeftContent font18 neatnote-pt15">
                            <p>
                                <?php
                                $footer_description = get_theme_mod('neatnote_footer_description', '');
                                $sanitized_description = wp_kses_post($footer_description); // Allow only safe HTML
                                echo !empty($sanitized_description) ? $sanitized_description : esc_html__('Lorem Ipsum...', 'neatnote');
                                ?>
                            </p>
                        </div>
                    </div>
                    <div class="neatnote_FooterRight NeatNote-w60 NeatNote-mw100 NeatNote-ib NeatNote-vt">
                        <div class="neatnote_footerNavBox NeatNote-w70 NeatNote-mw100 NeatNote-ib NeatNote-vt">
                            <div class="neatnote_footerNav neatnote_noListStyle NeatNote-text-left NeatNote-mobile-center NeatNote-w50 NeatNote-mw100 NeatNote-ib NeatNote-vt">
                                <h5 class="NeatNote-blueFont NeatNote-semibold"><?php esc_html_e('Quick Links', 'neatnote'); ?></h5>
                                <?php if (has_nav_menu('neatnote-footer-menu')): ?>
                                <?php
                                    wp_nav_menu(
                                        array(
                                            'theme_location' => 'neatnote-footer-menu',
                                            'menu_class' => 'neatote-main-menu',
                                            'container' => false,
                                            'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
                                            'fallback_cb' => false,
                                        )
                                    );
                                else :
                                    echo '<ul class="NeatNote-header-menu-main">';
                                    $pages = get_pages();
                                    foreach ($pages as $page) {
                                        $page_title = $page->post_title;
                                        $page_url = get_permalink($page->ID);
                                        echo '<li><a href="' . esc_url($page_url) . '">' . esc_html($page_title) . '</a></li>';
                                    }
                                    echo '</ul>';

                                ?>
                                <?php endif; ?>
                            </div>
                            <?php if (has_nav_menu('neatnote-footer-contact-menu')): ?>
                                <div class="neatnote_footerNav neatnote_noListStyle NeatNote-text-left NeatNote-mobile-center NeatNote-w50 NeatNote-mw100 NeatNote-ib NeatNote-vt">
                                    <h5 class="NeatNote-blueFont NeatNote-semibold"><?php esc_html_e('Get in touch', 'neatnote'); ?></h5>
                                    <?php
                                    wp_nav_menu(
                                        array(
                                            'theme_location' => 'neatnote-footer-contact-menu',
                                            'menu_class' => 'neatnote-main-menu',
                                            'container' => false,
                                            'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
                                            'fallback_cb' => false,
                                        )
                                    );
                                    ?>
                                </div>
                            <?php endif; ?>
                        </div>
                        <div class="FooterSocialIcon NeatNote-w30 NeatNote-mw100 NeatNote-ib NeatNote-vt">
                            <div class="neatnote-footerIcon neatnote_noListStyle NeatNote-text-right NeatNote-mobile-center">

                                <?php
                                if (has_nav_menu('neatnote-social-menu')) : ?>
                                    <h5 class="NeatNote-blueFont NeatNote-semibold"><?php esc_html_e('Follow Us On', 'neatnote'); ?></h5>
                                    <?php
                                    wp_nav_menu(array(
                                        'theme_location' => 'neatnote-social-menu',
                                        'menu_class'     => 'neatnote-social-menu',
                                        'walker'         => new Neatnote_Social_Menu_Walker(),
                                        'fallback_cb'    => false,
                                    ));
                                    ?>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="NeatNote-FooterBottom">
                    <div class="NeatNote-FooterYear NeatNote-text-center">
                        <div class="Neatnote-FootYear">
                            <p>&copy; <?php echo esc_html(date('Y')); ?>
                                <a href='<?php echo esc_url(home_url()); ?>'><?php echo esc_html(get_bloginfo('name')); ?></a>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</footer>
<?php $body_fonts = esc_attr(get_theme_mod('neatnote_body_fonts', '')); ?>


<?php wp_footer(); ?>
</body>

</html>