/* Reset de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #1a1a1a;
    line-height: 1.6;
    font-size: 18px;
}

/* Header */
header {
    background-color: #FFA500;
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
    color: white;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: #a3b8cc;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav a::before {
    content: "\f060";  /* Code pour l'icône flèche gauche */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

nav a:hover {
    color: white;
    transform: translateX(-5px);
    transition: all 0.3s ease;
}

/* Lien vers le cours */
.course-link {
    text-align: center;
    margin: 1rem 0;
    padding: 0.5rem;
}

.course-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.course-link a:hover {
    background-color: rgba(0,0,0,0.05);
}

.course-link a i::before {
    content: "\f19d" !important;  /* Code pour l'icône graduation-cap */
}

/* Main content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Contrôles des exercices */
.exercise-controls {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.exercise-controls h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 500;
}

select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    background-color: white;
    cursor: pointer;
}

.generate-btn {
    width: 100%;
    padding: 1rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.generate-btn:hover {
    background-color: #2980b9;
}

/* Messages d'erreur */
.error-container {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 2rem;
    color: #c00;
    display: none;
}

.error-container.show {
    display: block;
    background-color: #fee;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #c00;
}

/* Conteneur de contenu */
.content-wrapper {
    display: none;
    margin-top: 2rem;
    width: 100%;
}

.content-wrapper.visible {
    display: block;
}

/* Section des conseils */
.advice-container {
    position: relative;
    background-color: white;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.advice-content {
    position: relative;
    color: #444;
    font-size: 1rem;
    line-height: 1.6;
    padding-left: 2rem;
    margin-top: 1.5rem;
}

.advice-content::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: #2c3e50;
    border-radius: 2px;
}

.advice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.advice-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.advice-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.advice-content li {
    margin-bottom: 0.3rem;
}

.print-options {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.print-options h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.print-options > div {
    margin-bottom: 0.5rem;
}

.pdf-link a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
}

.pdf-link a:hover {
    color: #2980b9;
}

/* Exercices */
.exercise-container {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.exercise-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.exercise-title h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.similar-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.similar-btn:hover {
    color: #2980b9;
    background-color: #f0f2f5;
}

.exercise-content {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Style pour les images dans les exercices */
.exercise-content p img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Styles pour les indices */
.hint-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.hint-btn {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hint-btn:hover {
    background-color: #f5f5f5;
    color: #333;
}

.hint {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-left: 4px solid #3498db;
    border-radius: 4px;
    color: #666;
    font-style: italic;
}

.hint.hidden {
    display: none;
}

/* Messages d'erreur */
.error-container {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 2rem;
    color: #c00;
    display: none;
}

.error-container.show {
    display: block;
    background-color: #fee;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #c00;
}

/* Conteneur et bouton d'impression */
.print-container {
    text-align: right;
    margin: 20px 0 100px 0;
}

.print-btn {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.print-btn:hover {
    background-color: #45a049;
}

.print-btn i {
    margin-right: 5px;
}

/* Footer */
footer {
    text-align: center;
    padding: 0.5rem 1rem;
    background-color: #2c3e50;
    color: white;
    position: fixed;
    bottom: 0;
    width: 100%;
}

/* Bouton générer */
.generate-btn {
    width: 100%;
    padding: 1rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.generate-btn:hover {
    background-color: #2980b9;
}

/* Lien PDF */
#pdfContainer {
    margin-top: 1.5rem;
    text-align: right;
}

#pdfContainer a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2c3e50;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

#pdfContainer a:hover {
    background-color: #e9ecef;
}

#pdfContainer i {
    color: #e74c3c;
}

/* Section des chapitres */
.chapters-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    list-style: none;
}

.chapters-list li {
    transition: transform 0.2s ease;
}

.chapters-list li:hover {
    transform: translateY(-3px);
}

.chapters-list a {
    display: block;
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    text-align: center;
    border-left: 4px solid #3498db;
}

.chapters-list a:hover {
    background-color: #3498db;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Style pour la section accueil */
#accueil {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

#accueil h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
    font-size: 2rem;
    position: relative;
    padding-bottom: 1rem;
}

#accueil h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background-color: #3498db;
    border-radius: 2px;
}

/* Media Queries pour l'impression */
@media print {
    body {
        background: none;
        margin: 0;
        padding: 20px;
    }

    header,
    nav,
    .exercise-controls,
    .course-link,
    .generate-btn,
    .print-container,
    .hint-btn,
    footer {
        display: none !important;
    }

    .content-wrapper {
        display: block !important;
    }

    .exercise-container {
        page-break-inside: avoid;
        margin-bottom: 20px;
        border: none;
        box-shadow: none;
    }

    /* Inverser l'ordre des indices pour l'impression */
    .exercise-container {
        display: flex;
        flex-direction: column;
    }

    .hint {
        display: block !important;
        order: 2;
        background: none;
        border: 1px solid #ccc;
        padding: 10px;
        margin-top: 20px;
        font-style: normal;
        page-break-inside: avoid;
    }

    .exercise-content {
        order: 1;
    }

    /* Ajouter un titre "Indice" avant chaque indice */
    .hint::before {
        content: "Indice :";
        font-weight: bold;
        display: block;
        margin-bottom: 5px;
    }
}
