document.addEventListener('DOMContentLoaded', function() {
    var ctx = document.getElementById('balanceChart').getContext('2d');
    var balanceChart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            datasets: [{
                label: 'Balance',
                data: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120],
                borderColor: 'rgba(75, 192, 192, 1)',
                borderWidth: 2,
                fill: false,
            }]
        },
        options: {
            responsive: true,
            scales: {
                x: {
                    display: true,
                    title: {
                        display: true,
                        text: 'Month'
                    }
                },
                y: {
                    display: true,
                    title: {
                        display: true,
                        text: 'Balance'
                    }
                }
            }
        }
    });
});


document.addEventListener('DOMContentLoaded', () => {
    const modal = document.getElementById('depositModal');
    const btn = document.querySelector('.exchange button[type="submit"]');
    const span = document.querySelector('.modal .close');
    const closeModalBtn = document.getElementById('closeModal');
    const copyButton = document.getElementById('copyButton');
    const textToCopy = document.getElementById('textToCopy').textContent;
  
    // Open the modal
    btn.addEventListener('click', (event) => {
      event.preventDefault();
      modal.style.display = 'block';
    });
  
    // Close the modal when the 'x' is clicked
    span.addEventListener('click', () => {
      modal.style.display = 'none';
    });
  
    // Close the modal when the 'Sent' button is clicked
    closeModalBtn.addEventListener('click', () => {
      modal.style.display = 'none';
    });
  
    // Copy text to clipboard
    copyButton.addEventListener('click', () => {
      navigator.clipboard.writeText(textToCopy).then(() => {
        alert('Text copied to clipboard');
      }).catch(err => {
        console.error('Failed to copy text: ', err);
      });
    });
  
    // Close the modal if the user clicks anywhere outside of the modal
    window.addEventListener('click', (event) => {
      if (event.target === modal) {
        modal.style.display = 'none';
      }
    });
  });
  