                   },
                    body: JSON.stringify({
                        username: username,
                        password: password
                    })
                });

                const data = await response.json();
                console.log('Login response:', data);

                if (data.status === 'success' && data.token) {
                    localStorage.setItem('token', data.token);
                    showMessage('Login successful! Redirecting...', 'success');
   