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

{% block title %}Contact Us - RegisterYourStartup.com{% endblock %}
{% block meta_description %}Get in touch with RegisterYourStartup.com. Contact our global offices in India, UAE, USA, UK, Saudi Arabia, Malaysia, Singapore, Indonesia, Kenya, and Bangalore.{% 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; }
    
    /* Contact Form Styles - Using template colors */
    :root {
        --bg-color: #f8fafc;
        --text-color: #1f2937;
        --accent-color: #4f46e5;
        --input-border: #4f46e5;
        --button-bg: #4f46e5;
        --button-text: #ffffff;
        --card-bg: #ffffff;
    }
    
    .contact-form-section {
        background-color: var(--bg-color);
        color: var(--text-color);
        padding: 3rem 1rem;
        min-height: 100vh;
        display: flex;
        align-items: center;
    }

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

    .contact-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);
    }

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

    .contact-form-wrapper input,
    .contact-form-wrapper textarea {
        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;
    }

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

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

    .contact-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;
    }

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

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

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

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

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

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

        .contact-form-wrapper,
        .contact-info-wrapper {
            min-width: 100%;
        }
    }

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

    /* Offices Grid */
    .offices-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.5rem;
        margin-top: 2rem;
    }

    .office-card {
        background: var(--card-bg);
        padding: 1.5rem;
        border-radius: 12px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        border-left: 4px solid var(--accent-color);
        transition: all 0.3s ease;
    }

    .office-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

    .office-card h3 {
        color: var(--text-color);
        margin-bottom: 1rem;
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .office-card h3 i {
        color: var(--accent-color);
    }

    .office-card p {
        margin: 0.5rem 0;
        color: #6b7280;
        line-height: 1.4;
    }

    .contact-details {
        background: var(--card-bg);
        padding: 2rem;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        margin-bottom: 2rem;
    }

    .contact-item {
        display: flex;
        align-items: flex-start;
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid #e5e7eb;
    }

    .contact-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .contact-icon {
        background: linear-gradient(90deg, #4f46e5, #7c3aed);
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 1rem;
        flex-shrink: 0;
    }

    .contact-content h4 {
        color: var(--text-color);
        margin-bottom: 0.5rem;
        font-size: 1.1rem;
    }

    .contact-content p {
        color: #6b7280;
        margin: 0.25rem 0;
        line-height: 1.4;
    }

    .section-title {
        color: var(--text-color);
        font-size: 2rem;
        font-weight: bold;
        margin-bottom: 2rem;
        text-align: center;
    }
</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">
                 Contact <span class="gradient-text">Us</span>
                </h1>
                <p class="text-lg text-gray-700 mb-8 max-w-xl">
                    Get in touch with our global team of experts. We're here to help you with business incorporation, compliance, and expansion worldwide.
                </p>
                <div class="flex flex-col sm:flex-row space-y-4 sm:space-y-0 sm:space-x-4">
                    <a href="#offices" class="border border-indigo-600 text-indigo-600 px-8 py-3 rounded-full font-medium hover:bg-indigo-50 transition text-center">Our Offices</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-envelope 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>

<!-- Contact Form Section -->
<section id="contact-form" class="contact-form-section">
    <div class="contact-form-container">

        <!-- Left: Contact Form -->
        <div class="contact-form-wrapper">
            <h2 class="text-2xl font-bold mb-6 text-center" style="color: var(--text-color);">Get In Touch</h2>
            {% if messages %}
            {% for message in messages %}
                    <div class="alert alert-success w-100 text-center mt-4 mb-4" style="background: #d1fae5; color: #065f46; padding: 1.2rem; border-radius: 8px; border: 1px solid #a7f3d0; font-size: 1.1rem;">
                        {{ message|safe }}
                    </div>
                {% endfor %}
            {% endif %}
            <form method="post" class="vertical-form">
                {% csrf_token %}
                <label class="form-label" for="name">Your Name</label>
                <input id="name" name="name" class="form-control" placeholder="Enter your full name" required type="text"
                    {% if user.is_authenticated %}value="{{ user.get_full_name }}"{% endif %}>
                <span id="name-error" class="error"></span>
                <label class="form-label" for="subject">Subject</label>
                <input id="subject" name="subject" class="form-control" placeholder="Enter your subject" required type="text">
                <span id="subject-error" class="error"></span>

                <label class="form-label" for="message">Message</label>
                <textarea id="message" name="message" rows="6" class="form-control" placeholder="Enter your message" required></textarea>
                <span id="message-error" class="error"></span>

                {% if not user.is_authenticated %}
                    <label class="form-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>

                    <label class="form-label" for="phone">Phone (Optional)</label>
                    <input id="phone" name="phone" class="form-control" placeholder="Enter your phone number" type="tel">
                    <span id="phone-error" class="error"></span>
                {% endif %}

                <input class="btn btn-submit" type="submit" value="Send Message">
            </form>

            <!-- ✅ Success message below the form -->
            {% if feedback_submitted %}
                <div class="alert alert-success w-100 text-center mt-4" style="background: #d1fae5; color: #065f46; padding: 1rem; border-radius: 8px; border: 1px solid #a7f3d0;">
                    Thank you for your feedback! We will get back to you shortly. Please use Ticket ID: <strong>{{ ticket_id }}</strong> for future reference.
                </div>
            {% endif %}
        </div>

        <!-- Right: Contact Info -->
        <div class="contact-info-wrapper">
            <h1 class="contact-heading">Contact us</h1>
            <p class="contact-subheading">
                It is very important for us to keep in touch with you, so we are always ready to answer any questions that interest you. Shoot!
            </p>

            <!-- Contact Details -->
            <div class="contact-details">
                <div class="contact-item">
                    <div class="contact-icon">
                        <i class="fas fa-building"></i>
                    </div>
                    <div class="contact-content">
                        <h4>HEAD OFFICE</h4>
                        <p><strong>ADDRESS:</strong></p>
                        <p>D - 878, LGF, New Friends Colony,</p>
                        <p>New Delhi - 110025, India</p>
                    </div>
                </div>

                <div class="contact-item">
                    <div class="contact-icon">
                        <i class="fas fa-phone"></i>
                    </div>
                    <div class="contact-content">
                        <h4>PHONE NUMBERS</h4>
                        <p><strong>Customer Care:</strong> +91 92204 33466</p>
                    </div>
                </div>

                <div class="contact-item">
                    <div class="contact-icon">
                        <i class="fas fa-envelope"></i>
                    </div>
                    <div class="contact-content">
                        <h4>EMAIL</h4>
                        <p>info@registeryourstartup.com</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>


<!-- Global Offices Section -->
<section id="offices" class="py-16 bg-gray-50">
    <div class="container mx-auto px-4">
        <h2 class="section-title">Our Global Offices</h2>
        <div class="offices-grid">
            <!-- UAE Office -->
            <div class="office-card">
                <h3><i class="fas fa-building"></i> U.A.E Office</h3>
                <p><strong>Visalite Global FZCO</strong></p>
                <p>Scality Office No 63, Building No 9WC 523</p>
                <p>PO Box 491, Dubai Airport Freezone</p>
                <p>Dubai, UAE</p>
            </div>

            <!-- USA Office -->
            <div class="office-card">
                <h3><i class="fas fa-flag-usa"></i> U.S. Office</h3>
                <p>3240 E-State Street, Hamilton</p>
                <p>New Jersey 08619</p>
                <p>United States</p>
            </div>

            <!-- UK Office -->
            <div class="office-card">
                <h3><i class="fas fa-landmark"></i> U.K. Office</h3>
                <p>8 Alexandra Road, Worthing</p>
                <p>West Sussex BN 11 2DX</p>
                <p>United Kingdom</p>
            </div>

            <!-- Saudi Arabia Office -->
            <div class="office-card">
                <h3><i class="fas fa-mosque"></i> Saudi Arabia Office</h3>
                <p>Building No. 4219, Al Izdihar Street</p>
                <p>Unit No. 4301, Riyadh 12486</p>
                <p>Saudi Arabia</p>
            </div>

            <!-- Malaysia Office -->
            <div class="office-card">
                <h3><i class="fas fa-university"></i> Malaysia Office</h3>
                <p>Landmark, Suite 1705, Level 17</p>
                <p>12 Jalan Ngee Heng</p>
                <p>80000 Johor Bahru, Johor</p>
                <p>Malaysia</p>
            </div>

            <!-- Singapore Office -->
            <div class="office-card">
                <h3><i class="fas fa-city"></i> Singapore Office</h3>
                <p>3 Shenton Way, #09-07</p>
                <p>Shenton House</p>
                <p>Singapore 068805</p>
            </div>

            <!-- Indonesia Office -->
            <div class="office-card">
                <h3><i class="fas fa-torii-gate"></i> Indonesia Office</h3>
                <p>Cyber 2 Tower, Rasuna Said</p>
                <p>Kuningan, Jakarta</p>
                <p><strong>Phone:</strong> +62 812-863-18349</p>
            </div>

            <!-- Kenya Office -->
            <div class="office-card">
                <h3><i class="fas fa-globe-africa"></i> Kenya Office</h3>
                <p>#7 Vakaria Investment</p>
                <p>Mombasa Road, Nairobi</p>
                <p>Kenya</p>
            </div>

            <!-- Bangalore Office -->
            <div class="office-card">
                <h3><i class="fas fa-laptop-code"></i> Bangalore Office</h3>
                <p>Bizcon Services Toyama Bizhub</p>
                <p>Second Floor, Near Manyata Tech Park</p>
                <p>Thannisandra Main Road</p>
                <p>Bangalore 560077, India</p>
            </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 Start Your Business Journey?</h2>
        <p class="text-indigo-100 text-lg mb-8 max-w-2xl mx-auto">Contact us 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="#contact-form" class="bg-white text-indigo-600 px-8 py-3 rounded-full font-medium hover:bg-indigo-50 transition">Send Message</a>
            <a href="{% url 'book_appointment' %}" class="border border-white text-white px-8 py-3 rounded-full font-medium hover:bg-white hover:text-indigo-600 transition">Book Appointment</a>
        </div>
    </div>
</section>

<script>
    // Form validation
    document.addEventListener('DOMContentLoaded', function() {
        const form = document.querySelector('form');
        const subjectInput = document.getElementById('subject');
        const messageInput = document.getElementById('message');
        const emailInput = document.getElementById('email');
        const phoneInput = document.getElementById('phone');

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

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

            // Validate subject
            if (!subjectInput.value.trim()) {
                document.getElementById('subject-error').textContent = 'Subject is required';
                isValid = false;
            }

            // Validate message
            if (!messageInput.value.trim()) {
                document.getElementById('message-error').textContent = 'Message is required';
                isValid = false;
            }

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

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