
// const collapse = document.querySelectorAll(".click-collapse");

// [].forEach.call(collapse, function (event) {
//   event.addEventListener(
//     "click",
//     function (e) {
//       e.target.parentNode.classList.toggle("active");

//       slideToggle(event.nextElementSibling, 350);
//     },
//     false 
//   );
// });


// const slideUp = (target, duration = 350) => {
//   target.style.transitionProperty = "height, margin, padding";
//   target.style.transitionDuration = `${duration}ms`;
//   target.style.height = `${target.offsetHeight}px`;
//   target.offsetHeight; // Reflow
//   target.style.overflow = "hidden";
//   target.style.height = 0;
//   target.style.paddingTop = 0;
//   target.style.paddingBottom = 0;
//   target.style.marginTop = 0;
//   target.style.marginBottom = 0;

//   setTimeout(() => {
//     target.style.display = "none";
//     [
//       "height",
//       "margin-top",
//       "margin-bottom",
//       "padding-top",
//       "padding-bottom",
//       "overflow",
//       "transition-duration",
//       "transition-property",
//     ].forEach((prop) => {
//       target.style.removeProperty(prop);
//     });
//   }, duration);
// };

// const slideDown = (target, duration = 350) => {
//   target.style.removeProperty("display");
//   let display = window.getComputedStyle(target).display;
//   if (display === "none") display = "block";
//   target.style.display = display;
//   const height = target.offsetHeight;
//   target.style.overflow = "hidden";
//   target.style.height = 0;
//   target.offsetHeight; // Reflow
//   target.style.transitionProperty = "height, margin, padding";
//   target.style.transitionDuration = `${duration}ms`;
//   target.style.height = `${height}px`;

//   setTimeout(() => {
//     [
//       "height",
//       "overflow",
//       "transition-duration",
//       "transition-property",
//     ].forEach((prop) => {
//       target.style.removeProperty(prop);
//     });
//   }, duration);
// };

// const slideToggle = (target, duration = 350) => {
//   if (window.getComputedStyle(target).display === "none") {
//     slideDown(target, duration);
//   } else {
//     slideUp(target, duration);
//   }
// };

// document.querySelectorAll(".table-collapse-plus").forEach((span) => {
//   span.addEventListener("click", (e) => {
//     e.preventDefault();

//     const parentRow = span.closest(".table-collapse-title");
//     parentRow.classList.toggle("open");

//     const nextRow = parentRow.nextElementSibling;

//     if (nextRow) {
//       nextRow.classList.toggle("open");
//       slideToggle(nextRow, 350);
//     }
//   });
// });

// window.addEventListener("resize", () => {
//   if (window.innerWidth > 992) {
//     document.querySelectorAll(".table-collapse-content").forEach((row) => {
//       row.classList.remove("open");
//       row.previousElementSibling.classList.remove("open");
//       row.style.removeProperty("display");
//     });
//   }
// });
document.querySelectorAll(".collapse-plus").forEach((button) => {
  button.addEventListener("click", (e) => {
    e.preventDefault();

    const parent = button.closest(".collapse-title");
    if (parent) {
      parent.classList.toggle("active");
    }
  });
});


