<style>
    .container {
        background-color: #fff;
        margin-top: 180px;
        margin-bottom: 100px;
        min-height: 100vh;
        position: relative;
        max-width: 1400px;
        align-items: center;
        align-self: center;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }


    /* Header Section */
    .request-info-header {
        padding: 80px 70px 40px 70px;
        background-color: #fff;
        font-family: 'Poppins', Arial, sans-serif;
        box-sizing: border-box;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .request-info-header .title {
        color: #004675;
        margin-bottom: 10px;
        text-transform: uppercase;
        font-family: Mallanna;
        font-weight: 400;
        font-size: 42px;
        line-height: 100%;
        letter-spacing: 2%;
        text-align: center;
    }

    .request-info-header .subtitle {

        font-weight: 400;
        font-size: 24px;
        line-height: 38px;
        letter-spacing: 0px;
        text-align: center;
        vertical-align: middle;
        color: #36384E;

    }

    /* Main Content Section: Form & Map */
    .contact-content-section {
        display: flex;
        justify-content: space-between;
        padding: 40px 70px 70px 70px;
        background-color: #fff;
        box-sizing: border-box;
        gap: 40px;

        /* Space between form and map */
    }

    .contact-form-column {
        flex: 1.5;
        /* Form takes more space */
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .form-group {
        margin-bottom: 15px;
        /* Space between form rows */
    }

    .form-label {
        display: block;
        font-size: 0.95rem;
        color: #333;
        margin-bottom: 8px;
        font-weight: 500;
    }

    .form-row {
        display: flex;
        gap: 20px;
        /* Space between name fields */
    }

    .form-field-wrapper {
        flex: 1;
        /* Each field takes equal space in a row */
    }

    .form-input,
    .form-select,
    .form-textarea {
        width: 100%;
        padding: 12px 15px;
        border: 1px solid #ccc;
        border-radius: 5px;
        font-size: 1rem;
        box-sizing: border-box;
        font-family: Arial, sans-serif;
        /* Ensure consistent font */
    }

    .form-input::placeholder,
    .form-textarea::placeholder {
        color: #999;
    }

    .form-textarea {
        min-height: 120px;
        resize: vertical;
        /* Allow vertical resizing */
    }

    /* Specific styling for address and phone number fields with icons/dropdowns */
    .input-with-icon {
        position: relative;
        display: flex;
        align-items: center;
    }

    .input-with-icon i {
        position: absolute;
        left: 15px;
        color: #888;
        font-size: 1.1rem;
        z-index: 1;
        /* Ensure icon is above input */
    }

    .input-with-icon .form-input,
    .input-with-icon .form-select {
        padding-left: 45px;
        /* Make space for icon */
    }

    .phone-input-group {
        display: flex;
        gap: 10px;

    }

    .country-code-select {
        width: 90px;
        /* Fixed width for country code dropdown */
        flex-shrink: 0;

    }

    .phone-number-field {
        flex: 1.5;
        width: 10px;
    }

    .submit-btn {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 12px 30px;
        background-color: {{ $applynowInfo->button_background_color }};
        color: {{ $applynowInfo->button_color }};
        border: none;
        border-radius: 5px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.3s ease;
        text-decoration: none;
        margin-top: 20px;
        width: fit-content;
        margin-left: 40%;
        /* Adjust width to content */
    }

    .submit-btn:hover {
        background-color: #01395b;
    }

    /* Map Column */
    .map-column {
        flex: 1;
        /* Map takes less space, creating the visible layout */
        min-height: 500px;
        /* Minimum height for the map */
        border-radius: 8px;
        overflow: hidden;
        /* Ensures map corners are rounded */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    #google-map {
        width: 100%;
        height: 100%;
        border-radius: 8px;
        /* Apply border-radius directly to map div */
    }

       /* Enhanced responsive styles */
       @media (max-width: 1200px) {
        .container {
            margin-top: 150px;
            margin-bottom: 80px;
        }
        .request-info-header {
            padding: 60px 50px 30px 50px;
        }
        .request-info-header .title {
            font-size: 36px;
        }
        .request-info-header .subtitle {
            font-size: 20px;
            line-height: 32px;
        }
        .contact-content-section {
            padding: 30px 50px 60px 50px;
            gap: 35px;
        }
        .submit-btn {
            margin-left: 35%;
        }
    }

    @media (max-width: 1024px) {
        .container {
            margin-top: 120px;
            margin-bottom: 60px;
        }
        .request-info-header,
        .contact-content-section {
            padding-left: 40px;
            padding-right: 40px;
        }
        .request-info-header {
            padding: 50px 40px 25px 40px;
        }
        .request-info-header .title {
            font-size: 2.2rem;
        }
        .request-info-header .subtitle {
            font-size: 18px;
            line-height: 28px;
        }
        .contact-content-section {
            flex-direction: column;
            gap: 30px;
            padding: 25px 40px 50px 40px;
        }
        .contact-form-column,
        .map-column {
            flex: none;
            width: 100%;
        }
        .map-column {
            min-height: 400px;
        }
        .submit-btn {
            margin-left: 30%;
        }
    }

    @media (max-width: 900px) {
        .container {
            margin-top: 100px;
            margin-bottom: 50px;
        }
        .request-info-header {
            padding: 40px 30px 20px 30px;
        }
        .request-info-header .title {
            font-size: 1.8rem;
        }
        .request-info-header .subtitle {
            font-size: 16px;
            line-height: 24px;
        }
        .contact-content-section {
            padding: 20px 30px 40px 30px;
            gap: 25px;
        }
        .form-label {
            font-size: 0.9rem;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 10px 12px;
            font-size: 0.95rem;
        }
        .submit-btn {
            margin-left: 25%;
            padding: 10px 25px;
            font-size: 0.95rem;
        }
    }

    @media (max-width: 768px) {
        .container {
            margin-top: 80px;
            margin-bottom: 40px;
        }
        .request-info-header,
        .contact-content-section {
            padding-left: 20px;
            padding-right: 20px;
        }
        .request-info-header {
            padding: 30px 20px 15px 20px;
        }
        .request-info-header .title {
            font-size: 1.8rem;
        }
        .request-info-header .subtitle {
            font-size: 15px;
            line-height: 22px;
        }
        .contact-content-section {
            padding: 15px 20px 30px 20px;
            gap: 20px;
        }
        .form-row {
            flex-direction: column;
            gap: 15px;
        }
        .phone-input-group {
            gap: 8px;
        }
        .country-code-select {
            width: 80px;
        }
        .map-column {
            min-height: 300px;
        }
        .submit-btn {
            margin-left: 20%;
            padding: 8px 20px;
            font-size: 0.9rem;
        }
    }

    @media (max-width: 600px) {
        .container {
            margin-top: 60px;
            margin-bottom: 30px;
        }
        .request-info-header {
            padding: 25px 15px 12px 15px;
        }
        .request-info-header .title {
            font-size: 1.5rem;
        }
        .request-info-header .subtitle {
            font-size: 14px;
            line-height: 20px;
        }
        .contact-content-section {
            padding: 12px 15px 25px 15px;
            gap: 18px;
        }
        .form-group {
            margin-bottom: 12px;
        }
        .form-label {
            font-size: 0.85rem;
            margin-bottom: 6px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 8px 10px;
            font-size: 0.9rem;
        }
        .form-textarea {
            min-height: 100px;
        }
        .input-with-icon i {
            font-size: 1rem;
            left: 12px;
        }
        .input-with-icon .form-input,
        .input-with-icon .form-select {
            padding-left: 40px;
        }
        .phone-input-group {
            gap: 6px;
        }
        .country-code-select {
            width: 70px;
            font-size: 0.85rem;
        }
        .submit-btn {
            margin-left: 15%;
            padding: 7px 18px;
            font-size: 0.85rem;
        }
    }

    @media (max-width: 480px) {
        .container {
            margin-top: 50px;
            margin-bottom: 25px;
        }
        .request-info-header {
            padding: 20px 10px 10px 10px;
        }
        .request-info-header .title {
            font-size: 1.3rem;
        }
        .request-info-header .subtitle {
            font-size: 13px;
            line-height: 18px;
        }
        .contact-content-section {
            padding: 10px 10px 20px 10px;
            gap: 15px;
        }
        .form-group {
            margin-bottom: 10px;
        }
        .form-label {
            font-size: 0.8rem;
            margin-bottom: 5px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 7px 8px;
            font-size: 0.85rem;
        }
        .form-textarea {
            min-height: 80px;
        }
        .input-with-icon i {
            font-size: 0.9rem;
            left: 10px;
        }
        .input-with-icon .form-input,
        .input-with-icon .form-select {
            padding-left: 35px;
        }
        .phone-input-group {
            gap: 5px;
        }
        .country-code-select {
            width: 60px;
            font-size: 0.8rem;
        }
        .submit-btn {
            margin-left: 10%;
            padding: 6px 15px;
            font-size: 0.8rem;
        }
    }

    @media (max-width: 360px) {
        .container {
            margin-top: 40px;
            margin-bottom: 20px;
        }
        .request-info-header {
            padding: 15px 8px 8px 8px;
        }
        .request-info-header .title {
            font-size: 1.1rem;
        }
        .request-info-header .subtitle {
            font-size: 12px;
            line-height: 16px;
        }
        .contact-content-section {
            padding: 8px 8px 15px 8px;
            gap: 12px;
        }
        .form-group {
            margin-bottom: 8px;
        }
        .form-label {
            font-size: 0.75rem;
            margin-bottom: 4px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 6px 7px;
            font-size: 0.8rem;
        }
        .form-textarea {
            min-height: 70px;
        }
        .input-with-icon i {
            font-size: 0.8rem;
            left: 8px;
        }
        .input-with-icon .form-input,
        .input-with-icon .form-select {
            padding-left: 30px;
        }
        .phone-input-group {
            gap: 4px;
        }
        .country-code-select {
            width: 55px;
            font-size: 0.75rem;
        }
        .submit-btn {
            margin-left: 5%;
            padding: 5px 12px;
            font-size: 0.75rem;
        }
    }

    .title .blue { color: #2196F3; }
    .title .orange { color: #FF9800; }
    .title .dark { color: #36384E; }
</style>

<div class="container">

    <!-- Header Section -->
    <div class="request-info-header">
        <div class="title">
            @php
                $words = explode(' ', $applynowInfo->title);
            @endphp
            <span class="blue">{{ $words[0] ?? '' }}</span>
            <span class="dark">{{ ($words[1] ?? '') . ' ' . ($words[2] ?? '') }}</span>
            <span class="orange">{{ $words[3] ?? '' }}</span>
            <span class="dark">{{ ' ' . ($words[4] ?? '') . ' ' . ($words[5] ?? '') }}</span>
        </div>
    </div>

    <!-- Main Content Section: Form & Map -->
    <div class="contact-content-section">
        <div class="contact-form-column">
            <form action="{{ route('applynowForm') }}" method="POST">
                @csrf
                <div class="form-group">
                    <label for="firstName" class="form-label">Name</label>
                    <div class="form-row">
                        <div class="form-field-wrapper">
                            <input type="text" id="firstName" name="firstName" class="form-input"
                                placeholder="First Name">
                        </div>
                        <div class="form-field-wrapper">
                            <input type="text" id="lastName" name="lastName" class="form-input"
                                placeholder="Last Name">
                        </div>
                    </div>
                </div>

                <!-- NEW: Country Selection Field -->
                <div class="form-group">
                    <label for="country" class="form-label">Country</label>
                    <div class="input-with-icon">
                        <i class="fas fa-globe"></i> <!-- Changed icon to globe for country -->
                        <select id="country" name="country" class="form-input form-select">
                            <option value="">Select Country</option>
                            <!-- Options will be populated by JS -->
                        </select>
                    </div>
                </div>

                <!-- NEW: Region Selection Field -->
                <div class="form-group">
                    <label for="region" class="form-label">Region</label>
                    <div class="input-with-icon">
                        <i class="fas fa-map-marker-alt"></i> <!-- Map marker for region -->
                        <select id="region" name="region" class="form-input form-select">
                            <option value="">Select Region</option>
                            <!-- Options will be populated by JS -->
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="phone" class="form-label">Phone number</label>
                    <div class="phone-input-group">
                        <!-- Updated: id="country-code" for JS to target -->
                        <div class="input-with-icon">
                            <i class="fas fa-phone"></i> <!-- Phone icon for country code -->
                            <span id="country-code" class="form-input form-select country-code-select"
                                style="padding-left: 45px; display: flex; align-items: center; background-color: #f0f0f0;">+00</span>
                            <!-- Changed to span to just display code, not a select -->
                        </div>
                        <div class="form-field-wrapper phone-number-field">
                            <input type="text" id="phone" name="phone_number" class="form-input"
                                placeholder="Phone number">
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="email" class="form-label">Mail</label>
                    <input type="email" id="email" name="email" class="form-input" placeholder="email">
                </div>

                <div class="form-group">
                    <label for="message" class="form-label">Your message</label>
                    <textarea id="message" name="message" class="form-textarea" placeholder="Write a..."></textarea>
                </div>

                <button type="submit" class="submit-btn">
                    {{ $applynowInfo->button_label }} <img src="{{ asset('images/arrow.svg') }}" alt=""></i>
                </button>
            </form>
        </div>


    </div>
</div>

<!-- Google Maps API Script -->
<!-- Replace YOUR_API_KEY with your actual Google Maps API Key -->

<script>


    // NEW: Dynamic Country/Region/Phone Code Script
    document.addEventListener('DOMContentLoaded', function() {
        const regions = {
            Nepal: ["Kathmandu", "Lalitpur", "Bhaktapur", "Pokhara", "Chitwan", "Jhapa", "Morang", "Dang",
                "Sunsari"
            ],
            India: ["Delhi", "Mumbai", "Bangalore", "Kolkata", "Chennai", "Hyderabad", "Punjab", "Gujarat",
                "Kerala"
            ],
            Bangladesh: ["Dhaka", "Chittagong", "Khulna", "Rajshahi", "Barisal", "Sylhet", "Rangpur",
                "Mymensingh"
            ],
            Pakistan: ["Punjab", "Sindh", "Balochistan", "Khyber Pakhtunkhwa", "Gilgit-Baltistan",
                "Islamabad Capital Territory"
            ],
            SriLanka: ["Western", "Central", "Southern", "Northern", "Eastern", "North Western",
                "North Central", "Uva", "Sabaragamuwa"
            ],
            Bhutan: ["Thimphu", "Paro", "Punakha", "Wangdue Phodrang", "Trongsa", "Bumthang", "Trashigang",
                "Mongar"
            ],
            Maldives: ["Malé", "Addu City", "Haa Alif", "Baa", "Kaafu", "Lhaviyani", "Meemu", "Raa",
                "Thaa"
            ],
            Afghanistan: ["Kabul", "Kandahar", "Herat", "Balkh", "Nangarhar", "Helmand", "Bamyan", "Khost",
                "Kunduz", "Ghazni"
            ],
        };
        const phoneCodes = {
            Nepal: "+977",
            India: "+91",
            Bangladesh: "+880",
            Pakistan: "+92",
            SriLanka: "+94",
            Bhutan: "+975",
            Maldives: "+960",
            Afghanistan: "+93",
        };

        const countrySelect = document.getElementById("country");
        const regionSelect = document.getElementById("region");
        const countryCodeDisplay = document.getElementById(
            "country-code"); // Changed to Display as it's a span now

        // Populate initial country options
        function populateCountries() {
            for (const country in regions) {
                const option = document.createElement("option");
                option.value = country;
                option.textContent = country;
                countrySelect.appendChild(option);
            }
        }

        // Event listener for country selection change
        countrySelect.addEventListener("change", function() {
            const selectedCountry = this.value;

            // Update region options
            regionSelect.innerHTML = "<option value=''>Select Region</option>"; // Reset regions
            if (regions[selectedCountry]) {
                regions[selectedCountry].forEach(function(region) {
                    const option = document.createElement("option");
                    option.value = region;
                    option.textContent = region;
                    regionSelect.appendChild(option);
                });
            }
            // Update country code display
            countryCodeDisplay.textContent = phoneCodes[selectedCountry] ||
                "+00"; // Default if not found
        });

        // Initial population of countries when page loads
        populateCountries();
    });
</script>
