clicking the close button
closeButton.addEventListener("click", () => {
  animateCloseDialog();
});

// Close the dialog when clicking on the backdrop
sidePanel.addEventListener("click", (event) => {
  if (event.target === sidePanel) {
    animateCloseDialog();
  }
});

// Animate the dialog closing
function animateCloseDialog() {
  // Animate the panel sliding out
  sidePanel.style.transform = 'translateX(100%)';
  
  // After animation completes, close the dialog
  setTimeout(() => {
    sidePanel.close()