<div class="modal-overlay" id="inscriptionModal">
    <div class="modal-content modal-xl">
        <div class="modal-header">
            <h2 id="modalTitle">Nouvelle Inscription</h2>
            <button class="modal-close" onclick="closeModal()">&times;</button>
        </div>
        <div class="modal-body">
            <!-- Tabs -->
            <div class="tabs">
                <button class="tab-btn active" onclick="switchTab('info')" data-tab="info">
                    📋 Informations Générales
                </button>
                <button class="tab-btn" onclick="switchTab('bac')" data-tab="bac">
                    🎓 Baccalauréat
                </button>
                <button class="tab-btn" onclick="switchTab('diplome')" data-tab="diplome">
                    📜 Diplôme
                </button>
                <button class="tab-btn" onclick="switchTab('documents')" data-tab="documents">
                    📎 Documents
                </button>
            </div>

            <!-- Tab 1: Informations Générales -->
            <div id="tab-info" class="tab-content active">
                <form id="inscriptionForm">
                    <input type="hidden" id="inscriptionId">
                    <div class="form-row">
                        <div class="form-group">
                            <label for="code">Code *</label>
                            <input type="text" id="code" required placeholder="Ex: INSC001">
                        </div>
                        <div class="form-group">
                            <label for="label">Libellé *</label>
                            <input type="text" id="label" required placeholder="Ex: Inscription Mohamed Alaoui">
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label for="concours_id">Concours *</label>
                            <select id="concours_id" required>
                                <option value="">Sélectionner un concours</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="student_id">Étudiant *</label>
                            <select id="student_id" required>
                                <option value="">Sélectionner un étudiant</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label for="civilite">Civilité *</label>
                            <select id="civilite" required>
                                <option value="">Sélectionner</option>
                                <option value="Monsieur">Monsieur</option>
                                <option value="Madame">Madame</option>
                                <option value="Mademoiselle">Mademoiselle</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="etat_inscription">État Inscription</label>
                            <select id="etat_inscription">
                                <option value="EN_ATTENTE">En Attente</option>
                                <option value="VALIDE">Validée</option>
                                <option value="REJETE">Rejetée</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label for="resultat_inscription">Résultat</label>
                            <select id="resultat_inscription">
                                 EN_COURS
                                <option value="EN_COURS">EN COURS</option>
                                <option value="ELLIBGIBLE_ECRIT">ELLIBGIBLE_ECRIT</option>
                                <option value="NON_ELLIBGIBLE_ECRIT">NON ELLIBGIBLE ECRIT</option>
                                <option value="ELIGIBLE_ORALE">ELIGIBLE ORALE</option>
                                <option value="NON_ELIGIBLE_ORALE">NON ELIGIBLE ORALE</option>
                                <option value="ADMIS_ORALE">ADMIS ORALE</option>
                                <option value="NON_ADMIS_ORALE">NON ADMIS ORALE</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="active">Statut</label>
                            <select id="active">
                                <option value="1">Actif</option>
                                <option value="0">Inactif</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="description">Description</label>
                        <textarea id="description" rows="2" placeholder="Description de l'inscription..."></textarea>
                    </div>
                </form>
            </div>

            <!-- Tab 2: Baccalauréat -->
            <div id="tab-bac" class="tab-content">
                <div class="form-row">
                    <div class="form-group">
                        <label for="annee_bac">Année du Bac</label>
                        <input type="number" id="annee_bac" placeholder="Ex: 2020">
                    </div>
                    <div class="form-group">
                        <label for="specialite_bac">Spécialité Bac</label>
                        <input type="text" id="specialite_bac" placeholder="Ex: Sciences Mathématiques">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label for="mention_bac">Mention Bac</label>
                        <select id="mention_bac">
                            <option value="">Sélectionner</option>
                            <option value="Passable">Passable</option>
                            <option value="Assez Bien">Assez Bien</option>
                            <option value="Bien">Bien</option>
                            <option value="Très Bien">Très Bien</option>
                            <option value="Excellent">Excellent</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="moyenne_general_bac">Moyenne Générale Bac</label>
                        <input type="number" id="moyenne_general_bac" step="0.01" placeholder="Ex: 14.50">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label for="type_etablissement_bac">Type Établissement</label>
                        <select id="type_etablissement_bac">
                            <option value="">Sélectionner</option>
                            <option value="Public">Public</option>
                            <option value="Privé">Privé</option>
                            <option value="Étranger">Étranger</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="province">Province</label>
                        <input type="text" id="province" placeholder="Ex: Marrakech">
                    </div>
                </div>
            </div>

            <!-- Tab 3: Diplôme -->
            <div id="tab-diplome" class="tab-content">
                <div class="form-row">
                    <div class="form-group">
                        <label for="type_diplome_obtenu">Type Diplôme</label>
                        <select id="type_diplome_obtenu">
                            <option value="">Sélectionner</option>
                            <option value="DUT">DUT</option>
                            <option value="BTS">BTS</option>
                            <option value="DEUG">DEUG</option>
                            <option value="Licence">Licence</option>
                            <option value="Master">Master</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="specialite_diplome">Spécialité Diplôme</label>
                        <input type="text" id="specialite_diplome" placeholder="Ex: Informatique">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label for="anne_obtention_diplome">Année Obtention</label>
                        <input type="number" id="anne_obtention_diplome" placeholder="Ex: 2021">
                    </div>
                    <div class="form-group">
                        <label for="etablissement_origine">Établissement d'Origine</label>
                        <input type="text" id="etablissement_origine" placeholder="Ex: EST Marrakech">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label for="duree_diplome">Durée (années)</label>
                        <input type="number" id="duree_diplome" placeholder="Ex: 2">
                    </div>
                    <div class="form-group">
                        <label for="module_valide">Modules Validés</label>
                        <select id="module_valide">
                            <option value="0">Non</option>
                            <option value="1">Oui</option>
                        </select>
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label for="note_s1">Note Semestre 1</label>
                        <input type="number" id="note_s1" step="1" placeholder="Ex: 14.00">
                    </div>
                    <div class="form-group">
                        <label for="note_s2">Note Semestre 2</label>
                        <input type="number" id="note_s2" step="1" placeholder="Ex: 15.00">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group">
                        <label for="note_s3">Note Semestre 3</label>
                        <input type="number" id="note_s3" step="1" placeholder="Ex: 14.50">
                    </div>
                    <div class="form-group">
                        <label for="note_4">Note Semestre 4</label>
                        <input type="number" id="note_s4" step="1" placeholder="Ex: 16.00">
                    </div>
                </div>
                <div class="form-group">
                    <div class="form-row">
                        <div class="form-group">
                            <label for="note_s5">Note Semestre 5</label>
                            <input type="number" id="note_s5" step="1" placeholder="Ex: 14.50">
                        </div>
                        <div class="form-group">
                            <label for="note_s6">Note Semestre 6</label>
                            <input type="number" id="note_s6" step="1" placeholder="Ex: 16.00">
                        </div>
                    </div>
                    <label>Moyenne Générale Calculée</label>
                    <div style="padding: 10px; background: var(--bg-light); border-radius: var(--radius-sm); font-weight: bold; font-size: var(--font-size-lg); color: var(--primary-color);">
                        <span id="moyenne_calculee">-</span>
                    </div>
                </div>
            </div>

            <!-- Tab 4: Documents -->
            <div id="tab-documents" class="tab-content">
                <div class="form-row">
                    <div class="form-group">
                        <label for="bac_recto">Baccalauréat Recto</label>
                        <input type="file" id="bac_recto" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>

                    <div class="form-group">
                        <label for="bac_verso">Baccalauréat Verso</label>
                        <input type="file" id="bac_verso" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group">
                        <label for="attestation_reusite">Attestation Réussite</label>
                        <input type="file" id="attestation_reusite" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>
                    <div class="form-group">
                        <label for="releve_note">Relevé de Notes</label>
                        <input type="file" id="releve_note" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>

                </div>

                <div class="form-row">
                    <div class="form-group">
                        <label for="demande_maniscrite">Demande Manuscrite</label>
                        <input type="file" id="demande_maniscrite" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>
                    <div class="form-group">
                        <label for="cv">CV</label>
                        <input type="file" id="cv" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group">
                        <label for="cin_recto">CIN Recto</label>
                        <input type="file" id="cin_recto" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>
                    <div class="form-group">
                        <label for="cin_verso">CIN Verso</label>
                        <input type="file" id="cin_verso" accept=".pdf,.jpg,.jpeg,.png">
                        <span class="help-text">Format: PDF, JPG, PNG (Max 5MB)</span>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group">
                        <label for="moyenne_ecrit">Moyenne Écrit</label>
                        <input type="number" id="moyenne_ecrit" step="0.01" placeholder="Ex: 15.00">
                    </div>
                    <div class="form-group">
                        <label for="moyenne_orale">Moyenne Orale</label>
                        <input type="number" id="moyenne_orale" step="0.01" placeholder="Ex: 14.00">
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-secondary" onclick="closeModal()">Annuler</button>
            <button type="button" class="btn btn-primary" onclick="saveInscription()">💾 Enregistrer</button>
        </div>
    </div>
</div>
