document.addEventListener('DOMContentLoaded', function () {
  const burgerBtn = document.getElementById('burger');
  const navMenu = document.getElementById('nav-menu');

  burgerBtn.addEventListener('click', function () {
    navMenu.classList.toggle('active');
    burgerBtn.classList.toggle('active');
  });
});
document.querySelectorAll('.nav-link-in').forEach(item => {
  item.addEventListener('click', () => {
    document.querySelectorAll('.nav-link-in').forEach(link => {
      link.classList.remove('active');
    });
    item.classList.add('active');
  });
});

window.onscroll = function () {
  const header = document.querySelector('.main-header');
  const sticky = header.offsetTop;

  if (window.pageYOffset > sticky) {
    header.classList.add('sticky');
  } else {
    header.classList.remove('sticky');
  }
};




document.addEventListener('DOMContentLoaded', function() {
  const hostingLink = document.querySelector('.nav-item-in .nav-link-in');
  const submenu = hostingLink.nextElementSibling; 
  const navItem = hostingLink.closest('.nav-item-in');  

  hostingLink.addEventListener('click', function(event) {
      event.preventDefault(); 
      if (submenu.style.display === 'block') {
          submenu.style.display = 'none';  
      } else {
          submenu.style.display = 'block'; 
      }
  });
});



$('.customers-reviews').slick({
  dots: false,
  infinite: true,
  speed: 300,
  slidesToShow: 2,
  slidesToScroll: 1,
  autoplay: true,
  autoplaySpeed: 2000,
  prevArrow: '<span class="icon-slick-prev fa fa-angle-left" aria-hidden="true"></span>',
  nextArrow: '<span class="icon-slick-next fa fa-angle-right" aria-hidden="true"></span>',
  responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 1,
      }
    },
    {
      breakpoint: 768,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1,
        arrows: false
      }
    }
  ]
});






$(document).ready(function () {

  $('.faq_details').hide();
  $('.faq_item:first .faq_details').show();

  $('.faq_title').click(function () {
    if (!$(this).hasClass('active')) {
      $('.faq_title').removeClass('active');
      $('.faq_details').slideUp();
      $(this).addClass('active');
      $(this).next('.faq_details').slideDown();
    } else {
    }
  });
});




// pop modal js

document.addEventListener("DOMContentLoaded", function() {
  const tabs = document.querySelectorAll('.tab');
  const tabContents = document.querySelectorAll('.tab-content');
  tabs.forEach(tab => {
      tab.addEventListener('click', function(event) {
          event.preventDefault();
          tabs.forEach(tab => tab.classList.remove('active'));
          tabContents.forEach(content => content.classList.remove('active'));
          tab.classList.add('active');
          const targetContent = document.querySelector(tab.querySelector('a').getAttribute('href'));
          targetContent.classList.add('active');
      });
  });

  const forms = document.querySelectorAll('form');
  forms.forEach(form => {
      form.addEventListener('submit', function(event) {
          let isValid = true;
          form.querySelectorAll('.quform-input input, .quform-input textarea').forEach(input => {
              const errorMessage = input.parentNode.querySelector('.error-message');
              if (input.value.trim() === '') {
                  errorMessage.style.display = 'inline';
                  isValid = false;
              } else {
                  errorMessage.style.display = 'none';
              }
          });
          if (!isValid) {
              event.preventDefault();
          }
      });
  });
});



// animation js
AOS.init();