<!-- Registration Modal -->
<div id="registerModal" class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50 hidden">
    <div class="relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white">
        <!-- Modal Header -->
        <div class="flex justify-between items-center pb-3">
            <h3 class="text-lg font-semibold text-gray-900">নতুন অ্যাকাউন্ট তৈরি করুন</h3>
            <button type="button" class="text-gray-400 hover:text-gray-600" onclick="closeRegisterModal()">
                <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
                </svg>
            </button>
        </div>

        <!-- Modal Content -->
        <div class="mt-3">
            <!-- Error Messages -->
            <div id="registerErrors" class="mb-4 p-4 bg-red-100 border border-red-400 text-red-700 rounded-lg hidden">
                <ul id="registerErrorsList" class="list-disc list-inside"></ul>
            </div>

            <!-- Success Messages -->
            <div id="registerSuccess" class="mb-4 p-4 bg-green-100 border border-green-400 text-green-700 rounded-lg hidden">
                <span id="registerSuccessMessage"></span>
            </div>

            <!-- Registration Form - Step 1: Name + Phone -->
            <form id="registerForm">
                @csrf
                
                <!-- Name -->
                <div class="mb-4">
                    <label for="reg_name" class="block text-sm font-medium text-gray-700 mb-2">পূর্ণ নাম</label>
                    <input type="text" id="reg_name" name="name" 
                           class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
                           placeholder="আপনার পূর্ণ নাম লিখুন" required>
                </div>

                <!-- Phone Number -->
                <div class="mb-4">
                    <label for="reg_phone" class="block text-sm font-medium text-gray-700 mb-2">ফোন নম্বর</label>
                    <input type="tel" id="reg_phone" name="phone" 
                           class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
                           placeholder="01XXXXXXXXX" required inputmode="numeric" maxlength="11">
                </div>

                <!-- Submit Button -->
                <div class="flex items-center justify-between">
                    <button type="submit" id="registerSubmitBtn"
                            class="w-full bg-green-600 text-white px-4 py-2 rounded-md hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 transition-colors">
                        <span id="registerBtnText">নিবন্ধন</span>
                        <span id="registerBtnLoading" class="hidden">
                            <svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-white inline" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
                                <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
                                <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
                            </svg>
                            প্রক্রিয়াকরণ হচ্ছে...
                        </span>
                    </button>
                </div>
            </form>

            <!-- Login Link -->
            <div class="mt-4 text-center">
                <p class="text-sm text-gray-600">
                    ইতিমধ্যে অ্যাকাউন্ট আছে? 
                    <a href="#" onclick="switchToLoginModal()" class="text-blue-600 hover:text-blue-500 font-medium">এখানে লগইন করুন</a>
                </p>
            </div>
        </div>
    </div>
</div>
