<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Gestion des Concours - EST</title>
    <!-- Font Awesome for icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <!-- Separate CSS file (admin-styles.css) -->
    <link rel="stylesheet" href="../../../../../css/admin-styles.css">
</head>
<body>
<?php include "../../../../../layouts/admin/header.php" ?>

<!-- ====== NAV BAR (second level) ====== -->
<?php include "../../../../../layouts/admin/student/nav-second-level.php" ?>


<!-- ====== MAIN CONTENT ====== -->
<main class="main-content">

    <div class="container">


        <!-- Search Section -->
        <div class="search-section">
            <form id="searchForm" class="search-form">
                <div class="form-group">
                    <label for="searchNom">Nom</label>
                    <input type="text" id="searchNom" placeholder="Rechercher par nom...">
                </div>
                <div class="form-group">
                    <label for="searchPrenom">Prénom</label>
                    <input type="text" id="searchPrenom" placeholder="Rechercher par prénom...">
                </div>
                <div class="form-group">
                    <label for="searchEmail">Email</label>
                    <input type="text" id="searchEmail" placeholder="Rechercher par email...">
                </div>
                <div class="form-group">
                    <label for="searchCIN">CIN</label>
                    <input type="text" id="searchCIN" placeholder="Rechercher par CIN...">
                </div>
                <div class="form-group">
                    <label for="searchPhone">Téléphone</label>
                    <input type="text" id="searchPhone" placeholder="Rechercher par téléphone...">
                </div>
                <div class="search-actions">
                    <button type="submit" class="btn btn-primary">🔍 Rechercher</button>
                    <button type="reset" class="btn btn-secondary" onclick="resetSearch()">🔄 Réinitialiser</button>
                    <button type="button" class="btn btn-success" onclick="openCreateModal()">➕ Nouvel Étudiant</button>
                </div>
            </form>
        </div>

        <!-- Table -->
        <div class="table-container">
            <div class="table-wrapper">
                <table>
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>Nom</th>
                        <th>Prénom</th>
                        <th>Email</th>
                        <th>CIN</th>
                        <th>Téléphone</th>
                        <th>Actions</th>
                    </tr>
                    </thead>
                    <tbody id="tableBody">
                    <tr>
                        <td colspan="7" style="text-align: center; padding: 40px;">
                            <div class="loading active">
                                <div class="spinner"></div>
                                <p style="margin-top: 10px;">Chargement des données...</p>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="pagination">
                <div class="pagination-info" id="paginationInfo">Affichage de 0 à 0 sur 0</div>
                <div class="pagination-buttons" id="paginationButtons">
                    <button onclick="changePage('prev')" id="prevBtn">◀ Précédent</button>
                    <span id="pageNumbers"></span>
                    <button onclick="changePage('next')" id="nextBtn">Suivant ▶</button>
                </div>
            </div>
        </div>
    </div>
</main>


<!-- ====== FOOTER ====== -->
<?php include "../../../../../layouts/admin/footer.php" ?>



<!-- Modal for Create/Update -->
<?php include "../create-edit/modal.php" ?>

<!-- Detail Modal -->
<?php include "../view/modal.php"; ?>

<!-- Toast Container -->
<div class="toast-container" id="toastContainer"></div>
<script src="main.js?v=2"></script>
</body>
</html>
