{% extends 'public_base.html' %}
{% load static %}

{% block title %}Book an Appointment - RegisterYourStartup.com{% endblock %}
{% block meta_description %}Schedule a consultation with our business experts. Book an appointment for personalized guidance on incorporation, compliance, and business growth strategies.{% endblock %}

{% block content %}
<style>
    /* Glassmorphism Effect */
    .glass {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    /* Custom Scrollbar */
    ::-webkit-scrollbar { width: 8px; }
    ::-webkit-scrollbar-track { background: #f1f1f1; }
    ::-webkit-scrollbar-thumb { background: #6b7280; border-radius: 4px; }
    /* Smooth animations */
    .hover-lift { transition: transform 0.3s ease, box-shadow 0.3s ease; }
    .hover-lift:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); }
    /* Gradient text */
    .gradient-text { background: linear-gradient(90deg, #4f46e5, #7c3aed); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
    
    /* Appointment Form Styles */
    :root {
        --bg-color: #f8fafc;
        --text-color: #1f2937;
        --accent-color: #4f46e5;
        --input-border: #4f46e5;
        --button-bg: #4f46e5;
        --button-text: #ffffff;
        --card-bg: #ffffff;
    }
    
    .appointment-form-section {
        background-color: var(--bg-color);
        color: var(--text-color);
        padding: 3rem 1rem;
        min-height: 100vh;
        display: flex;
        align-items: center;
    }

    .appointment-form-container {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        flex-wrap: wrap;
        gap: 3rem;
        justify-content: center;
        align-items: flex-start;
    }

    .appointment-form-wrapper {
        flex: 1;
        min-width: 400px;
        background: var(--card-bg);
        padding: 2rem;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .appointment-form-wrapper label {
        color: var(--text-color);
        font-weight: 600;
        display: block;
        margin-bottom: 0.5rem;
    }

    .appointment-form-wrapper input,
    .appointment-form-wrapper textarea,
    .appointment-form-wrapper select {
        border: 1px solid var(--input-border);
        border-radius: 8px;
        padding: 0.75rem;
        width: 100%;
        margin-bottom: 1rem;
        background: var(--card-bg);
        color: var(--text-color);
        font-size: 1rem;
        transition: all 0.3s ease;
    }

    .appointment-form-wrapper input:focus,
    .appointment-form-wrapper textarea:focus,
    .appointment-form-wrapper select:focus {
        outline: none;
        border-color: #7c3aed;
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    }

    .appointment-form-wrapper input::placeholder,
    .appointment-form-wrapper textarea::placeholder {
        color: #9ca3af;
    }

    .appointment-form-wrapper .btn-submit {
        background: linear-gradient(90deg, #4f46e5, #7c3aed);
        color: var(--button-text);
        font-weight: bold;
        border: none;
        padding: 0.75rem 1.5rem;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s ease;
        width: 100%;
        font-size: 1.1rem;
    }

    .appointment-form-wrapper .btn-submit:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
    }

    .benefits-wrapper {
        flex: 1;
        min-width: 400px;
    }

    .appointment-heading {
        font-size: 3.5rem;
        font-weight: bold;
        color: var(--text-color);
        margin-bottom: 1rem;
        line-height: 1.1;
    }

    .appointment-subheading {
        font-size: 1.2rem;
        color: var(--text-color);
        margin-bottom: 2rem;
        max-width: 500px;
    }

    @media (max-width: 768px) {
        .appointment-form-container {
            flex-direction: column;
            align-items: center;
        }

        .appointment-heading {
            font-size: 2.5rem;
            text-align: center;
        }

        .appointment-form-wrapper,
        .benefits-wrapper {
            min-width: 100%;
        }
    }

    .error {
        color: #dc2626;
        font-size: 0.875rem;
        margin-top: -0.5rem;
        margin-bottom: 1rem;
        display: block;
    }

    /* Benefits Section */
    .benefits-section {
        background: linear-gradient(135deg, #4f46e5, #7c3aed);
        color: white;
        padding: 2rem;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .benefit-item {
        margin-bottom: 1.5rem;
        display: flex;
        align-items: flex-start;
    }

    .benefit-icon {
        margin-right: 15px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.2);
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .benefit-title {
        font-weight: 600;
        margin-bottom: 5px;
        font-size: 1.1rem;
    }

    .benefit-description {
        color: rgba(255, 255, 255, 0.9);
        line-height: 1.4;
    }

    .success-message {
        background: #d1fae5;
        color: #065f46;
        padding: 1.5rem;
        border-radius: 12px;
        border: 1px solid #a7f3d0;
        margin-bottom: 2rem;
        text-align: center;
        font-size: 1.1rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    }
</style>

<!-- Hero Section -->
<section class="py-16 md:py-24 bg-[#B6C3FD]">
    <div class="container mx-auto px-4">
        <div class="flex flex-col md:flex-row items-center">
            <div class="md:w-1/2 mb-10 md:mb-0">
                <h1 class="pt-10 text-4xl md:text-5xl font-extrabold text-gray-900 mb-4 leading-tight">
                    Book an <span class="gradient-text">Appointment</span>
                </h1>
                <p class="text-lg text-gray-700 mb-8 max-w-xl">
                    Schedule a consultation with our business experts. Get personalized guidance on incorporation, compliance, and growth strategies tailored to your needs.
                </p>
                <div class="flex flex-col sm:flex-row space-y-4 sm:space-y-0 sm:space-x-4">
                    <a href="#appointment-form" class="bg-indigo-600 text-white px-8 py-3 rounded-full font-medium hover:bg-indigo-700 transition text-center">Book Now</a>
                </div>
            </div>
            <div class="md:w-1/2 flex justify-center relative">
                <div class="w-80 h-80 bg-gradient-to-br from-indigo-200 to-purple-200 rounded-full flex items-center justify-center">
                    <i class="fas fa-calendar-check text-6xl text-indigo-600"></i>
                </div>
                <div class="absolute -top-4 -right-4 w-40 h-40 bg-gradient-to-br from-pink-200 to-orange-200 rounded-full opacity-70"></div>
                <div class="absolute -bottom-4 -left-4 w-32 h-32 bg-gradient-to-br from-green-200 to-blue-200 rounded-full opacity-70"></div>
            </div>
        </div>
    </div>
</section>

<!-- Appointment Form Section -->
<section id="appointment-form" class="appointment-form-section">
    <div class="appointment-form-container">

        <!-- Django Messages (Success / Error) -->
        {% if messages %}
            <div class="w-full max-w-4xl mx-auto mb-8">
                {% for message in messages %}
                    <div class="success-message">
                        {{ message|safe }}
                    </div>
                {% endfor %}
            </div>
        {% endif %}

        <!-- Left: Appointment Form -->
        <div class="appointment-form-wrapper">
            <h2 class="text-2xl font-bold mb-6 text-center" style="color: var(--text-color);">Schedule Your Consultation</h2>
            <form method="post" class="vertical-form">
                {% csrf_token %}

                <!-- All your form fields unchanged -->
                <div class="form-group">
                    <label for="fullName">Full Name</label>
                    <input id="fullName" name="fullName" class="form-control" placeholder="Enter your full name" required type="text">
                    <span id="fullName-error" class="error"></span>
                </div>

                <div class="form-group">
                    <label for="email">Email</label>
                    <input id="email" name="email" class="form-control" placeholder="Enter your email" required type="email">
                    <span id="email-error" class="error"></span>
                </div>

                <div class="form-group">
                    <label for="phone">Phone Number</label>
                    <input id="phone" name="phone" class="form-control" placeholder="Enter your phone number" required type="tel">
                    <span id="phone-error" class="error"></span>
                </div>

                <div class="form-group">
                    <label for="meetingWith">Meet with</label>
                    <select id="meetingWith" name="meetingWith" required>
                        <option value="">Select an expert</option>
                        <option value="business-consultant">Lawyer (Business Consultation)</option>
                        <option value="compliance-specialist">Chartered Accountant (CA)</option>
                        <option value="incorporation-expert">Company Secretary</option>
                    </select>
                    <span id="meetingWith-error" class="error"></span>
                </div>

                <div class="form-group">
                    <label for="appointmentDateTime">Appointment Date & Time</label>
                    <input type="datetime-local" id="appointmentDateTime" name="appointmentDateTime" required>
                    <span id="appointmentDateTime-error" class="error"></span>
                </div>

                <div class="form-group">
                    <label for="notes">Notes (Optional)</label>
                    <textarea id="notes" name="notes" rows="4" class="form-control" placeholder="Any specific questions or topics you'd like to discuss?"></textarea>
                </div>

                <input class="btn btn-submit" type="submit" value="BOOK APPOINTMENT">
            </form>
        </div>

        <!-- Right: Benefits -->
        <div class="benefits-wrapper">
            <h1 class="appointment-heading">
                Book an appointment with us
            </h1>
            <p class="appointment-subheading">
                Fill out the form to connect with us. During this session, our experts will:
            </p>

            <div id="benefits" class="benefits-section">
                <div class="benefit-item">
                    <div class="benefit-icon">+</div>
                    <div>
                        <div class="benefit-title">Walk you through our services</div>
                        <p class="benefit-description">We provide solutions tailored to your business needs</p>
                    </div>
                </div>
                
                <div class="benefit-item">
                    <div class="benefit-icon">+</div>
                    <div>
                        <div class="benefit-title">Answer your specific questions</div>
                        <p class="benefit-description">Get actionable insights for your business</p>
                    </div>
                </div>
                
                <div class="benefit-item">
                    <div class="benefit-icon">+</div>
                    <div>
                        <div class="benefit-title">Expert Guidance</div>
                        <p class="benefit-description">Receive personalized advice from specialists in incorporation, compliance, and business growth</p>
                    </div>
                </div>
                
                <div class="benefit-item">
                    <div class="benefit-icon">+</div>
                    <div>
                        <div class="benefit-title">Time-Saving Efficiency</div>
                        <p class="benefit-description">Streamlined consultations help you get clear answers quickly</p>
                    </div>
                </div>
                
                <div class="benefit-item">
                    <div class="benefit-icon">+</div>
                    <div>
                        <div class="benefit-title">Comprehensive Support</div>
                        <p class="benefit-description">From starting a business to managing operations globally, we've got you covered</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- CTA Section -->
<section class="py-16 bg-gradient-to-r from-indigo-500 to-purple-600">
    <div class="container mx-auto px-4 text-center">
        <h2 class="text-3xl md:text-4xl font-bold text-white mb-4">Ready to Grow Your Business?</h2>
        <p class="text-indigo-100 text-lg mb-8 max-w-2xl mx-auto">Book a consultation today and let our expert team guide you through seamless business setup and expansion</p>
        <div class="flex flex-col sm:flex-row justify-center space-y-4 sm:space-y-0 sm:space-x-4">
            <a href="{% url 'contact_us_form' %}" class="bg-white text-indigo-600 px-8 py-3 rounded-full font-medium hover:bg-indigo-50 transition">Contact Us</a>
            <a href="tel:+9192204-33466" class="border border-white text-white px-8 py-3 rounded-full font-medium hover:bg-white hover:text-indigo-600 transition">Call: +91 92204-33466</a>
        </div>
    </div>
</section>

<script>
    // Client-side form validation
    document.addEventListener('DOMContentLoaded', function() {
        const form = document.querySelector('form');
        const fullNameInput = document.getElementById('fullName');
        const emailInput = document.getElementById('email');
        const phoneInput = document.getElementById('phone');
        const meetingWithInput = document.getElementById('meetingWith');
        const appointmentDateTimeInput = document.getElementById('appointmentDateTime');

        form.addEventListener('submit', function(e) {
            let isValid = true;

            // Clear previous errors
            document.querySelectorAll('.error').forEach(error => error.textContent = '');

            // Validate full name
            if (!fullNameInput.value.trim()) {
                document.getElementById('fullName-error').textContent = 'Full name is required';
                isValid = false;
            }

            // Validate email
            if (!emailInput.value.trim()) {
                document.getElementById('email-error').textContent = 'Email is required';
                isValid = false;
            } else {
                const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
                if (!emailRegex.test(emailInput.value)) {
                    document.getElementById('email-error').textContent = 'Please enter a valid email address';
                    isValid = false;
                }
            }

            // Validate phone
            if (!phoneInput.value.trim()) {
                document.getElementById('phone-error').textContent = 'Phone number is required';
                isValid = false;
            }

            // Validate meeting with
            if (!meetingWithInput.value) {
                document.getElementById('meetingWith-error').textContent = 'Please select who you want to meet with';
                isValid = false;
            }

            // Validate appointment date & time
            if (!appointmentDateTimeInput.value) {
                document.getElementById('appointmentDateTime-error').textContent = 'Please select appointment date and time';
                isValid = false;
            } else {
                const selectedDateTime = new Date(appointmentDateTimeInput.value);
                const now = new Date();
                if (selectedDateTime <= now) {
                    document.getElementById('appointmentDateTime-error').textContent = 'Please select a future date and time';
                    isValid = false;
                }
            }

            if (!isValid) {
                e.preventDefault();
            }
        });
    });
</script>
{% endblock %}