/* css/style.css */

/* --- Variables CSS (Optionnel mais recommandé pour la cohérence) --- */
:root {
    --primary-color: #007bff; /* Bleu Bootstrap */
    --secondary-color: #6c757d; /* Gris secondaire */
    --success-color: #28a745; /* Vert succès */
    --danger-color: #dc3545; /* Rouge danger */
    --warning-color: #ffc107; /* Jaune avertissement */
    --info-color: #17a2b8;   /* Cyan information */

    --text-color: #333;
    --light-text-color: #666;
    --border-color: #ddd;
    --background-color: #f4f7f6;
    --card-background: #ffffff;

    --header-height: 80px;
    --footer-height: 60px; /* À ajuster si le footer est plus grand */
}

/* --- Styles Généraux et Réinitialisation (Reset Basique) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Simplifie le calcul des largeurs avec padding/border */
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1; /* Permet au main de prendre l'espace disponible */
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
    color: #0056b3; /* Bleu plus foncé au survol */
    text-decoration: underline;
}

ul {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    color: #2c3e50; /* Gris foncé pour les titres */
    margin-bottom: 0.8em;
    line-height: 1.2;
}

p {
    margin-bottom: 1em;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Conteneurs et Layouts --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Header --- */
header {
    background-color: var(--card-background);
    color: var(--text-color);
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .logo {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
}

.main-menu {
    display: flex;
    gap: 25px;
}

.main-menu li a {
    color: var(--text-color);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-menu li a:hover,
.main-menu li a.active {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* --- Navigation mobile (Hamburger) --- */
.nav-toggle {
    display: none; /* Masqué par défaut sur les grands écrans */
    font-size: 2em;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    z-index: 1001;
}

/* --- Hero Section (Page d'accueil) --- */
.hero {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 80px 20px;
    margin-bottom: 40px;
}

.hero h1 {
    color: white;
    font-size: 3.5em;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.3em;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

.btn {
    display: inline-block;
    background-color: var(--success-color);
    color: white;
    padding: 12px 25px;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--secondary-color);
}
.btn-secondary:hover {
    background-color: #5a6268;
}

/* --- Sections de Contenu Générales (Accueil) --- */
.section-title {
    text-align: center;
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.features-grid, .courses-grid, .testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.card {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.card i { /* Icônes dans les cartes de fonctionnalités */
    font-size: 3em;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.card h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: #333;
}

/* --- Formulaires --- */
.auth-container, .form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    background-color: var(--background-color);
    padding: 20px;
}

.auth-box, .form-box {
    background-color: var(--card-background);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    text-align: center;
    border-top: 5px solid var(--primary-color);
}

.auth-box h1, .form-box h1 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.2em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--light-text-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: calc(100% - 22px); /* Ajuster pour padding */
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box; /* Inclure padding et border dans la largeur */
    color: var(--text-color);
    background-color: #fcfcfc;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-box button, .auth-box button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.form-box button:hover, .auth-box button:hover {
    background-color: #0056b3;
}

.auth-box .links {
    margin-top: 25px;
    font-size: 0.95em;
}

.auth-box .links a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 10px;
}
.auth-box .links a:hover {
    text-decoration: underline;
}

/* --- Dashboard Layout --- */
.dashboard-container {
    display: flex;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    background-color: var(--background-color);
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #2c3e50; /* Gris foncé pour la sidebar */
    color: white;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Empêche le rétrécissement */
}

.sidebar-header {
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-header h3 {
    color: white;
    font-size: 1.5em;
    margin-bottom: 5px;
}
.sidebar-header p {
    font-size: 0.9em;
    opacity: 0.8;
}

.sidebar-menu li a {
    display: block;
    padding: 12px 25px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* Main Content de Dashboard */
.main-content {
    flex-grow: 1;
    padding: 30px;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin: 20px;
}

.main-content h1 {
    color: var(--primary-color);
    margin-bottom: 25px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    font-size: 2.2em;
}

/* Sections spécifiques au dashboard (statistiques, actions) */
.dashboard-summary, .dashboard-actions, .upcoming-devoirs {
    background-color: #f8f8f8; /* Gris clair pour les sections */
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.dashboard-summary h2, .dashboard-actions h2, .upcoming-devoirs h2 {
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 30px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 15px;
}

.stats-grid, .action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    justify-content: center;
}

.stat-card {
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 5px solid var(--primary-color);
    transition: transform 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.stat-card h3 {
    color: var(--light-text-color);
    font-size: 1.2em;
    margin-bottom: 10px;
}
.stat-card p {
    font-size: 2.2em;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
}
.stat-card .attention-text {
    color: var(--danger-color); /* Rouge pour les éléments nécessitant une action */
}

.action-btn {
    background-color: var(--success-color);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1em;
    display: block;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.action-btn:hover {
    background-color: #218838;
    transform: translateY(-3px);
}

/* Liste des éléments (actualités, utilisateurs, cours) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--card-background);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden; /* Pour que les coins soient arrondis */
}

.data-table th, .data-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background-color: #e9ecef; /* Gris clair pour les en-têtes */
    color: #495057;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

.data-table tr:nth-child(even) {
    background-color: #f8f9fa; /* Ligne paire */
}

.data-table tr:hover {
    background-color: #e2f2ff; /* Couleur au survol */
}

.data-table .actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.data-table .actions a,
.data-table .actions button {
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85em;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap; /* Empêche le texte de se casser */
}

.data-table .actions .edit-btn {
    background-color: var(--warning-color);
    color: #333;
}
.data-table .actions .edit-btn:hover {
    background-color: #e0a800;
}

.data-table .actions .delete-btn {
    background-color: var(--danger-color);
    color: white;
}
.data-table .actions .delete-btn:hover {
    background-color: #c82333;
}

.data-table .actions .view-btn { /* Pour les boutons "Voir" */
    background-color: var(--info-color);
    color: white;
}
.data-table .actions .view-btn:hover {
    background-color: #117a8b;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: var(--light-text-color);
    font-style: italic;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-top: 20px;
}

/* Messages (succès, erreur) */
.success-message, .error-message {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    opacity: 1; /* Par défaut visible, JS gérera la disparition */
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --- Footer --- */
footer {
    background-color: #2c3e50; /* Doit correspondre à la sidebar si elle est active */
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: auto; /* Pousse le footer vers le bas */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

footer p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.8;
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    header {
        flex-wrap: wrap;
        padding: 15px;
    }
    header .logo {
        flex-grow: 1;
        text-align: left;
    }
    .main-menu {
        display: none; /* Masquer le menu normal */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: var(--header-height); /* Sous le header */
        left: 0;
        background-color: var(--card-background);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        padding: 10px 0;
        border-top: 1px solid var(--border-color);
        z-index: 999;
    }
    .main-menu.nav-open {
        display: flex; /* Afficher quand la classe est ajoutée par JS */
    }
    .main-menu li {
        width: 100%;
        text-align: center;
    }
    .main-menu li a {
        padding: 15px 20px;
        width: 100%;
        border-radius: 0; /* Pleine largeur */
    }
    .nav-toggle {
        display: block; /* Afficher le bouton hamburger */
    }

    .hero {
        padding: 60px 15px;
    }
    .hero h1 {
        font-size: 2.8em;
    }
    .hero p {
        font-size: 1.1em;
    }
    .section-title {
        font-size: 2em;
        margin-bottom: 30px;
    }
    .features-grid, .courses-grid, .testimonials-grid {
        grid-template-columns: 1fr; /* Une colonne sur mobile */
        gap: 20px;
    }
    .card {
        padding: 25px;
    }

    .dashboard-container {
        flex-direction: column; /* La sidebar passe au-dessus du contenu principal */
    }
    .sidebar {
        width: 100%;
        padding: 15px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }
    .sidebar-menu {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        margin-top: 10px;
    }
    .sidebar-menu li {
        width: auto; /* Laisser les liens s'adapter */
    }
    .sidebar-menu li a {
        padding: 10px 15px;
        border-radius: 5px;
        white-space: nowrap; /* Évite les retours à la ligne inutiles */
    }
    .main-content {
        margin: 15px;
        padding: 20px;
    }
    .main-content h1 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .dashboard-summary, .dashboard-actions, .upcoming-devoirs {
        padding: 20px;
        margin-bottom: 30px;
    }
    .dashboard-summary h2, .dashboard-actions h2, .upcoming-devoirs h2 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    .stats-grid, .action-grid {
        grid-template-columns: 1fr;
    }
    .stat-card p {
        font-size: 1.8em;
    }

    /* Tableau responsive pour les petites tailles d'écran */
    .data-table, .data-table thead, .data-table tbody, .data-table th, .data-table td, .data-table tr {
        display: block;
    }
    .data-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px; /* Masquer l'en-tête réel */
    }
    .data-table tr {
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    .data-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%; /* Espace pour le label */
        text-align: right;
    }
    .data-table td:last-child {
        border-bottom: none;
    }
    .data-table td:before {
        position: absolute;
        left: 10px;
        content: attr(data-label); /* Utilise l'attribut data-label */
        font-weight: bold;
        text-align: left;
        width: 45%;
        white-space: nowrap;
        color: #555;
    }
    .data-table .actions {
        justify-content: flex-end;
        padding-top: 10px;
        padding-bottom: 5px; /* Ajustement pour le bas */
    }
    .form-box, .auth-box {
        padding: 30px 20px;
    }
}

@media (max-width: 576px) {
    .dashboard-header h1 {
        font-size: 2em;
    }
    .sidebar-menu {
        flex-direction: column;
    }
    .sidebar-menu li {
        width: 100%;
    }
}

/* --- Styles spécifiques pour certains éléments non inclus de base --- */
/* Exemple pour un tableau de devoirs à venir */
.upcoming-devoirs .devoir-list {
    list-style: none;
    padding: 0;
}
.upcoming-devoirs .devoir-list li {
    background-color: #fcf8e3; /* Jaune très clair */
    border: 1px solid #ffeeba; /* Bordure jaune */
    border-left: 5px solid var(--warning-color); /* Bordure latérale plus épaisse */
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}
.upcoming-devoirs .devoir-list li h3 {
    margin: 0;
    font-size: 1.2em;
    color: #333;
}
.upcoming-devoirs .devoir-list li p {
    margin: 0;
    font-size: 0.9em;
    color: #555;
}
.upcoming-devoirs .devoir-list .btn-view-devoir {
    align-self: flex-end; /* Aligner le bouton à droite */
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}
.upcoming-devoirs .devoir-list .btn-view-devoir:hover {
    background-color: #0056b3;
}