</div>
<!-- /page-main -->

<!-- FOOTER -->
<footer class="footer">
    <div class="container">
        <div class="row align-items-center flex-row-reverse">
            <div class="col-md-12 col-sm-12 text-center">
                Copyright © <?php echo date('Y'); ?> <a href="javascript:void(0)"><?php echo APP_NAME; ?></a>.
                Powered by <a href="https://khatifoodbazar.com" target="_blank">KhatiFoodBazar</a>. All rights reserved.
            </div>
        </div>
    </div>
</footer>
<!-- FOOTER END -->

</div>
<!-- BACK-TO-TOP -->
<a href="#top" id="back-to-top"><i class="fa fa-angle-up"></i></a>

<!-- JQUERY JS -->
<script src="<?php echo asset_url('assets/js/jquery.min.js'); ?>"></script>

<!-- BOOTSTRAP JS -->
<script src="<?php echo asset_url('assets/plugins/bootstrap/js/popper.min.js'); ?>"></script>
<script src="<?php echo asset_url('assets/plugins/bootstrap/js/bootstrap.min.js'); ?>"></script>

<!-- SPARKLINE JS-->
<script src="<?php echo asset_url('assets/js/jquery.sparkline.min.js'); ?>"></script>

<!-- CHART-CIRCLE JS-->
<script src="<?php echo asset_url('assets/js/circle-progress.min.js'); ?>"></script>

<!-- INPUT MASK JS-->
<script src="<?php echo asset_url('assets/plugins/input-mask/jquery.mask.min.js'); ?>"></script>

<!-- SIDE-MENU JS -->
<script src="<?php echo asset_url('assets/plugins/sidemenu/sidemenu.js'); ?>"></script>

<!-- SIDEBAR JS -->
<script src="<?php echo asset_url('assets/plugins/sidebar/sidebar.js'); ?>"></script>

<!-- Perfect SCROLLBAR JS-->
<script src="<?php echo asset_url('assets/plugins/p-scroll/perfect-scrollbar.js'); ?>"></script>
<script src="<?php echo asset_url('assets/plugins/p-scroll/pscroll.js'); ?>"></script>
<script src="<?php echo asset_url('assets/plugins/p-scroll/pscroll-1.js'); ?>"></script>

<!-- CUSTOM JS -->
<script src="<?php echo asset_url('assets/js/custom.js'); ?>"></script>
<script src="<?php echo asset_url('assets/js/toast-handler.js'); ?>"></script>

<!-- Theme Persistence Script -->
<script>
    (function () {
        'use strict';

        // Load saved theme on page load
        function loadTheme() {
            var savedTheme = localStorage.getItem('appTheme') || 'light-mode';
            var body = document.body;

            // Remove both theme classes first
            body.classList.remove('light-mode', 'dark-mode');

            // Apply saved theme
            body.classList.add(savedTheme);

            // Also apply to html element
            document.documentElement.classList.remove('light-mode', 'dark-mode');
            document.documentElement.classList.add(savedTheme);
        }

        // Save theme preference
        function saveTheme(theme) {
            localStorage.setItem('appTheme', theme);
        }

        // Initialize theme on page load
        loadTheme();

        // Listen for theme toggle clicks
        document.addEventListener('DOMContentLoaded', function () {
            var themeToggle = document.querySelector('.layout-setting');

            if (themeToggle) {
                themeToggle.addEventListener('click', function () {
                    setTimeout(function () {
                        // Detect current theme after toggle
                        var body = document.body;
                        var currentTheme = body.classList.contains('dark-mode') ? 'dark-mode' : 'light-mode';

                        // Save to localStorage
                        saveTheme(currentTheme);
                    }, 100); // Small delay to let original toggle finish
                });
            }
        });
    })();
</script>

<!-- Custom Scripts for Page -->
<?php if (isset($extra_scripts))
    echo $extra_scripts; ?>

</body>

</html>