<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1">
    <title>Contact us - WikiFX</title>
    <style>
       
        /* Reset and Base Styles */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Arial', sans-serif;
        }
        
        body {
            background-color: #f5f5f5;
            color: #333;
            line-height: 1.6;
        }
        
        /* Form Container */
        .wiki-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        
        /* Header Section */
        .contract-head {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .head-top p:first-child {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 10px;
        }
        
        .head-bottom {
            margin-top: 30px;
        }
        
        .head-bottom-ul {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            list-style: none;
        }
        
        .head-bottom-ul li {
            display: flex;
            align-items: center;
            margin: 10px 20px;
        }
        
        .head-bottom-ul img {
            width: 24px;
            height: 24px;
            margin-right: 10px;
        }
        
        .vertical-line {
            width: 1px;
            height: 40px;
            background-color: #ddd;
        }
        
        /* Tabs Navigation */
        .tabs-btn {
            margin-bottom: 30px;
        }
        
        .wiki-nav-list {
            display: flex;
            list-style: none;
            border-bottom: 1px solid #ddd;
        }
        
        .wiki-nav-item {
            padding: 10px 20px;
            cursor: pointer;
            position: relative;
        }
        
        .wiki-nav-item:hover {
            color: #e66112;
        }
        
        .home-tab-active {
            color: #e66112;
            font-weight: bold;
        }
        
        .home-tab-active::after {
            content: '';
            position: absolute;
            bottom: -1px;
            left: 0;
            width: 100%;
            height: 2px;
            background-color: #e66112;
        }
        
        /* Form Styles */
        main {
            background-color: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        
        h1, h5, h6 {
            margin-bottom: 20px;
        }
        
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
        }
        
        .company-name, .input-info-li {
            margin-bottom: 20px;
        }
        
        .el-input, .el-textarea {
            position: relative;
            width: 100%;
        }
        
        .el-input__inner, .el-textarea__inner {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #dcdfe6;
            border-radius: 4px;
            font-size: 14px;
            transition: border-color 0.2s;
        }
        
        .el-input__inner:focus, .el-textarea__inner:focus {
            outline: none;
            border-color: #e66112;
        }
        
        .el-input__suffix {
            position: absolute;
            right: 10px;
            top: 50%;
            transform: translateY(-50%);
        }
        
        .error-message {
            color: #f56c6c;
            font-size: 12px;
            margin-top: 5px;
            display: none;
        }
        
        /* Phone Input */
        .phone-block {
            display: flex;
        }
        
        .country-block {
            display: flex;
            align-items: center;
            padding: 0 10px;
            border: 1px solid #dcdfe6;
            border-radius: 4px 0 0 4px;
            background-color: #f5f7fa;
            cursor: pointer;
            position: relative;
        }
        
        .country-block img {
            width: 20px;
            height: 15px;
            margin-right: 5px;
        }
        
        .country-block span {
            margin-right: 5px;
        }
        
        .phone-block .el-input {
            flex: 1;
        }
        
        .phone-block .el-input__inner {
            border-radius: 0 4px 4px 0;
            border-left: none;
        }
        
        /* Country Dropdown */
        .user-country {
            position: absolute;
            top: 100%;
            left: 0;
            width: 300px;
            background-color: white;
            border: 1px solid #dcdfe6;
            border-radius: 4px;
            box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
            z-index: 100;
            max-height: 400px;
            overflow-y: auto;
            display: none;
        }
        
        .country-head {
            padding: 10px;
            position: sticky;
            top: 0;
            background-color: white;
            z-index: 10;
        }
        
        .country-sarch {
            display: flex;
            align-items: center;
            border: 1px solid #dcdfe6;
            border-radius: 4px;
            padding: 5px 10px;
            margin-bottom: 10px;
        }
        
        .country-sarch input {
            flex: 1;
            border: none;
            outline: none;
            padding: 5px;
        }
        
        .country-letter {
            display: flex;
            flex-wrap: wrap;
            margin-bottom: 10px;
        }
        
        .country-letter li {
            padding: 2px 5px;
            cursor: pointer;
            font-size: 12px;
        }
        
        .country-letter li.selected {
            color: #e66112;
            font-weight: bold;
        }
        
        .country-list {
            padding: 0 10px 10px;
        }
        
        .country-list ul {
            list-style: none;
        }
        
        .country-list li {
            margin-bottom: 10px;
        }
        
        .country-list li p {
            font-weight: bold;
            margin-bottom: 5px;
        }
        
        .country-details {
            display: flex;
            align-items: center;
            padding: 5px;
            cursor: pointer;
        }
        
        .country-details:hover {
            background-color: #f5f7fa;
        }
        
        .country-icon {
            width: 20px;
            height: 15px;
            margin-right: 10px;
        }
        
        /* Image Upload */
        .upload-img {
            margin: 30px 0;
        }
        
        .upload-pictures {
            display: flex;
            flex-wrap: wrap;
        }
        
        .el-upload-list {
            display: flex;
            flex-wrap: wrap;
            list-style: none;
        }
        
        .el-upload-list--picture-card .el-upload-list__item {
            width: 100px;
            height: 100px;
            margin: 0 10px 10px 0;
            border: 1px dashed #dcdfe6;
            border-radius: 4px;
            position: relative;
        }
        
        .el-upload-list__item-thumbnail {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .el-upload-list__item-actions {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0;
            transition: opacity 0.3s;
        }
        
        .el-upload-list__item:hover .el-upload-list__item-actions {
            opacity: 1;
        }
        
        .el-upload-list__item-actions span {
            color: white;
            margin: 0 5px;
            cursor: pointer;
        }
        
        .el-upload--picture-card {
            width: 100px;
            height: 100px;
            border: 1px dashed #dcdfe6;
            border-radius: 4px;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            margin-right: 10px;
            margin-bottom: 10px;
        }
        
        .el-upload--picture-card:hover {
            border-color: #e66112;
        }
        
        .upload-ico {
            font-size: 24px;
            color: #999;
        }
        
        .el-upload__input {
            display: none;
        }
        
        .call-word {
            font-size: 12px;
            color: #999;
        }
        
        /* Submit Button */
        .submit-btn {
            text-align: center;
            margin-top: 30px;
        }
        
        .submit-btn button {
            background-color: #e66112;
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        
        .submit-btn button:hover {
            background-color: #d4550a;
        }
        
        /* Dialog */
        .el-dialog__wrapper {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
        }
        
        .el-dialog {
            background-color: white;
            border-radius: 4px;
            width: 400px;
            padding: 20px;
        }
        
        .el-dialog__header {
            text-align: center;
            margin-bottom: 20px;
        }
        
        .dialog-header-title {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .dialog-header-title i {
            font-size: 40px;
            margin-bottom: 10px;
        }
        
        .el-dialog__footer {
            text-align: center;
            margin-top: 20px;
        }
        
        .el-button {
            padding: 10px 20px;
            border-radius: 4px;
            cursor: pointer;
        }
        
        .el-button--primary {
            background-color: #e66112;
            color: white;
            border: none;
        }
        
        /* Mobile Styles */
        @media (max-width: 768px) {
            .wiki-nav-list {
                overflow-x: auto;
                white-space: nowrap;
                padding-bottom: 5px;
            }
            
            .wiki-nav-item {
                padding: 10px 15px;
            }
            
            .head-bottom-ul {
                justify-content: flex-start;
            }
            
            .head-bottom-ul li {
                margin: 5px 10px;
            }
            
            .vertical-line.longlanguage, .last-li-block {
                display: none;
            }
            
            main {
                padding: 15px;
            }
        }
    
        .form-section {
            display: none;
        }
        
        .form-section.active {
            display: block;
        }
        
        .hidden {
            display: none !important;
        }
    </style>
</head>
<body>
    <!-- (Previous HTML remains the same until the <main> tag) -->
    <section class="wiki-head">
            <div class="contract-head">
                <div class="head-top">
                    <p>Global Broker Regulation Inquiry App</p>
                    <p>Basic information inquiry, regulatory license inquiry, credit evaluation, platform identification and other services of global foreign exchange trading companies。</p>
                </div>
                <div class="head-bottom">
                    <ul class="head-bottom-ul">
                        <li><img src="https://resources1.interface003.com/web20/img/contract/crown.svg" alt=""> <p><span>Rich interests</span><span>Interests continue to enrich</span></p></li>
                        <li class="vertical-line"></li>
                        <li><img src="https://resources1.interface003.com/web20/img/contract/lightning.svg" alt=""> <p><span>Respond quickly</span><span>Pre-review in 5 working days</span></p></li>
                        <li class="vertical-line longlanguage"></li>
                        <li class="longlanguage"><img src="https://resources1.interface003.com/web20/img/contract/square.svg" alt=""> <p><span>Fair identification</span><span>Collected and identification are fair</span></p></li>
                        <li class="vertical-line last-li-block"></li>
                        <li class="last-li-block"><img src="https://resources1.interface003.com/web20/img/contract/fast.svg" alt=""> <p><span>Landing quickly</span><span>Suggestions and feedback are landing quickly</span></p></li>
                    </ul>
                </div>
            </div>
        </section>

        <section class="contract-tabs">
            <div class="tabs-btn">
                <div class="home-tab home-tab-new tabs-btn-ul">
                    <nav class="wiki-nav-wrap">
                        <ul class="wiki-nav-list">
                            <h2 data-idx="0" class="wiki-nav-item">Cooperation</h2>
                            <h2 data-idx="1" class="wiki-nav-item home-tab-active">Update license</h2>
                            <h2 data-idx="2" class="wiki-nav-item">Apply for Inclusion</h2>
                            <h2 data-idx="3" class="wiki-nav-item">Complain and suggestion</h2>
                            <h2 data-idx="4" class="wiki-nav-item">KOL Cooperation</h2>
                            <h2 data-idx="5" class="wiki-nav-item">LCS Cooperation</h2>
                            <h2 data-idx="6" class="wiki-nav-item">Customer service authentication</h2>
                        </ul>
                    </nav>
                </div>
            </div>
    <main>
        <!-- Cooperation Form -->
        <div class="form-section active" id="cooperationForm">
            <h1>Cooperation Inquiry</h1>
            
            <div class="basic-info">
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Your Name</label>
                    <div class="el-input">
                        <input type="text" id="coopName" class="el-input__inner" placeholder="Your full name">
                    </div>
                    <p class="error-message" id="coopNameError">Required field</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Company Name</label>
                    <div class="el-input">
                        <input type="text" id="coopCompany" class="el-input__inner" placeholder="Your company name">
                    </div>
                    <p class="error-message" id="coopCompanyError">Required field</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Email Address</label>
                    <div class="el-input">
                        <input type="email" id="coopEmail" class="el-input__inner" placeholder="Your email address">
                    </div>
                    <p class="error-message" id="coopEmailError">Valid email required</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Cooperation Type</label>
                    <div class="el-input">
                        <select id="coopType" class="el-input__inner">
                            <option value="">Select cooperation type</option>
                            <option value="broker">Broker Partnership</option>
                            <option value="media">Media Cooperation</option>
                            <option value="technology">Technology Integration</option>
                            <option value="other">Other</option>
                        </select>
                    </div>
                    <p class="error-message" id="coopTypeError">Please select a cooperation type</p>
                </div>
                
                <h5><span style="color: #e66112">* </span>Cooperation Details</h5>
                <div class="textarea">
                    <div class="el-textarea">
                        <textarea id="coopDetails" class="el-textarea__inner" placeholder="Please describe your cooperation proposal"></textarea>
                        <span class="el-input__count"><span id="coopCharCount">0</span>/500</span>
                    </div>
                    <p class="error-message" id="coopDetailsError">Please provide details</p>
                </div>
            </div>
        </div>
        
        <!-- Update License Form -->
        <div class="form-section" id="licenseForm">
            <h1>Update License Information</h1>
            
            <div class="basic-info">
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Your Name</label>
                    <div class="el-input">
                        <input type="text" id="licenseName" class="el-input__inner" placeholder="Your full name">
                    </div>
                    <p class="error-message" id="licenseNameError">Required field</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Company Name</label>
                    <div class="el-input">
                        <input type="text" id="licenseCompany" class="el-input__inner" placeholder="Company name">
                    </div>
                    <p class="error-message" id="licenseCompanyError">Required field</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Regulatory License Number</label>
                    <div class="el-input">
                        <input type="text" id="licenseNumber" class="el-input__inner" placeholder="License number">
                    </div>
                    <p class="error-message" id="licenseNumberError">Required field</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Regulatory Authority</label>
                    <div class="el-input">
                        <input type="text" id="licenseAuthority" class="el-input__inner" placeholder="Regulatory authority">
                    </div>
                    <p class="error-message" id="licenseAuthorityError">Required field</p>
                </div>
                
                <h5><span style="color: #e66112">* </span>License Update Details</h5>
                <div class="textarea">
                    <div class="el-textarea">
                        <textarea id="licenseDetails" class="el-textarea__inner" placeholder="Describe the changes to your license information"></textarea>
                        <span class="el-input__count"><span id="licenseCharCount">0</span>/500</span>
                    </div>
                    <p class="error-message" id="licenseDetailsError">Please provide update details</p>
                </div>
            </div>
        </div>
        
        <!-- Apply for Inclusion Form -->
        <div class="form-section" id="inclusionForm">
            <h1>Apply for Inclusion</h1>
            
            <div class="basic-info">
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Your Name</label>
                    <div class="el-input">
                        <input type="text" id="inclusionName" class="el-input__inner" placeholder="Your full name">
                    </div>
                    <p class="error-message" id="inclusionNameError">Required field</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Company Name</label>
                    <div class="el-input">
                        <input type="text" id="inclusionCompany" class="el-input__inner" placeholder="Company name">
                    </div>
                    <p class="error-message" id="inclusionCompanyError">Required field</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Company Website</label>
                    <div class="el-input">
                        <input type="url" id="inclusionWebsite" class="el-input__inner" placeholder="Company website URL">
                    </div>
                    <p class="error-message" id="inclusionWebsiteError">Valid URL required</p>
                </div>
                
                <div class="company-name">
                    <label><span style="color: #e66112">* </span>Company Type</label>
                    <div class="el-input">
                        <select id="inclusionType" class="el-input__inner">
                            <option value="">Select company type</option>
                            <option value="broker">Forex Broker</option>
                            <option value="platform">Trading Platform</option>
                            <option value="education">Financial Education</option>
                            <option value="other">Other</option>
                        </select>
                    </div>
                    <p class="error-message" id="inclusionTypeError">Please select company type</p>
                </div>
                
                <h5><span style="color: #e66112">* </span>Company Description</h5>
                <div class="textarea">
                    <div class="el-textarea">
                        <textarea id="inclusionDescription" class="el-textarea__inner" placeholder="Describe your company and services"></textarea>
                        <span class="el-input__count"><span id="inclusionCharCount">0</span>/500</span>
                    </div>
                    <p class="error-message" id="inclusionDescriptionError">Please provide company description</p>
                </div>
            </div>
        </div>
        
        <!-- (Other forms for Complain/Suggestion, KOL, LCS, etc. would follow similar patterns) -->
        
        <!-- Common Contact Section -->
        <h6><label><span style="color: rgb(230, 97, 18);">* </span>Other ways of contact</label></h6>
        <ul class="input-info">
            <li class="input-info-li">
                <label><i class="iconfont icon-hongseshouji-X" style="color: rgb(82, 166, 236);"></i>Mobile Phone Number</label>
                <div class="phone-block" style="position: relative;">
                    <div class="country-block" id="countrySelector">
                        <img src="https://img.souhei.com.cn/flag/d7ed3e7b4fdbf486/IN.png_wiki-template-global" alt="" id="countryFlag"> 
                        <span id="countryCode">IN</span> 
                        <span id="countryPrefix">0091</span> 
                        <i class="iconfont icon-arrow-down"></i>
                    </div>
                    
                    <div class="el-input">
                        <input type="text" id="phoneNumber" class="el-input__inner" placeholder="Please enter your phone number">
                    </div>
                </div>
                <p class="error-message" id="phoneError">The phone number's format is incorrect</p>
                <p class="error-message" id="contactRequiredError">Fill in at least one contact information</p>
            </li>
            
            <li class="input-info-li">
                <label><i class="iconfont icon-weixin" style="color: rgb(40, 196, 69);"></i>WeChat</label>
                <div class="el-input">
                    <input type="text" id="wechat" class="el-input__inner" placeholder="Please enter your Wechat ID">
                </div>
            </li>
            
            <li class="input-info-li">
                <label><i class="iconfont icon-whatsapp" style="color: rgb(40, 196, 69);"></i>WhatsApp</label>
                <div class="el-input">
                    <input type="text" id="whatsapp" class="el-input__inner" placeholder="Please enter your WhatsApp ID">
                </div>
            </li>
        </ul>
        
        <!-- Common Upload Section -->
        <section class="upload-img">
            <h6>Attach pictures(0/5)</h6>
            <div>
                <div class="upload-pictures">
                    <div class="left">
                        <ul class="el-upload-list el-upload-list--picture-card" id="imagePreview"></ul>
                        <div tabindex="0" class="el-upload el-upload--picture-card" id="imageUpload">
                            <i class="upload-ico iconfont icon-upload_a_picture"></i>
                            <input type="file" name="file" id="fileInput" class="el-upload__input" accept="image/*" multiple>
                        </div>
                    </div>
                </div>
                <span class="call-word">Please upload the picture that smaller than 10M</span>
            </div>
        </section>
    </main>
 </section>

        <section class="upload-img">
            <h6>Attach pictures(0/5)</h6>
            <div>
                <div class="upload-pictures">
                    <div class="left">
                        <ul class="el-upload-list el-upload-list--picture-card" id="imagePreview"></ul>
                        <div tabindex="0" class="el-upload el-upload--picture-card" id="imageUpload">
                            <i class="upload-ico iconfont icon-upload_a_picture"></i>
                            <input type="file" name="file" id="fileInput" class="el-upload__input" accept="image/*" multiple>
                        </div>
                    </div>
                </div>
                <span class="call-word">Please upload the picture that smaller than 10M</span>
            </div>
        </section>

        <div class="submit-btn">
            <button id="submitButton">Submit</button>
        </div>

        <div class="el-dialog__wrapper dialog" id="successDialog" style="display:none;">
            <div role="dialog" aria-modal="true" aria-label="dialog" class="el-dialog" style="margin-top:30vh;">
                <div class="el-dialog__header">
                    <div class="dialog-header-title">
                        <i class="iconfont icon-yduizhengqueshixin" style="color:#84c7a7;"></i>
                        <span>Your request has been submitted successfully!</span>
                    </div>
                </div>
                <div class="el-dialog__footer">
                    <span class="dialog-footer">
                        <button type="button" class="el-button el-button--primary" id="dialogConfirm">OK</button>
                    </span>
                </div>
            </div>
        </div>
    </div>
    <!-- (Rest of the HTML remains the same) -->

    <script>document.addEventListener('DOMContentLoaded', function() {
    // Tab switching functionality with form changes
    const tabs = document.querySelectorAll('.wiki-nav-item');
    const formSections = document.querySelectorAll('.form-section');
    
    // Show the first form by default if forms exist
    if (formSections.length > 0) {
        formSections[0].classList.add('active');
    }
    
    tabs.forEach((tab, index) => {
        tab.addEventListener('click', function() {
            // Update tab styles
            tabs.forEach(t => t.classList.remove('home-tab-active'));
            this.classList.add('home-tab-active');
            
            // Hide all forms
            formSections.forEach(section => {
                section.classList.remove('active');
            });
            
            // Show the corresponding form
            const formId = this.textContent.trim().toLowerCase().replace(/\s+/g, '') + 'Form';
            const formToShow = document.getElementById(formId);
            
            if (formToShow) {
                formToShow.classList.add('active');
            } else if (formSections.length > 0) {
                // Default to first form if no match found
                formSections[0].classList.add('active');
            }
        });
    });

    const countries = [
        { name: "India", code: "IN", prefix: "0091", flag: "https://img.souhei.com.cn/flag/d7ed3e7b4fdbf486/IN.png_wiki-template-global" },
        { name: "United States", code: "US", prefix: "001", flag: "https://img.souhei.com.cn/flag/adaa5e0b8a65a672/US.png_wiki-template-global" },
        { name: "China", code: "CN", prefix: "0086", flag: "https://img.souhei.com.cn/flag/7d8833382673bab2/CN.png_wiki-template-global" },
        { name: "United Kingdom", code: "UK", prefix: "0044", flag: "https://img.souhei.com.cn/flag/52c9e8fc8d7d65f6/UK.png_wiki-template-global" },
        { name: "Japan", code: "JP", prefix: "0081", flag: "https://img.souhei.com.cn/flag/afb23edb45c6c8cf/JP.png_wiki-template-global" },
        { name: "Australia", code: "AU", prefix: "0061", flag: "https://img.souhei.com.cn/flag/045fe4098d24356d/AU.png_wiki-template-global" },
        { name: "Canada", code: "CA", prefix: "001", flag: "https://img.souhei.com.cn/flag/b4b32b9e9479f387/CA.png_wiki-template-global" },
        { name: "Germany", code: "DE", prefix: "0049", flag: "https://img.souhei.com.cn/flag/2ed6fcde5bf696a6/DE.png_wiki-template-global" },
        { name: "France", code: "FR", prefix: "0033", flag: "https://img.souhei.com.cn/flag/432747c2bcd97b82/FR.png_wiki-template-global" },
        { name: "Brazil", code: "BR", prefix: "0055", flag: "https://img.souhei.com.cn/flag/3137cbadd21ce901/BR.png_wiki-template-global" }
    ];

    // Group countries by first letter
    const countriesByLetter = {};
    countries.forEach(country => {
        const firstLetter = country.name.charAt(0).toUpperCase();
        if (!countriesByLetter[firstLetter]) {
            countriesByLetter[firstLetter] = [];
        }
        countriesByLetter[firstLetter].push(country);
    });

    // Get references to country list containers (assuming these exist in HTML)
    const countryLetters = document.querySelector('.country-letters');
    const countryListContainer = document.querySelector('.country-list');
    
    // Only proceed if the containers exist
    if (countryLetters && countryListContainer) {
        // Create letter navigation
        const letters = Object.keys(countriesByLetter).sort();
        letters.forEach(letter => {
            const letterElement = document.createElement('li');
            letterElement.textContent = letter;
            letterElement.addEventListener('click', () => {
                document.querySelectorAll('.country-letter li').forEach(li => li.classList.remove('selected'));
                letterElement.classList.add('selected');
                scrollToLetter(letter);
            });
            countryLetters.appendChild(letterElement);
        });

        // Create country list
        letters.forEach(letter => {
            const letterGroup = document.createElement('li');
            letterGroup.dataset.num = letter;
            
            const letterHeader = document.createElement('p');
            letterHeader.textContent = letter;
            letterGroup.appendChild(letterHeader);
            
            countriesByLetter[letter].forEach(country => {
                const countryElement = document.createElement('div');
                countryElement.className = 'country-details';
                countryElement.innerHTML = `
                    <img src="${country.flag}" alt="${country.name} flag" class="country-icon">
                    <span>${country.prefix}</span>
                    <span style="margin: 0px 6px;">${country.name}</span>
                `;
                countryElement.addEventListener('click', () => {
                    selectCountry(country);
                });
                letterGroup.appendChild(countryElement);
            });
            
            countryListContainer.appendChild(letterGroup);
        });
    }

    // Form validation for each form type
    const submitButton = document.getElementById('submitButton');
    
    if (submitButton) {
        submitButton.addEventListener('click', function(e) {
            e.preventDefault();
            
            // Reset all error messages
            document.querySelectorAll('.error-message').forEach(el => {
                el.style.display = 'none';
            });
            
            // Determine which form is active
            const activeForm = document.querySelector('.form-section.active');
            if (!activeForm) return;
            
            let isValid = true;
            
            // Validate common fields
            const phone = document.getElementById('phoneNumber')?.value.trim() || '';
            const wechat = document.getElementById('wechat')?.value.trim() || '';
            const whatsapp = document.getElementById('whatsapp')?.value.trim() || '';
            
            if (phone === '' && wechat === '' && whatsapp === '') {
                const contactError = document.getElementById('contactRequiredError');
                if (contactError) contactError.style.display = 'block';
                isValid = false;
            }
            
            if (phone !== '' && !validatePhone(phone)) {
                const phoneError = document.getElementById('phoneError');
                if (phoneError) phoneError.style.display = 'block';
                isValid = false;
            }
            
            // Validate specific form fields
            if (activeForm.id === 'cooperationForm') {
                if (!validateField('coopName', 'coopNameError')) isValid = false;
                if (!validateField('coopCompany', 'coopCompanyError')) isValid = false;
                
                const email = document.getElementById('coopEmail')?.value.trim() || '';
                const emailError = document.getElementById('coopEmailError');
                if (email === '') {
                    if (emailError) {
                        emailError.textContent = 'Required field';
                        emailError.style.display = 'block';
                    }
                    isValid = false;
                } else if (!validateEmail(email)) {
                    if (emailError) {
                        emailError.textContent = 'Valid email required';
                        emailError.style.display = 'block';
                    }
                    isValid = false;
                }
                
                if (!validateField('coopType', 'coopTypeError')) isValid = false;
                if (!validateField('coopDetails', 'coopDetailsError')) isValid = false;
            } 
            else if (activeForm.id === 'licenseForm') {
                if (!validateField('licenseName', 'licenseNameError')) isValid = false;
                // Add validation for other license form fields...
            }
            else if (activeForm.id === 'inclusionForm') {
                if (!validateField('inclusionName', 'inclusionNameError')) isValid = false;
                // Add validation for other inclusion form fields...
            }
            
            if (isValid) {
                // Form is valid - prepare data for submission
                const formData = {
                    formType: activeForm.id.replace('Form', ''),
                    phone: phone ? `${document.getElementById('countryPrefix')?.textContent || ''} ${phone}` : '',
                    wechat,
                    whatsapp,
                    images: []
                };
                
                const imagePreview = document.getElementById('imagePreview');
                if (imagePreview) {
                    formData.images = Array.from(imagePreview.children)
                        .filter(el => el.tagName === 'LI')
                        .map(li => {
                            const img = li.querySelector('img');
                            return img ? img.src : '';
                        })
                        .filter(src => src !== '');
                }
                
                // Add form-specific fields
                if (activeForm.id === 'cooperationForm') {
                    formData.name = document.getElementById('coopName')?.value.trim() || '';
                    formData.company = document.getElementById('coopCompany')?.value.trim() || '';
                    formData.email = document.getElementById('coopEmail')?.value.trim() || '';
                    formData.coopType = document.getElementById('coopType')?.value || '';
                    formData.details = document.getElementById('coopDetails')?.value.trim() || '';
                } 
                else if (activeForm.id === 'licenseForm') {
                    // Add license form fields...
                }
                else if (activeForm.id === 'inclusionForm') {
                    // Add inclusion form fields...
                }
                
                console.log('Form data to submit:', formData);
                
                // Show success dialog
                const successDialog = document.getElementById('successDialog');
                if (successDialog) successDialog.style.display = 'flex';
            }
        });
    }

    // Helper function to validate required fields
    function validateField(fieldId, errorId) {
        const field = document.getElementById(fieldId);
        const error = document.getElementById(errorId);
        
        if (!field || field.value.trim() === '') {
            if (error) error.style.display = 'block';
            return false;
        }
        return true;
    }

    // Helper function to validate phone numbers
    function validatePhone(phone) {
        // Basic phone validation - adjust as needed
        return /^[\d\s\-()+]+$/.test(phone);
    }

    // Helper function to validate email
    function validateEmail(email) {
        return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
    }

    // Helper function to scroll to letter
    function scrollToLetter(letter) {
        const target = document.querySelector(`.country-list li[data-num="${letter}"]`);
        if (target) {
            target.scrollIntoView({ behavior: 'smooth' });
        }
    }

    // Helper function to select country
    function selectCountry(country) {
        const prefixElement = document.getElementById('countryPrefix');
        if (prefixElement) prefixElement.textContent = country.prefix;
        // Close country selector if open
    }
});</script>
</body>
</html>