<?php
declare(strict_types=1);
require_once dirname(__DIR__) . '/config.php';
require_once __DIR__ . '/functions.php';
$mail = setting('email', 'info@bhattenterprise.in');
$addr = setting('address', '');
$ph = setting('phone_display', setting('phone', ''));
$svs = array_slice(services_all(), 0, 5);
$y = date('Y');
$socialLinks = [
    'Facebook' => trim(setting('facebook_url', '')),
    'Instagram' => trim(setting('instagram_url', '')),
    'LinkedIn' => trim(setting('linkedin_url', '')),
    'Twitter' => trim(setting('twitter_url', '')),
    'YouTube' => trim(setting('youtube_url', '')),
    'WhatsApp' => trim(setting('whatsapp_url', '')),
];
$socialLinks = array_filter($socialLinks, static fn ($u): bool => $u !== '');
$socialIcons = [
    'Facebook' => 'fa-brands fa-facebook-f',
    'Instagram' => 'fa-brands fa-instagram',
    'LinkedIn' => 'fa-brands fa-linkedin-in',
    'Twitter' => 'fa-brands fa-x-twitter',
    'YouTube' => 'fa-brands fa-youtube',
    'WhatsApp' => 'fa-brands fa-whatsapp',
];
?>
  <footer>
    <section class="ot-footer-2-area ot-footer-layout3">
      <style>
        .footer-pro-brand {
          max-height: 110px;
          width: auto;
          max-width: 100%;
          object-fit: contain;
        }

        .footer-pro-company-title {
          margin-bottom: 14px !important;
          font-size: 40px;
          line-height: 1.1;
        }

        .footer-pro-social a {
          width: 38px;
          height: 38px;
          border-radius: 50%;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          border: 1px solid rgba(255, 255, 255, 0.22);
          margin-right: 8px;
          transition: all 0.25s ease;
        }

        .footer-pro-social a:hover {
          background: var(--ot-theme-color);
          border-color: var(--ot-theme-color);
          color: #ffffff !important;
          transform: translateY(-2px);
        }

        .footer-pro-contact i {
          color: var(--ot-theme-color);
          width: 18px;
          text-align: center;
        }

        .footer-pro-bottom {
          border-top: 1px solid rgba(255, 255, 255, 0.14);
          padding-top: 16px;
        }
      </style>
      <div class="ot-footer-top ot-space-sm pb-55 ot-footer-overlay-3 ot-bg-style theme-black" data-background="<?= asset('assets/img/bg/footer-bg-3-1.jpg') ?>">
        <div class="ot-footer-wrapp z-index-2">
          <div class="container">
            <div class="row justify-content-between">
              <div class="col-xl-4 col-lg-4 col-md-6 col-sm-10">
                <div class="ot-footer-widget footer-col-3-1">
                  <div class="ot-footer-logo mb-20">
                    <a href="index.php">
                      <img src="<?= asset('assets/img/logo/logo-3.png') ?>" class="footer-pro-brand" alt="<?= h(setting('company_name', SITE_NAME)) ?>">
                    </a>
                  </div>
                  <h3 class="ot-footer-title footer-pro-company-title text-white"><?= h(setting('company_name', SITE_NAME)) ?></h3>
                  <p class="ot-sec-text text-white mb-20"><?= h(setting('company_tagline', SITE_TAGLINE)) ?></p>
                  <p class="ot-sec-text text-white small mb-0"><?= h(setting('hours', '')) ?></p>
                </div>
              </div>
              <div class="col-xl-3 col-lg-4 col-md-6">
                <div class="ot-footer-widget footer-col-3-2 ms-lg-5 ms-xl-0 ms-xxl-5">
                  <h3 class="ot-footer-widget-title mb-25">Services</h3>
                  <div class="ot-footer-widget-link">
                    <ul>
                      <?php foreach ($svs as $s): ?>
                        <li>
                          <a href="service-detail.php?slug=<?= urlencode((string)$s['slug']) ?>"><i class="fa-solid fa-angle-right"></i><?= h((string)$s['title']) ?></a>
                        </li>
                      <?php endforeach; ?>
                      <?php if (!$svs): ?>
                        <li><a href="services.php"><i class="fa-solid fa-angle-right"></i>Solar solutions</a></li>
                      <?php endif; ?>
                    </ul>
                  </div>
                </div>
              </div>
              <div class="col-xl-2 col-lg-4 col-md-6">
                <div class="ot-footer-widget footer-col-3-3">
                  <h3 class="ot-footer-widget-title mb-25">Quick links</h3>
                  <div class="ot-footer-widget-link">
                    <ul>
                      <li><a href="index.php"><i class="fa-solid fa-angle-right"></i>Home</a></li>
                      <li><a href="about.php"><i class="fa-solid fa-angle-right"></i>About Us</a></li>
                      <li><a href="portfolio.php"><i class="fa-solid fa-angle-right"></i>Portfolio</a></li>
                      <li><a href="testimonials.php"><i class="fa-solid fa-angle-right"></i>Testimonials</a></li>
                      <li><a href="clients.php"><i class="fa-solid fa-angle-right"></i>Clients</a></li>
                      <li><a href="faq.php"><i class="fa-solid fa-angle-right"></i>FAQs</a></li>
                      <li><a href="careers.php"><i class="fa-solid fa-angle-right"></i>Careers</a></li>
                      <li><a href="contact.php"><i class="fa-solid fa-angle-right"></i>Contact</a></li>
                      <li><a href="terms.php"><i class="fa-solid fa-angle-right"></i>Terms &amp; Conditions</a></li>
                      <li><a href="privacy.php"><i class="fa-solid fa-angle-right"></i>Privacy Policy</a></li>
                    </ul>
                  </div>
                </div>
              </div>
              <div class="col-xl-3 col-lg-4 col-md-6 col-sm-8">
                <div class="ot-footer-widget footer-col-3-4 mb-0">
                  <h3 class="ot-footer-widget-title mb-25">Contact</h3>
                  <div class="footer-pro-contact">
                    <p class="ot-sec-text text-white mb-15"><i class="fa-solid fa-phone me-2"></i><a href="tel:<?= h(preg_replace('/\s+/', '', (string)setting('phone', ''))) ?>" class="text-white"><?= h($ph) ?></a></p>
                    <p class="ot-sec-text text-white mb-15"><i class="fa-solid fa-envelope me-2"></i><a href="mailto:<?= h($mail) ?>" class="text-white"><?= h($mail) ?></a></p>
                    <p class="ot-sec-text text-white mb-0"><i class="fa-solid fa-location-dot me-2"></i><?= h($addr) ?></p>
                  </div>
                  <div class="ot-social-style-2 footer-pro-social mt-20">
                    <?php if ($socialLinks): ?>
                      <?php foreach ($socialLinks as $label => $url): ?>
                        <?php $icon = $socialIcons[$label] ?? 'fa-solid fa-link'; ?>
                        <a href="<?= h($url) ?>" target="_blank" rel="noopener noreferrer" aria-label="<?= h($label) ?>" title="<?= h($label) ?>">
                          <i class="<?= h($icon) ?>"></i>
                        </a>
                      <?php endforeach; ?>
                    <?php else: ?>
                      <a href="https://www.facebook.com/" target="_blank" rel="noopener noreferrer" aria-label="Facebook" title="Facebook"><i class="fa-brands fa-facebook-f"></i></a>
                      <a href="https://www.instagram.com/" target="_blank" rel="noopener noreferrer" aria-label="Instagram" title="Instagram"><i class="fa-brands fa-instagram"></i></a>
                      <a href="https://www.linkedin.com/" target="_blank" rel="noopener noreferrer" aria-label="LinkedIn" title="LinkedIn"><i class="fa-brands fa-linkedin-in"></i></a>
                    <?php endif; ?>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="ot-footer-bottom copyright-space-3 ot-copyright-overlay ot-bg-style"
        data-background="<?= asset('assets/img/bg/copyright-bg-3-1.jpg') ?>">
        <div class="container-fluid">
          <div class="ot-copyright-2 z-index-2 footer-pro-bottom">
            <div class="row align-items-center">
              <div class="col-12" data-cue="slideInUp">
                <div class="ot-copyright-content text-center">
                  <p class="ot-copyright-text text-white mb-0">
                    &copy;<?= h($y) ?> <a href="index.php" class="ot-line-white"><?= h(setting('company_name', SITE_NAME)) ?></a> — All Rights Reserved.
                  </p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
  
    </section>
  </footer>
  <script src="<?= asset('assets/js/vendor/jquery-3.7.1.min.js') ?>"></script>
  <script src="<?= asset('assets/js/bootstrap.bundle.min.js') ?>"></script>
  <script src="<?= asset('assets/js/plugin.js') ?>"></script>
  <script src="<?= asset('assets/js/swiper-bundle.min.js') ?>"></script>
  <script src="<?= asset('assets/js/magnific-popup.min.js') ?>"></script>
  <script src="<?= asset('assets/js/nice-select.js') ?>"></script>
  <script src="<?= asset('assets/js/purecounter.js') ?>"></script>
  <script src="<?= asset('assets/js/imagesloaded-pkgd.js') ?>"></script>
  <script src="<?= asset('assets/js/isotope.pkgd.min.js') ?>"></script>
  <script src="<?= asset('assets/js/anime.js') ?>"></script>
  <script src="<?= asset('assets/js/scrollCue.js') ?>"></script>
  <script src="<?= asset('assets/js/slider-init.js') ?>"></script>
  <script src="<?= asset('assets/js/lenis.min.js') ?>"></script>
  <script src="<?= asset('assets/js/ajax-form.js') ?>"></script>
  <script src="<?= asset('assets/js/main.js') ?>"></script>
</body>
</html>
