<!-- Modal Create/Edit Document -->
<div class="modal-overlay">
    <div class="modal-content" style="max-width: 700px;">
        <div class="modal-header">
            <h2 id="modalTitle">Nouveau Document</h2>
            <button type="button" class="modal-close" onclick="closeModal()">&times;</button>
        </div>
        <div class="modal-body">
            <form id="documentForm">
                <input type="hidden" id="documentId" value="">

                <div class="form-group">
                    <label for="employee_id">Employé <span class="required">*</span></label>
                    <select id="employee_id" name="employee_id" required>
                        <option value="">Sélectionner un employé</option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="original_name">Nom original <span class="required">*</span></label>
                    <input type="text" id="original_name" name="original_name"
                           placeholder="Ex: contrat_travail_2026.pdf" required>
                </div>

                <div class="form-group">
                    <label for="stored_name">Nom stocké <span class="required">*</span></label>
                    <input type="text" id="stored_name" name="stored_name"
                           placeholder="Ex: 2026_01_15_contrat_12345.pdf" required>
                    <small class="form-text">Nom unique pour le stockage (généré automatiquement si vide)</small>
                </div>

                <div class="form-row">
                    <div class="form-group half">
                        <label for="mime_type_id">Type MIME <span class="required">*</span></label>
                        <select id="mime_type_id" name="mime_type_id" required>
                            <option value="">Sélectionner un type</option>
                        </select>
                    </div>
                    <div class="form-group half">
                        <label for="size">Taille (octets) <span class="required">*</span></label>
                        <input type="number" id="size" name="size" placeholder="Ex: 1048576" required>
                        <small class="form-text">Taille du fichier en octets</small>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group half">
                        <label for="category_id">Catégorie <span class="required">*</span></label>
                        <select id="category_id" name="category_id" required>
                            <option value="">Sélectionner une catégorie</option>
                        </select>
                    </div>
                    <div class="form-group half">
                        <label for="etat_document_dossier_administratif_id">État <span class="required">*</span></label>
                        <select id="etat_document_dossier_administratif_id" name="etat_document_dossier_administratif_id" required>
                            <option value="">Sélectionner un état</option>
                        </select>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group half">
                        <label for="expiry_date">Date d'expiration</label>
                        <input type="date" id="expiry_date" name="expiry_date">
                    </div>
                    <div class="form-group half">
                        <label for="annee_univ">Année universitaire</label>
                        <input type="number" id="annee_univ" name="annee_univ" placeholder="Ex: 2026" min="2000" max="2100">
                    </div>
                </div>

                <div class="form-group">
                    <label for="note">Note</label>
                    <textarea id="note" name="note" rows="3" placeholder="Notes ou commentaires sur le document..."></textarea>
                </div>

                <div class="form-group">
                    <div class="checkbox-group">
                        <input type="checkbox" id="is_verified" name="is_verified" value="1">
                        <label for="is_verified">Document vérifié</label>
                    </div>
                </div>

                <div class="form-actions">
                    <button type="button" class="btn btn-secondary" onclick="closeModal()">
                        <i class="fas fa-times"></i> Annuler
                    </button>
                    <button type="button" class="btn btn-primary" onclick="saveDocument()">
                        <i class="fas fa-save"></i> Enregistrer
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>