// Email validation and OTP trigger
// Check if email exists
isOtpVerified = false; // Reset OTP verification when email changes
$('#otp-input').val(''); // Clear OTP input
$('#otp-error, #otp-success').html(''); // Clear messages
// Send OTP
$('#otp-input').focus(); // Focus on OTP input
console.log('Error:', xhr.responseJSON); // Debug log
// Verify OTP on input
console.log('Verify Error:', xhr.responseJSON); // Debug log
clearInterval(otpTimer); // Clear any existing timer
let timeLeft = 120; // 2 minutes
// Enable register button only when email is valid AND OTP is verified
// Form submission validation
// Additional validation
// Reset OTP verification when email changes
// Other existing scripts remain the same...