<?php
/**
 * TechShop Perú - Footer Global
 * 
 * Pie de página con información de la empresa, enlaces, redes sociales y cobertura.
 * 
 * @package TechShop Perú
 * @version 1.0
 */
?>
</main><!-- /main-content -->

<!-- ============================================
     FOOTER - Información de la empresa
     ============================================ -->
<footer class="site-footer bg-dark text-white pt-5 pb-3">
    <div class="container">
        <div class="row g-4">
            <!-- Columna 1: Info empresa -->
            <div class="col-lg-3 col-md-6">
                <div class="footer-brand mb-3">
                    <span class="brand-icon"><i class="bi bi-cpu"></i></span>
                    <span class="brand-text-footer">TechShop Perú</span>
                </div>
                <p class="text-white-50 small mb-2">
                    Tecnología al alcance de todo el Perú. Las mejores marcas, los mejores precios y envíos a nivel nacional.
                </p>
                <p class="text-white-50 small mb-1">
                    <i class="bi bi-geo-alt me-1"></i> <?= TIENDA_DIRECCION ?>
                </p>
                <p class="text-white-50 small mb-1">
                    <a href="tel:<?= e(preg_replace('/[^0-9+]/', '', TIENDA_TELEFONO)) ?>" class="text-white-50 text-decoration-none footer-contact-link">
                        <i class="bi bi-telephone me-1"></i> <?= TIENDA_TELEFONO ?>
                    </a>
                </p>
                <p class="text-white-50 small mb-1">
                    <a href="mailto:<?= e(TIENDA_EMAIL) ?>" class="text-white-50 text-decoration-none footer-contact-link">
                        <i class="bi bi-envelope me-1"></i> <?= TIENDA_EMAIL ?>
                    </a>
                </p>
                <p class="text-white-50 small">
                    <a href="https://wa.me/<?= preg_replace('/[^0-9]/', '', TIENDA_WHATSAPP) ?>" target="_blank" rel="noopener" class="text-white-50 text-decoration-none footer-contact-link">
                        <i class="bi bi-whatsapp me-1"></i> <?= TIENDA_WHATSAPP ?>
                    </a>
                </p>
            </div>

            <!-- Columna 2: Categorías -->
            <div class="col-lg-3 col-md-6">
                <h5 class="text-white mb-3 footer-title">Categorías</h5>
                <ul class="list-unstyled footer-links">
                    <?php
                    if (empty($categorias_menu)) {
                        try {
                            $stmt = db()->query('SELECT nombre, slug FROM categorias WHERE activo = 1 ORDER BY orden LIMIT 8');
                            $categorias_menu = $stmt->fetchAll();
                        } catch (PDOException $e) {
                            $categorias_menu = [];
                        }
                    }
                    foreach ($categorias_menu as $cat):
                    ?>
                    <li class="mb-1">
                        <a href="<?= url('pages/productos.php?categoria=' . $cat['slug']) ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> <?= e($cat['nombre']) ?>
                        </a>
                    </li>
                    <?php endforeach; ?>
                </ul>
            </div>

            <!-- Columna 3: Información -->
            <div class="col-lg-3 col-md-6">
                <h5 class="text-white mb-3 footer-title">Información</h5>
                <ul class="list-unstyled footer-links">
                    <li class="mb-1">
                        <a href="<?= url('pages/nosotros.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Sobre Nosotros
                        </a>
                    </li>
                    <li class="mb-1">
                        <a href="<?= url('pages/contacto.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Contacto
                        </a>
                    </li>
                    <li class="mb-1">
                        <a href="<?= url('pages/faq.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Preguntas Frecuentes
                        </a>
                    </li>
                    <li class="mb-1">
                        <a href="<?= url('pages/terminos.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Términos y Condiciones
                        </a>
                    </li>
                    <li class="mb-1">
                        <a href="<?= url('pages/privacidad.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Políticas de Privacidad
                        </a>
                    </li>
                    <li class="mb-1">
                        <a href="<?= url('pages/garantias.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Políticas de Garantía
                        </a>
                    </li>
                    <li class="mb-1">
                        <a href="<?= url('pages/envios.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Políticas de Envío
                        </a>
                    </li>
                    <li class="mb-1">
                        <a href="<?= url('pages/soporte.php') ?>" class="text-white-50 small text-decoration-none">
                            <i class="bi bi-chevron-right small"></i> Soporte / Tickets
                        </a>
                    </li>
                </ul>
            </div>

            <!-- Columna 4: Cobertura y Redes -->
            <div class="col-lg-3 col-md-6">
                <h5 class="text-white mb-3 footer-title">Cobertura Nacional</h5>
                <p class="text-white-50 small mb-2">
                    <i class="bi bi-truck me-1"></i> Realizamos envíos a todo el Perú:
                </p>
                <ul class="list-unstyled text-white-50 small mb-3">
                    <li class="mb-1"><i class="bi bi-check2 text-success me-1"></i> Lima Metropolitana (24-48h)</li>
                    <li class="mb-1"><i class="bi bi-check2 text-success me-1"></i> Costa (2-3 días)</li>
                    <li class="mb-1"><i class="bi bi-check2 text-success me-1"></i> Sierra (3-5 días)</li>
                    <li class="mb-1"><i class="bi bi-check2 text-success me-1"></i> Selva (4-7 días)</li>
                </ul>

                <h5 class="text-white mb-2 footer-title">Síguenos</h5>
                <div class="d-flex gap-2 social-links">
                    <a href="<?= !empty(TIENDA_FACEBOOK) ? e(TIENDA_FACEBOOK) : '#' ?>" class="btn btn-outline-light btn-sm rounded-circle" aria-label="Facebook" target="_blank" rel="noopener" style="width:36px;height:36px;padding:4px;">
                        <i class="bi bi-facebook"></i>
                    </a>
                    <a href="<?= !empty(TIENDA_INSTAGRAM) ? e(TIENDA_INSTAGRAM) : '#' ?>" class="btn btn-outline-light btn-sm rounded-circle" aria-label="Instagram" target="_blank" rel="noopener" style="width:36px;height:36px;padding:4px;">
                        <i class="bi bi-instagram"></i>
                    </a>
                    <a href="<?= !empty(TIENDA_TIKTOK) ? e(TIENDA_TIKTOK) : '#' ?>" class="btn btn-outline-light btn-sm rounded-circle" aria-label="TikTok" target="_blank" rel="noopener" style="width:36px;height:36px;padding:4px;">
                        <i class="bi bi-tiktok"></i>
                    </a>
                    <a href="<?= !empty(TIENDA_YOUTUBE) ? e(TIENDA_YOUTUBE) : '#' ?>" class="btn btn-outline-light btn-sm rounded-circle" aria-label="YouTube" target="_blank" rel="noopener" style="width:36px;height:36px;padding:4px;">
                        <i class="bi bi-youtube"></i>
                    </a>
                    <a href="https://wa.me/<?= str_replace('+', '', TIENDA_WHATSAPP) ?>" class="btn btn-success btn-sm rounded-circle" aria-label="WhatsApp" target="_blank" rel="noopener" style="width:36px;height:36px;padding:4px;">
                        <i class="bi bi-whatsapp"></i>
                    </a>
                </div>

                <div class="mt-3">
                    <span class="badge bg-primary me-1"><i class="bi bi-shield-check me-1"></i> Compra Segura</span>
                    <span class="badge bg-info"><i class="bi bi-truck me-1"></i> Envío Nacional</span>
                </div>
            </div>
        </div>

        <hr class="border-secondary my-4">

        <!-- Métodos de pago y copyright -->
        <div class="row align-items-center">
            <div class="col-md-6 text-center text-md-start mb-2 mb-md-0">
                <small class="text-white-50">
                    &copy; <?= date('Y') ?> TechShop Perú. Todos los derechos reservados. RUC: <?= TIENDA_RUC ?>
                </small>
            </div>
            <div class="col-md-6 text-center text-md-end">
                <small class="text-white-50 me-2">Aceptamos:</small>
                <i class="bi bi-credit-card text-white-50 fs-5 mx-1" title="Tarjeta de crédito"></i>
                <i class="bi bi-cash text-white-50 fs-5 mx-1" title="Efectivo"></i>
                <span class="text-white-50 small mx-1" title="Transferencia">Yape/Plin</span>
            </div>
        </div>
    </div>
</footer>

<!-- ============================================
     BOTÓN WHATSAPP FLOTANTE
     ============================================ -->
<a href="https://wa.me/<?= str_replace('+', '', TIENDA_WHATSAPP) ?>?text=Hola%20TechShop%20Perú,%20quisiera%20información%20sobre:"
   class="whatsapp-float" target="_blank" rel="noopener" aria-label="Chat en WhatsApp">
    <i class="bi bi-whatsapp"></i>
</a>

<!-- Bootstrap JS Bundle -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

<!-- Scripts personalizados -->
<?php $jsVersion = @filemtime(ROOT_PATH . 'assets/js/main.js'); ?>
<script src="<?= ASSETS_URL ?>/js/main.js?v=<?= $jsVersion ?: '1' ?>"></script>

<!-- Schema.org JSON-LD para SEO -->
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "OnlineStore",
  "name": "<?= TIENDA_NOMBRE ?>",
  "url": "<?= BASE_URL ?>",
  "telephone": "<?= TIENDA_TELEFONO ?>",
  "email": "<?= TIENDA_EMAIL ?>",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "<?= TIENDA_DIRECCION ?>",
    "addressCountry": "PE"
  },
  "priceRange": "S/ 50 - S/ 10000",
  "currenciesAccepted": "PEN",
  "paymentAccepted": "Cash, Credit Card, Debit Card",
  "openingHours": "Mo-Sa 09:00-20:00"
}
</script>

</body>
</html>
