<footer class="site_footer">
  <div class="container">
    <div class="row gy-4">

      <!-- Logo & Text -->
      <div class="col-lg-3 col-md-6">
        <div class="footer_logo">
          <a href="<?php echo base_url(); ?>" class="brand"><img src="<?php echo base_url(); ?>assets/images/footer-logo.webp" alt="logo"></a>
          <p>Your trusted source for fresh, wholesome Makhana snacks.</p>
        </div>
      </div>

      <!-- Quick Links -->
      <div class="col-lg-3 col-md-6">
        <h5 class="footer_title">Quick Link</h5>
        <ul class="footer_links">
          <li><a href="<?php echo base_url(); ?>#about">About Us</a></li>
          <li><a href="<?php echo base_url(); ?>#product">Products</a></li>
          <li><a href="<?php echo base_url(); ?>#benefits">Benefits</a></li>
          <li><a href="<?php echo base_url(); ?>#why-choose-us">Why Choose Us</a></li>
          <li><a href="<?php echo base_url('privacy-policy'); ?>">Privacy Policy</a></li>
          <li><a href="<?php echo base_url('terms-conditions'); ?>">Termes & Conditions</a></li>
        </ul>
      </div>

      <!-- Contact Us -->
      <div class="col-lg-3 col-md-6">
        <h5 class="footer_title">Contact Us</h5>
        <ul class="footer_contact">
          <li class="phone"><a href="tel:0522 3103592">0522 3103592</a></li>
          <li class="whatsapp"><a href="https://wa.me/8299582945?text=Need info on product" target="_blank">8299582945</a></li>
          <li class="email"><a href="mailto:sales@thedsenterprises.com">sales@thedsenterprises.com</a></li>
          <li class="location">S 25/231 D-K-4, Hans Nagar Colony, Sarsauli, Varanasi, Uttar Pradesh - 221002</li>
        </ul>
      </div>

      <!-- Social -->
      <div class="col-lg-3 col-md-6">
        <h5 class="footer_title">Social Contacts</h5>
        <div class="footer_social">
          <a href="javascript:void(0)" target="_blank"><img src="<?php echo base_url(); ?>assets/images/footer-facebook-icon.webp" alt="facebook"></a>
          <a href="javascript:void(0)" class="ms-3" target="_blank"><img src="<?php echo base_url(); ?>assets/images/footer-insta-icon.webp" alt="insta"></a>
        </div>
      </div>

    </div>

    <div class="footer_bottom">
      Copyright © 2026 All Seasons Makhana - All Rights Reserved.
    </div>
  </div>
</footer>

<section class="whatsapp_icon">
  <!-- Popup Box -->
  <div class="whatsapp_popup">
    <span class="popup_close">&times;</span>
  </div>

  <!-- WhatsApp Button -->
  <div class="whatsapp_icon_block">
    <i class="fa-brands fa-whatsapp"></i>
  </div>
</section>

<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.5/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script>
<script src="<?php echo base_url(); ?>plugins/toastr/toastr.min.js"></script>
<script src="<?php echo base_url(); ?>assets/js/main.js"></script>
<script type="text/javascript">
  $('#main-slider999').owlCarousel({
    loop: true,
    dots: true,
    autoplay: true,
    autoplayTimeout: 1500,
    autoplayHoverPause: true,
    responsiveClass: true,
    nav: true,
    navText: [
      '<img src="<?php echo base_url(); ?>assets/images/slider-left-icon.webp" class="owl-custom-arrow" alt="Prev">',
      '<img src="<?php echo base_url(); ?>assets/images/slider-right-icon.webp" class="owl-custom-arrow" alt="Next">'
    ],
    responsive: {
      0: {
        items: 1,
        nav: false
      },
      576: {
        items: 2,
        nav: false
      },
      992: {
        items: 3,
        nav: true,
        dots: true
      },
      1500: {
        items: 3,
        nav: true,
        dots: true
      }
    }
  });

  document.querySelectorAll('.faq-question').forEach(btn => {
    btn.addEventListener('click', () => {
      const item = btn.parentElement;
      document.querySelectorAll('.faq-item').forEach(i => {
        if (i !== item) i.classList.remove('active');
      });
      item.classList.toggle('active');
    });
  });

  function toggleOrderDetails() {
    const box = document.getElementById('orderExtra');
    const btnText = document.querySelector('.btn-text');
    const arrow = document.querySelector('.arrow-icon');
    if (box.style.display === 'block') {
      box.style.display = 'none';
      btnText.innerText = 'View More';
      arrow.classList.remove('rotate');
    } else {
      box.style.display = 'block';
      btnText.innerText = 'View Less';
      arrow.classList.add('rotate');
    }
  }

  $(document).ready(function() {

    // Toggle popup on WhatsApp icon click
    $('.whatsapp_icon_block').on('click', function(e) {
      e.stopPropagation();

      if ($('.whatsapp_popup').is(':visible')) {
        $('.whatsapp_popup').fadeOut(200);
      } else {
        $('.whatsapp_popup').fadeIn(200);
      }
    });

    // Close popup on cross button
    $('.popup_close').on('click', function(e) {
      e.stopPropagation();
      $('.whatsapp_popup').fadeOut(200);
    });

    // Prevent closing when clicking inside popup
    $('.whatsapp_popup').on('click', function(e) {
      e.stopPropagation();
    });

    // Close popup when clicking anywhere on body
    $(document).on('click', function() {
      $('.whatsapp_popup').fadeOut(200);
    });
  });

  $(document).ready(function() {

    $(".cod-header").on("click", function(e) {
      e.stopPropagation();

      $("#codBox").toggleClass("active");
      $(".cod-body").slideToggle(200);
    });

    $(document).on("click", function() {
      if ($("#codBox").hasClass("active")) {
        $("#codBox").removeClass("active");
        $(".cod-body").slideUp(200);
      }
    });

  });
</script>

<script>
  $(document).ready(function () {
    $(".alert").delay(2000).fadeOut(2000);
  });
  
  var csrfGName = '<?php echo $this->security->get_csrf_token_name(); ?>';
  var csrfGHash = '<?php echo $this->security->get_csrf_hash(); ?>';
  
  $(document).ready(function () {
    $("#crdAddMgs").delay(2000).fadeOut(2000);
  });

  $(document).ready(function() {
    let csrfName = $('input[name="<?= $this->security->get_csrf_token_name(); ?>"]').attr('name');
    let csrfHash = $('input[name="<?= $this->security->get_csrf_token_name(); ?>"]').val();
    $("#contactForm").validate({
      rules: {
        full_name: {
          required: true,
          minlength: 3
        },
        email: {
          required: true,
          email: true
        },
        phone: {
          required: true,
          minlength: 10
        },
        address: {
          required: true
        },
        message: {
          required: true,
          minlength: 10
        }
      },
      messages: {
        full_name: {
          required: "Please enter your full name",
          minlength: "Your name must be at least 3 characters long"
        },
        email: {
          required: "Please enter your email id",
          email: "Please enter a valid email id"
        },
        phone: {
          required: "Please enter your phone number",
          minlength: "Your phone number must be at least 10 digits"
        },
        address: {
          required: "Please enter your address",
        },
        message: {
          required: "Please enter your message",
          minlength: "Your message must be at least 10 characters long"
        }
      },
      submitHandler: function(form) {
        let formData = $(form).serializeArray();
        formData.push({
          name: csrfName,
          value: csrfHash
        });
        $.ajax({
          url: "<?php echo base_url('save-contact-us'); ?>",
          type: "POST",
          data: formData,
          dataType: "json",
          success: function(res) {
            csrfHash = res.csrfHash;
            $('input[name="' + csrfName + '"]').val(csrfHash);
            if (res.status === 'success') {
              $('#responseMsg').html('<div class="alert alert-success">' + res.message + '</div>').show().fadeOut(4000);
              form.reset();
            } else {
              let errors = '';
              $.each(res.errors, function(key, value) {
                errors += value + '<br>';
              });
              $('#responseMsg').html('<div class="alert alert-danger">' + errors + '</div>').show().fadeOut(4000);
            }
          }
        });
      }
    });
  });

  
  $('.plus').click(function() {
    let rowid = $(this).data('rowid');
    let qty = parseInt($(this).prev().text()) + 1;
    updateProductQty(rowid, qty);
  });

  $('.minus').click(function() {
    let rowid = $(this).data('rowid');
    let qty = parseInt($(this).next().text()) - 1;
    if (qty < 1) return false;
    updateProductQty(rowid, qty);
  });

  function updateProductQty(rowid, qty) {
    $.post("<?php echo base_url('cart/updateProductQty'); ?>", {
      rowid: rowid, qty: qty, [csrfGName]: csrfGHash }, function(){
        location.reload();
    });
  }
  
</script>
</body>

</html>