<style>
    .container {
        background-color: #fff;
        margin-top: 180px;
        margin-bottom: 100px;
        min-height: 100vh;
        position: relative;
        max-width: 1400px;
        align-items: center;

    }


    /* 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 {
        width: 90%;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        padding: 40px 70px 70px 70px;
        background-color: #fff;
        box-sizing: border-box;
        gap: 40px;
        /* box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); */
        /* 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: {{ $requestinfo->button_background_color }};
        color: {{ $requestinfo->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;
        /* 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: 160px;
            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 {
            width: 92%;
            padding: 30px 50px 60px 50px;
            gap: 30px;
        }
        .contact-form-column {
            gap: 18px;
        }
        .form-group {
            margin-bottom: 13px;
        }
        .form-label {
            font-size: 0.9rem;
            margin-bottom: 7px;
        }
        .form-row {
            gap: 18px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 11px 14px;
            font-size: 0.95rem;
        }
        .form-textarea {
            min-height: 110px;
        }
        .submit-btn {
            padding: 11px 28px;
            font-size: 0.95rem;
            margin-top: 18px;
        }
        .map-column {
            min-height: 450px;
        }
    }

    @media (max-width: 1024px) {
        .container {
            margin-top: 140px;
            margin-bottom: 70px;
        }
        .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;
        }
        .form-group {
            margin-bottom: 12px;
        }
        .form-label {
            font-size: 0.85rem;
            margin-bottom: 6px;
        }
        .form-row {
            gap: 15px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 10px 13px;
            font-size: 0.9rem;
        }
        .form-textarea {
            min-height: 100px;
        }
        .submit-btn {
            padding: 10px 25px;
            font-size: 0.9rem;
            margin-top: 16px;
        }
    }

    @media (max-width: 768px) {
        .container {
            margin-top: 120px;
            margin-bottom: 60px;
        }
        .request-info-header {
            padding: 40px 20px 20px 20px;
        }
        .request-info-header .title {
            font-size: 1.8rem;
        }
        .request-info-header .subtitle {
            font-size: 16px;
            line-height: 24px;
        }
        .contact-content-section {
            padding: 20px 20px 40px 20px;
            gap: 25px;
        }
        .form-row {
            flex-direction: column;
            gap: 15px;
        }
        .form-group {
            margin-bottom: 10px;
        }
        .form-label {
            font-size: 0.8rem;
            margin-bottom: 5px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 9px 12px;
            font-size: 0.85rem;
        }
        .form-textarea {
            min-height: 90px;
        }
        .submit-btn {
            padding: 9px 22px;
            font-size: 0.85rem;
            margin-top: 14px;
        }
        .map-column {
            min-height: 300px;
        }
        .phone-input-group {
            gap: 8px;
        }
        .country-code-select {
            width: 80px;
        }
    }

    @media (max-width: 600px) {
        .container {
            margin-top: 100px;
            margin-bottom: 50px;
        }
        .request-info-header {
            padding: 30px 15px 15px 15px;
        }
        .request-info-header .title {
            font-size: 1.6rem;
        }
        .request-info-header .subtitle {
            font-size: 14px;
            line-height: 20px;
        }
        .contact-content-section {
            padding: 15px 15px 30px 15px;
            gap: 20px;
        }
        .contact-form-column {
            gap: 15px;
        }
        .form-group {
            margin-bottom: 8px;
        }
        .form-label {
            font-size: 0.75rem;
            margin-bottom: 4px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 8px 10px;
            font-size: 0.8rem;
        }
        .form-textarea {
            min-height: 80px;
        }
        .submit-btn {
            padding: 8px 20px;
            font-size: 0.8rem;
            margin-top: 12px;
        }
        .map-column {
            min-height: 250px;
        }
        .phone-input-group {
            gap: 6px;
        }
        .country-code-select {
            width: 70px;
        }
    }

    @media (max-width: 480px) {
        .container {
            margin-top: 80px;
            margin-bottom: 40px;
        }
        .request-info-header {
            padding: 25px 10px 10px 10px;
        }
        .request-info-header .title {
            font-size: 1.4rem;
        }
        .request-info-header .subtitle {
            font-size: 13px;
            line-height: 18px;
        }
        .contact-content-section {
            padding: 10px 10px 25px 10px;
            gap: 15px;
        }
        .contact-form-column {
            gap: 12px;
        }
        .form-group {
            margin-bottom: 6px;
        }
        .form-label {
            font-size: 0.7rem;
            margin-bottom: 3px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 7px 8px;
            font-size: 0.75rem;
        }
        .form-textarea {
            min-height: 70px;
        }
        .submit-btn {
            padding: 7px 18px;
            font-size: 0.75rem;
            margin-top: 10px;
        }
        .map-column {
            min-height: 200px;
        }
        .phone-input-group {
            gap: 5px;
        }
        .country-code-select {
            width: 60px;
        }
    }

    @media (max-width: 400px) {
        .container {
            margin-top: 70px;
            margin-bottom: 30px;
        }
        .request-info-header {
            padding: 20px 8px 8px 8px;
        }
        .request-info-header .title {
            font-size: 1.2rem;
        }
        .request-info-header .subtitle {
            font-size: 12px;
            line-height: 16px;
        }
        .contact-content-section {
            padding: 8px 8px 20px 8px;
            gap: 12px;
        }
        .contact-form-column {
            gap: 10px;
        }
        .form-group {
            margin-bottom: 5px;
        }
        .form-label {
            font-size: 0.65rem;
            margin-bottom: 2px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 6px 7px;
            font-size: 0.7rem;
        }
        .form-textarea {
            min-height: 60px;
        }
        .submit-btn {
            padding: 6px 16px;
            font-size: 0.7rem;
            margin-top: 8px;
        }
        .map-column {
            min-height: 180px;
        }
        .phone-input-group {
            gap: 4px;
        }
        .country-code-select {
            width: 55px;
        }
    }

    @media (max-width: 360px) {
        .container {
            margin-top: 60px;
            margin-bottom: 25px;
        }
        .request-info-header {
            padding: 15px 6px 6px 6px;
        }
        .request-info-header .title {
            font-size: 1.1rem;
        }
        .request-info-header .subtitle {
            font-size: 11px;
            line-height: 14px;
        }
        .contact-content-section {
            padding: 6px 6px 15px 6px;
            gap: 10px;
        }
        .contact-form-column {
            gap: 8px;
        }
        .form-group {
            margin-bottom: 4px;
        }
        .form-label {
            font-size: 0.6rem;
            margin-bottom: 1px;
        }
        .form-input,
        .form-select,
        .form-textarea {
            padding: 5px 6px;
            font-size: 0.65rem;
        }
        .form-textarea {
            min-height: 50px;
        }
        .submit-btn {
            padding: 5px 14px;
            font-size: 0.65rem;
            margin-top: 6px;
        }
        .map-column {
            min-height: 160px;
        }
        .phone-input-group {
            gap: 3px;
        }
        .country-code-select {
            width: 50px;
        }
    }
</style>

<div class="container">

    <!-- Header Section -->
    <div class="request-info-header">
        <div class="title">{{ $requestinfo->title }}</div>
        <div class="subtitle">{{ $requestinfo->text }}</div>
    </div>

    <!-- Main Content Section: Form & Map -->
    <div class="contact-content-section">

        <div class="contact-form-column">
            <form action="{{ route('requestinfoForm') }}" 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">
                    {{ $requestinfo->button_label }} <img src="{{ asset('images/arrow.svg') }}" alt=""></i>
                </button>
            </form>
        </div>
        <div class="map-column">
            <div id="google-map">
                <iframe
                    src="https://www.google.com/maps?q={{ $requestinfo->longitude }},{{ $requestinfo->latitude }}&hl=es;z=15&output=embed"
                    width="100%" height="100%" style="border:0; border-radius: 12px;" allowfullscreen="" loading="lazy"
                    referrerpolicy="no-referrer-when-downgrade"></iframe>
            </div>
        </div>

    </div>
</div>

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

<script>
    // Google Maps Initialization (existing)
    // function initMap() {
    //     const swscLocation = {
    //         lat: {{ $requestinfo->latitude }},
    //         lng: {{ $requestinfo->longitude }}
    //     };
    //     const map = new google.maps.Map(document.getElementById("google-map"), {
    //         zoom: 15,
    //         center: swscLocation,
    //         mapTypeControl: false,
    //         streetViewControl: false,
    //         fullscreenControl: false,
    //         zoomControl: true,
    //         scaleControl: true,
    //     });
    //     const marker = new google.maps.Marker({
    //         position: swscLocation,
    //         map: map,
    //         title: "Southwestern School College"
    //     });
    // }

    // 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>
