// Change profile name
document.addEventListener('DOMContentLoaded', function() {
	const changeProfileNameBtn = document.getElementById('changeProfileName');
	const cancelNameBtn = document.getElementById('cancelNameButton');
	
	if (changeProfileNameBtn) {
		changeProfileNameBtn.addEventListener('click', function() {
			document.getElementById('changeNameForm').style.display = 'block';
			this.style.display = 'none'; // Hide the change button while editing
		});
	}
	
	if (cancelNameBtn) {
		cancelNameBtn.addEventListener('click', function() {
			document.getElementById('changeNameForm').style.display = 'none';
			document.getElementById('changeProfileName').style.display = 'inline-block';
		});
	}

	// Add this to prevent settings.js from interfering with remove button
	const removeButton = document.getElementById('removeProfilePicture');
	if (removeButton) {
		removeButton.addEventListener('click', (event) => {
			event.stopPropagation();
		});
	}
});