<?php
$footer_text = $settings['footer_text'] ?? ('&copy; ' . date('Y') . ' ' . $site_name . '. All rights reserved.');
$current_page = basename($_SERVER['PHP_SELF']);
?>
</div> <!-- end container mt-4 from header -->

<footer class="mt-5 pt-5 pb-4 border-top border-light bg-white d-none d-lg-block">
    <div class="container">
        <div class="row g-4">
            <div class="col-lg-4">
                <a class="navbar-brand d-flex align-items-center mb-3" href="index.php">
                    <img src="<?php echo $site_logo; ?>" alt="Logo" style="height: 30px; margin-right: 10px;">
                    <span class="fw-bold"><?php echo $site_name; ?></span>
                </a>
                <p class="text-muted small pe-lg-5">
                    <?php echo $settings['site_description'] ?? '我们提供全球优质软件账号服务，支持 24 小时自动发货，质保无忧。'; ?>
                </p>
                <div class="mt-3">
                    <a href="<?php echo $tg_link; ?>" target="_blank" class="btn btn-primary rounded-pill px-4">
                        <i class="bi bi-telegram me-2"></i> 联系客服
                    </a>
                </div>
            </div>
            <div class="col-6 col-lg-2">
                <h6 class="text-dark fw-bold mb-3">产品中心</h6>
                <a href="index.php" class="footer-link">所有分类</a>
                <a href="orders.php" class="footer-link">订单查询</a>
                <a href="help.php" class="footer-link">帮助中心</a>
            </div>
            <div class="col-6 col-lg-2">
                <h6 class="text-dark fw-bold mb-3">用户支持</h6>
                <a href="faq.php" class="footer-link">常见问题</a>
                <a href="policy.php" class="footer-link">服务协议</a>
            </div>
            <div class="col-lg-4">
                <h6 class="text-dark fw-bold mb-3">联系我们</h6>
                <p class="text-muted small mb-2">
                    <i class="bi bi-telegram text-primary me-2"></i> 官方客服：<a href="<?php echo $tg_link; ?>" class="text-decoration-none text-primary fw-bold" target="_blank">点击跳转</a>
                </p>
                <p class="text-muted small mb-2">
                    <i class="bi bi-envelope text-primary me-2"></i> 售后邮箱：support@hao-soft.world
                </p>
                <div class="mt-4">
                    <img src="https://img.shields.io/badge/USDT-Accepted-blue?style=flat-square&logo=tether" alt="USDT">
                    <img src="https://img.shields.io/badge/Security-Protected-green?style=flat-square&logo=bitdefender" alt="Security">
                </div>
            </div>
        </div>
        <hr class="my-4 border-light">
        <div class="row align-items-center">
            <div class="col-md-6 text-center text-md-start">
                <p class="text-muted small mb-0"><?php echo $footer_text; ?></p>
            </div>
            <div class="col-md-6 text-center text-md-end mt-2 mt-md-0">
                <a href="#" class="text-muted small text-decoration-none me-3">隐私权政策</a>
                <a href="#" class="text-muted small text-decoration-none">退款政策</a>
            </div>
        </div>
    </div>
</footer>

<!-- Mobile Bottom Navigation -->
<div class="mobile-bottom-nav d-lg-none">
    <a href="index.php" class="mobile-nav-item <?php echo $current_page == 'index.php' ? 'active' : ''; ?>">
        <i class="bi bi-house-door<?php echo $current_page == 'index.php' ? '-fill' : ''; ?>"></i>
        <span>首页</span>
    </a>
    <a href="search.php" class="mobile-nav-item <?php echo $current_page == 'search.php' ? 'active' : ''; ?>">
        <i class="bi bi-grid<?php echo $current_page == 'search.php' ? '-fill' : ''; ?>"></i>
        <span>分类</span>
    </a>
    <a href="cart.php" class="mobile-nav-item <?php echo $current_page == 'cart.php' ? 'active' : ''; ?>">
        <i class="bi bi-cart3<?php echo $current_page == 'cart.php' ? '-fill' : ''; ?>"></i>
        <span>购物车</span>
    </a>
    <a href="orders.php" class="mobile-nav-item <?php echo $current_page == 'orders.php' ? 'active' : ''; ?>">
        <i class="bi bi-person<?php echo $current_page == 'orders.php' ? '-fill' : ''; ?>"></i>
        <span>我的订单</span>
    </a>
</div>

<!-- Floating TG Button -->
<a href="<?php echo $tg_link; ?>" target="_blank" class="floating-tg">
    <i class="bi bi-send-fill"></i>
</a>

<!-- Scripts -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>

</body>
</html>
