// Scroll to Top
document.addEventListener('DOMContentLoaded', function () {

    const scrollTopBtn = document.querySelector('.scroll-top-btn');
    const scrollTopLink = document.querySelector('.scroll-top-btn a');

    window.addEventListener('scroll', function () {
        if (!scrollTopBtn) return;

        scrollTopBtn.style.display = window.scrollY > 100 ? 'block' : 'none';
    });

    if (scrollTopLink) {
        scrollTopLink.addEventListener('click', function (e) {
            e.preventDefault();
            window.scrollTo({
                top: 0,
                behavior: 'smooth'
            });
        });
    }
});

// Blog Slider
jQuery(document).ready(function($) {
  const section = $('.blog-section');
  const owl = section.find('.owl-carousel').owlCarousel({
    loop: true,
    nav: true,
    navText: ["<i class='fas fa-chevron-left'></i>", "<i class='fas fa-chevron-right'></i>"],
    dots: false,
    rtl: false,
    autoplay: true,
    responsive: {
      0: {        
        items: 1
      },
      768: {
        margin: 30,
        items: 2
      },
      992: {
        margin: 30,
        items: 3
      }
    }
  });

  const section1 = $('.service-section');
  const owl1 = section1.find('.owl-carousel').owlCarousel({
    loop: false,
    nav: false,
    navText: ["<i class='fas fa-chevron-left'></i>", "<i class='fas fa-chevron-right'></i>"],
    dots: false,
    rtl: false,
    autoplay: true,
    stagePadding: 10,
    responsive: {
      0: {        
        margin: 20,
        items: 1
      },
      768: {
        margin: 20,
        items: 2
      },
      992: {
        margin: 20,
        items: 3
      }
    }
  });
});