/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3498db; /* Bleu */
    --primary-dark: #2980b9;
    --secondary-color: #2c3e50; /* Gris foncé/Bleu marine pour l'en-tête */
    --accent-color: #27ae60; /* Vert pour succès */
    --warning-color: #f39c12; /* Orange pour avertissement */
    --danger-color: #e74c3c; /* Rouge */
    --background-color: #f4f7f9; /* Fond plus doux */
    --card-background: white;
    --text-color: #333;
    --shadow-light: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-deep: 0 6px 20px rgba(0,0,0,0.15);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: margin-left 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ------------------------------------
   1. En-tête et Navigation
   ------------------------------------ */

header {
    background: var(--card-background);
    color: var(--secondary-color);
    padding: 1rem 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-light);
}

header h1 {
    margin: 0;
    font-size: 1.8em;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9em;
}

.user-info span {
    color: var(--secondary-color);
}


/* --- Menu de Navigation (Desktop) --- */
.main-nav {
    display: flex;
    background: var(--secondary-color);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.nav-link {
    padding: 15px 20px;
    text-decoration: none;
    color: white;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

/* --- Menu Hamburger (Mobile) --- */
.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--secondary-color);
}

/* Menu Off-Canvas (Mobile) */
.mobile-nav {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background: var(--secondary-color);
    color: white;
    padding: 20px;
    z-index: 1001;
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    transition: left 0.3s;
    display: flex;
    flex-direction: column;
}

.mobile-nav.open {
    left: 0;
}

.mobile-nav .nav-link {
    padding: 15px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.mobile-nav .close-menu {
    color: white;
    font-size: 30px;
    align-self: flex-end;
    margin-bottom: 20px;
    cursor: pointer;
}

/* ------------------------------------
   2. Boutons et Badges
   ------------------------------------ */

.btn {
    display: inline-block;
    padding: 10px 18px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: var(--accent-color);
    color: white;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-small {
    padding: 7px 12px;
    font-size: 0.85em;
    box-shadow: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.badge {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
}

.badge.success {
    background: #d4edda;
    color: #155724;
}

.badge.error {
    background: #f8d7da;
    color: #721c24;
}

.badge.warning {
    background: #fff3cd;
    color: #856404;
}


/* ------------------------------------
   3. Contenu et Mise en Page
   ------------------------------------ */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-background);
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow-light);
    transition: transform 0.2s;
    border-top: 5px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-deep);
}

.stat-card h3 {
    font-size: 2.8em;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-card p {
    font-size: 1.1em;
    color: #7f8c8d;
}

.form-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-light);
}

.form-section h2 {
    color: var(--secondary-color);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
    outline: none;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.table-section {
    background: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 15px;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--secondary-color);
    position: sticky;
    top: 0;
}

.data-table tr:hover {
    background: #fcfcfc;
}

.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ------------------------------------
   4. Styles Spécifiques
   ------------------------------------ */

.login-page {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #6a5acd 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--card-background);
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow-deep);
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.login-form p {
    text-align: center;
    margin-bottom: 30px;
    color: #7f8c8d;
}

.note-reussi {
    color: var(--accent-color);
    font-weight: bold;
}
.note-repechage {
    color: var(--warning-color);
    font-weight: bold;
}
.note-reprise {
    color: var(--danger-color);
    font-weight: bold;
}

.matiere-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.matiere-item input {
    flex: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    overflow: auto;
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 550px;
    position: relative;
    box-shadow: var(--shadow-deep);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.2s;
}

.close:hover {
    color: var(--danger-color);
}

/* Styles pour le format BULLETIN UNAF */

.bulletin-carte {
    max-width: 800px;
    margin: 30px auto;
}

.unaf-header-image {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    width: 100%;
    overflow: hidden; 
}

.unaf-header-image img {
    width: 100%; 
    max-width: 100%; 
    height: auto;
    display: block; 
}

.bulletin-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--primary-color);
}

.general-info {
    border-top: 1px dashed #ccc;
    padding-top: 15px;
    margin-top: 15px;
}

.general-info p {
    margin: 8px 0;
    font-size: 0.95em;
}

.signatures {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 50px;
}

.signatures div {
    width: 45%;
    text-align: center;
}

/* ------------------------------------
   5. Responsive (Mobile First)
   ------------------------------------ */

.main-nav {
    display: none;
}

@media (min-width: 768px) {
    body {
        margin-left: 0 !important;
    }

    .container {
        padding: 20px;
    }
    
    header {
        flex-direction: row;
        text-align: left;
    }

    .menu-toggle {
        display: none;
    }

    .main-nav {
        display: flex;
        flex-direction: row;
    }

    .mobile-nav {
        display: none;
    }
    
    .form-row {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
    
    @media print {
        .signatures div:last-child {
            border-top: 1px solid #000 !important;
        }
        
        .unaf-header-image img {
            max-width: 100% !important; 
        }
    }
}

/* ============================================= */
/* 6. STYLE SPÉCIFIQUE POUR LA PAGE D'ACCUEIL    */
/* ============================================= */

/* Conteneur principal de la page d'accueil */
main.accueil {
    text-align: center;
    padding: 2rem 0;
}

/* Titre de la section "Bienvenue" */
main.accueil .presentation h2 {
    font-size: 2em;
    color: var(--secondary-color);
    margin-bottom: 2.5rem;
}

/* Conteneur pour les 3 cartes de fonctionnalités */
main.accueil .features {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    text-align: left;
    margin-bottom: 3rem;
}

/* Style de chaque carte de fonctionnalité */
main.accueil .feature {
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    border-top: 4px solid var(--primary-color);
    flex-basis: 300px;
    flex-grow: 1;
    max-width: 350px;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

main.accueil .feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-deep); 
}

/* Titres H3 à l'intérieur des cartes */
main.accueil .feature h3 {
    color: var(--primary-dark);
    font-size: 1.25em;
    margin-bottom: 10px;
    text-align: left;
    margin-top: 0;
}

/* Paragraphes UNIQUEMENT dans les cartes de la page d'accueil */
main.accueil .feature p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
}

/* Section pour les boutons "Connexion" etc. */
main.accueil .actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Paragraphe du pied de page (footer) */
footer p {
    font-size: 0.9rem;
    color: #6c757d;
    text-align: center;
    padding: 10px 0;
}