/* --- VARIABLES ET PARAMÈTRES GLOBAUX --- */
:root {
    /* Thème clair par défaut */
    --bg-color: radial-gradient(circle, #f5f7fa, #e0e5ec);
    --card-bg: #ffffff;
    --text-color: #333333;
    --header-bg: rgb(166, 202, 243);
    --header-text: #000000;
    --border-color: #dee2e6;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* --- NOUVELLE PALETTE DE COULEURS BASÉE SUR LA NAVBAR --- */
    --primary-dark-blue: #486c94;  /* Version sombre de la navbar (rgb(72, 108, 148)) */
    --primary-light-blue: #a6caf3; /* Version claire de la navbar (rgb(166, 202, 243)) */
    --primary-mid-blue: #5f7fa4;  /* Un bleu intermédiaire pour les accents */
    --accent-green: #26a69a;      /* Un vert sarcelle (teal) qui s'accorde bien avec le bleu */
    --accent-green-dark: #00796b; /* Version foncée pour les :hover */
    --subtle-bg-color: #eef4fb;   /* Fond très clair avec une teinte de bleu */
    --subtle-border-color: #dce9f8; /* Bordure assortie au fond clair */
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #121212;
        --card-bg: #f8f8f8;
        --text-color: #000000;
        --header-bg: rgb(66, 102, 143);
        --header-text: #ffffff;
        --border-color: #424242;
        --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
}

/* --- STYLES DE BASE --- */
html {
    box-sizing: border-box;
    /* Modèle de boîte plus intuitif */
}

*,
*:before,
*:after {
    box-sizing: inherit;
}

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    padding-bottom: 70px;
    /* Add padding to prevent footer from overlapping content */
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    /* Évite les espaces blancs sous les images */
    margin-left: auto;
    margin-right: auto;
    width: 60%;
}

figure {
    margin: 0;
}

/* --- LAYOUT PRINCIPAL --- */
.main-container {
    display: flex;
    /* Active Flexbox */
    justify-content: center;
    /* Centre les éléments horizontalement */
    align-items: stretch;
    /* Les éléments auront la même hauteur */
    flex-wrap: wrap;
    /* Permet aux éléments de passer à la ligne sur petits écrans */
    gap: 2rem;
    /* Espace de 2rem entre chaque élément (remplace margin-left) */
    padding: 2rem;
    /* Espace autour du conteneur */
    width: 100%;
}

/* --- STYLE COMMUN DES CARTES --- */
.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    /* Assure que les coins du header sont bien arrondis */
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;


    /* Gère la taille des cartes */
    flex-grow: 1;
    /* Permet à la carte de grandir */
    flex-basis: 300px;
    /* Taille de base avant de grandir/rétrécir */
    max-width: 400px;
    /* Largeur maximale pour une carte */
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* --- STYLES SPÉCIFIQUES AUX CARTES --- */

/* Carte D'Alembert */
.dalembert-card {
    /* On peut lui donner une taille de base légèrement différente si besoin */
    flex-basis: 280px;
    max-width: 350px;
    padding-top: .5cm;
}

.dalembert-card figcaption {
    padding: 1rem;
    text-align: center;
    font-style: italic;
    color: var(--text-color);
}

/* Cartes de contenu (Bienvenue, Blague) */
.content-card .box-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    text-align: center;
    font-size: xx-large;
    /* Utilisation de rem pour l'accessibilité */
    font-weight: 600;
    padding: 1rem;
}


.content-card .box-content {
    padding: 1.5rem;
    font-size: larger;
    /* <-- La taille de la police a été augmentée */
    line-height: 1.6;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- RESPONSIVE DESIGN --- */
@media all and (orientation: portrait) {
    .main-container {
        flex-direction: column;
        /* Empile les cartes verticalement */
        align-items: center;
        /* Centre les cartes empilées */
        padding: 1rem;
        gap: 1.5rem;
    }

    .card {
        width: 90%;
        /* Les cartes prennent presque toute la largeur */
        flex-basis: auto;
        /* On réinitialise la base flex */
        font-size: larger;
    }
}

/* ************** Menu setting ************ */
nav {
    width: 100%;
}

.navbar {
    position: fixed;
    width: 100%;
    background: linear-gradient(to right, rgb(72, 108, 148), rgb(166, 202, 243));
    border: none;
}

/* You can also be more specific to just change the color */
.navbar-inverse {
    border-color: white;
    /* This changes the black line to white */
}


ul.menu,
.navbar-nav.menu {
    background: transparent;
}

/* Target the list items more specifically */
.navbar-nav.menu>li>a {
    display: block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}


.navbar-nav.menu>li>a.active {
    background-color: #5f6966;
    color: white;
}

.navbar-nav.menu>li>a:hover:not(.active) {
    background-color: rgb(0, 0, 0);
    color: white;
}

/* On mobile, the hamburger button has a border we can also change */
.navbar-header {
    float: left;
}

.navbar-toggle {
    float: left !important;
    margin-right: 0 !important;
    padding: 8px 10px;
    /* You can fine-tune these values */
    border-color: white !important;
    box-shadow: none;
    /* Removes any inner shadows */
}


/* Change the color of the hamburger icon bars */
.navbar-toggle .icon-bar {
    background-color: white !important;
}

/* On mobile, the menu items don't have a background. Let's ensure they keep the gradient */
@media (max-width: 767px) {
    .navbar-nav.menu {
        background: linear-gradient(to right, rgb(115, 147, 184), rgb(166, 202, 243));
        padding: 10px 0;
    }

    .navbar-nav.menu>li>a {
        text-align: left;
        padding-left: 1.5em;
        font-size: 16px;
        color: white !important;
    }

    .navbar-inverse .navbar-collapse {
        background: linear-gradient(to right, rgb(115, 147, 184), rgb(166, 202, 243));
    }
}

/* =========================================
   FLASHCARDS CONTAINER STYLE
   ========================================= */
.flashcards,.quizPrerequis {
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0; /* Le padding n'est plus nécessaire sur le conteneur */
    margin-top: 1rem; /* Ajoute un espace au-dessus du bouton */
    margin-bottom: 5px;
}

/* --- NOUVEAU STYLE POUR LE SÉPARATEUR DE CHAPITRE --- */
.chapitre-separator {
    width: 100%;                  /* Prend toute la largeur du conteneur */
    border: none;                 /* Supprime la bordure par défaut */
    border-top: 1px solid var(--border-color); /* Crée une ligne fine et propre */
    margin: 1.5rem 0;             /* Ajoute de l'espace vertical autour de la ligne */
    flex-basis: 100%;             /* Assure qu'il occupe une ligne entière dans le flexbox */
}

/* =========================================
   MODERN BUTTON STYLES (ALL BUTTONS)
   ========================================= */

/* --- A) Large Buttons (Resource Boxes) --- */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1em;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-modern i {
    font-size: 1.2em;
}

.btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.2);
}

.btn-modern.btn-pdf {
    background: linear-gradient(45deg, #d32f2f, #f44336);
}

.btn-modern.btn-url {
    background: linear-gradient(45deg, #1e88e5, #42a5f5);
}

/* --- B) Compact Document Buttons (Énoncé, Corrigé, etc.) --- */
.btn-doc {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 14px;
    margin: 3px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    color: #ffffff;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-doc i {
    font-size: 1.1em;
}

.btn-doc:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Color for "Énoncé" / generic documents */
.btn-doc.btn-enonce {
    background-color: var(--primary-dark-blue);
    border-color: #364f6b;
}

.btn-doc.btn-enonce:hover {
    background-color: #364f6b;
}

/* Color for "Corrigé" */
.btn-doc.btn-corrige {
    background-color: var(--accent-green);
    border-color: var(--accent-green-dark);
}

.btn-doc.btn-corrige:hover {
    background-color: var(--accent-green-dark);
}

/* Color for "Flashcards" button */
.btn-doc.btn-flashcard {
    background-color: var(--primary-mid-blue);
    border-color: #4a6788;
}

.btn-doc.btn-flashcard:hover {
    background-color: var(--primary-dark-blue);
}

.btn-quiz { 
    background-color: #f1c40f; 
    color: #333; 
} /* Bright yellow for Quiz */

/* Color for "Flashcards" button */
.btn-doc.btn-quizPrerequis {
    background-color: var(--primary-mid-blue);
    border-color: #26292c;
}

.btn-doc.btn-quizPrerequis:hover {
    background-color: var(--primary-dark-blue);
}

/* Style for disabled/non-available documents */
.btn-doc.btn-disabled {
    background-color: #adb5bd;
    border-color: #98a2aa;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- C) NEW: Compact Link Buttons (Fichiers & Liens) --- */
.btn-link {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85em;
    text-transform: uppercase;
    color: var(--primary-dark-blue);
    background-color: var(--subtle-bg-color);
    border: 1px solid var(--subtle-border-color);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-link:hover {
    background-color: var(--primary-dark-blue);
    color: white;
    border-color: var(--primary-dark-blue);
    transform: translateY(-1px);
}

/* ************** header ************ */
.header {
    position: relative;
    text-align: center;
    /* background: linear-gradient(60deg, rgba(84, 58, 183, 1) 0%, rgba(0, 172, 193, 1) 100%); */
    background: linear-gradient(to right, rgb(72, 108, 148), rgb(166, 202, 243));
    color: white;
}

.logo {
    width: 50px;
    fill: white;
    padding-right: 15px;
    display: inline-block;
    vertical-align: middle;
    margin-left: 20px;
    margin-right: 20px;
}

.inner-header {
    height: 8vh;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    /* Center horizontally */
    align-items: center;
    /* Center vertically */
    gap: 1rem;
    /* Optional spacing between logo and text */
}

.title-container {
    flex-grow: 1;
    text-align: center;
}

.flex {
    /*Flexbox for containers*/
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.waves {
    position: relative;
    width: 100%;
    height: 8vh;
    margin-bottom: -10px;
    /*Fix for safari gap*/
    margin-top: -40px;
    min-height: 10px;
    max-height: 50px;
}

.content {
    position: relative;
    height: 20vh;
    text-align: center;
    background-color: white;
}

/* Animation */
.parallax>use {
    animation: move-forever 25s cubic-bezier(.55, .5, .45, .5) infinite;
}

.parallax>use:nth-child(1) {
    animation-delay: -2s;
    animation-duration: 7s;
}

.parallax>use:nth-child(2) {
    animation-delay: -3s;
    animation-duration: 10s;
}

.parallax>use:nth-child(3) {
    animation-delay: -4s;
    animation-duration: 13s;
}

.parallax>use:nth-child(4) {
    animation-delay: -5s;
    animation-duration: 20s;
}

@keyframes move-forever {
    0% {
        transform: translate3d(-90px, 0, 0);
    }

    100% {
        transform: translate3d(85px, 0, 0);
    }
}

/* ************** Footer ************ */
footer {
    position: fixed;
    width: 100%;
    left: 0;
    bottom: 0;
    background-color: rgb(115, 147, 184);
    color: white;
    text-align: center;
    height: 50px;
    line-height: 50px;
    vertical-align: middle;
    padding-left: 20px;
    padding-right: 20px;
    z-index: 100;
}

/* ************** Tables ************ */
.tableCaption {
    font-family: 'Source Sans Pro', sans-serif;
    z-index: 1;
    font-size: 2em;
    caption-side: top;
    color: black;
    text-align: center;
}

.container-fluid {
    width: 90% !important;
    height: 100% !important;
}

.table {
    background-color: white;
    height: 100%;
}

.table-responsive {
    height: 100%;
}

.table th {
    text-align: center;
    vertical-align: middle !important;
    font-size: 1.5em;
}

.table .td {
    font-size: 1.5em;
    text-align: left;
}

.tdChapitre {
    font-weight: bold;
    font-size: 1.5em;
    text-align: left;
}

.table-bordered {
    border: 1px solid rgb(134, 134, 134) !important;
}

td {
    font-size: 1.25em;
    vertical-align: middle !important;
}

/* =========================================
   RESOURCE BOXES STYLES
   ========================================= */

/* Container for the three boxes */
.resource-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    padding: 2rem 1rem;
    width: 100%;
    align-items: flex-start;
    /* <--- FIX #2 (ADD THIS LINE) */
}

/* Individual box/card style */
.resource-card {
    background-color: var(--card-bg, #ffffff);
    border-radius: 16px;
    box-shadow: var(--shadow, 0 4px 12px rgba(0, 0, 0, 0.1));
    border: 1px solid var(--border-color, #e0e5ec);
    padding: 1.5rem;
    text-align: center;
    flex: 1 1 300px;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-in-out;
}

.resource-card:hover {
    transform: translateY(-5px);
}

.resource-card h4 {
    font-size: 1.5em;
    margin-top: 0;
    margin-bottom: 0.25rem;
    color: var(--text-color, #333);
}

.resource-card p {
    font-size: 1.05em;
    line-height: 1.5;
    color: #666;
    margin-bottom: 0.25rem;
    /* This now works as expected */
    /* The flex-grow: 1; line has been removed. */
}

/* =========================================
   MODERN BUTTON STYLES
   ========================================= */

.btn-modern {
    display: inline-flex;
    /* Use flexbox to easily align icon and text */
    align-items: center;
    /* Vertically center icon and text */
    justify-content: center;
    /* Horizontally center content */
    gap: 0.75rem;
    /* Space between icon and text */

    padding: 12px 24px;
    border-radius: 50px;
    /* Fully rounded corners for a modern "pill" shape */
    text-decoration: none;
    font-weight: 600;
    font-size: 1em;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Icon style inside the button */
.btn-modern i {
    font-size: 1.2em;
}

.btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.2);
}

/* Specific color for PDF buttons */
.btn-modern.btn-pdf {
    background: linear-gradient(45deg, #d32f2f, #f44336);
}

/* Specific color for URL/link buttons */
.btn-modern.btn-url {
    background: linear-gradient(45deg, #1e88e5, #42a5f5);
}

/* ************** Chapitre & Séquence Accordion (MODIFIED SECTION) ************ */
/* --- Level 1: Sequence Container --- */
details.containerSequence {
    display: block;
    margin: 1.5rem auto;
    width: 90%;
    border-left: 6px solid var(--header-bg);
    border-radius: 8px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

details.containerSequence[open] {
    background-color: #fdfdfd;
}

/* Style for the entire summary bar */
.sequence-summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    list-style: none;
    /* Remove default arrow marker */
    color: var(--text-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    /* Stack main title and chapter list vertically */
    gap: 0.5rem;
    position: relative;
    /* Add positioning context for the icon */
}

.sequence-summary::-webkit-details-marker {
    display: none;
}

/* Add a plus icon to indicate it can be opened */
.sequence-summary::after {
    content: '+';
    position: absolute;
    right: 1.5rem;
    /* Position on the right */
    top: 50%;
    /* Center vertically */
    transform: translateY(-50%);
    font-size: 2.5em;
    /* Make it easily visible */
    font-weight: 300;
    /* A lighter font-weight can look cleaner */
    color: #777;
    /* A slightly muted color for the icon */
}

details[open]>.sequence-summary {
    border-bottom: 1px solid var(--border-color);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Change the icon to a minus sign when the details element is open */
details[open]>.sequence-summary::after {
    content: '−';
    /* This is a proper minus sign (U+2212), not a hyphen-minus */
}

/* Style for the main "Séquence X" title */
.summary-main-title {
    font-size: 2em;
    font-weight: 600;
}

/* Style for the list of chapters inside the summary */
.summary-chapter-list {
    font-size: 1.1em;
    font-weight: 400;
    color: #555;
    display: flex;
    flex-direction: column;
    /* Each chapter on a new line */
    gap: 0.2rem;
}

/* Wrapper for the expanded content */
.sequence-content-wrapper {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --- Level 2: Chapter Container (now a simple div) --- */
.chapitre {
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    /* Important for rounded corners */
}

/* Chapter header (now a static title) */
.chapitre-summary {
    font-size: 1.2em;
    font-weight: bold;
    padding: 0.75rem 1rem;
    background-color: rgba(192, 204, 215, 0.2);
    list-style: none;
    position: relative;
}

.chapitre-summary::-webkit-details-marker {
    display: none;
}


/* --- Chapter Content Layout (unchanged) --- */
.chapitre-content {
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.plan,
.activite,
.quiz,
.flashcards,.quizPrerequis {
    border-radius: 10px;
    padding: 10px;
}

.plan {
    flex: 1 1 25%;
    min-width: 280px;
    max-width: 40%;
}

/* Unify backgrounds for interactive sections */
.quiz, .activites-tp, .fichiers-liens {
    background: var(--subtle-bg-color);
    border: 1px solid var(--subtle-border-color);
    border-radius: 12px;
    box-shadow: none; /* A border looks cleaner */
}

.fichiers-liens {
    max-width: 25%;
    min-width: 280px;
    padding: 1rem;
}

.fichiers-liens h4 {
    margin-top: 0;
    color: var(--primary-dark-blue);
}

.fichiers-liens ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fichiers-liens li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz {
    flex: 1 1 15%;
    min-width: 280px;
}

/* Update titles to use theme color */
.quiz h4,
.activite h4, 
.activites-tp h4 {
    margin-top: 0;
    color: var(--primary-dark-blue);
}

.plan p {
    margin-top: 0;
}

.evaluations {
    width: 100%;
    text-align: center;
    border: 0.22em solid #abd6ff;
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    box-sizing: border-box;
}

.openPopupBtn {
    width: 100%;
    margin-top: 5px;
    padding: 12px 20px;
    font-size: 1em;
    font-weight: 600;
    text-align: center;

    /* --- Gradient Style --- */
    color: white;
    border: none;
    border-radius: 50px;
    /* A "pill" shape is great for gradients */
    background: linear-gradient(to right, rgb(115, 147, 184), rgb(166, 202, 243));
    background-size: 100% 100%;
    /* For hover effect */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;

    transition: all 0.4s ease-in-out;
}

.openPopupBtn:hover,
.openPopupBtn:focus-visible {
    background-size: 150% 150%;
    /* Zooms the gradient for a cool effect */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.openPopupBtn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.activites-tp {
    max-width: 50%;
    width: fit-content;
    padding: 1rem;
}

.tp-card {
    background: white;
    /* Use the new theme color for the border */
    border-left: 5px solid var(--primary-dark-blue); 
    border-radius: 8px;
    padding: 0.75rem 1rem;
    flex: 1 1 280px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tp-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tp-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /* Allows items to wrap to the next line */
    gap: 1.5em;
    /* Adds space between items */
}

/* With Flexbox, we style the items themselves to control their size */
.tp-grid>.tp-block {
    /* flex: <grow> <shrink> <basis> */
    flex: 0 1 280px;
    /* Each item will try to be 300px, but can grow or shrink */
}

/* --- Optional: Add some styling to the TP blocks themselves --- */
.tp-block {
    border: 1px solid #ddd;
    padding: 1em;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: inline;
    /* Helps align the icon and text nicely */
    flex-direction: column;
    justify-content: space-between;
    /* Pushes buttons to the bottom */
}

.tp-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.5em;
}

/* --- Responsive for Mobile --- */
@media all and (orientation: portrait) {
    .sequence-summary {
        font-size: 1.5em;
    }

    .chapitre-content {
        flex-direction: column;
        gap: 1rem;
    }

    .tp-grid {
        width: 100%
    }

    .tp-grid>.tp-block {
        /* flex: <grow> <shrink> <basis> */
        flex:auto;
        /* Each item will try to be 300px, but can grow or shrink */
    }

    .plan,
    .activite,
    .quiz,
    .activites-tp,
    .fichiers-liens,
    .flashcards,.quizPrerequis {
        width: 100%;
        flex-basis: auto;
        /* Reset flex-basis */
        max-width: none;
        margin-left: 0;
    }

    .evaluations {
        width: 100%;
    }

    .tp-buttons {
        flex-direction: column;
    }
}

/* ==================================================
   NOUVEAU STYLE POUR LA SECTION ÉVALUATIONS
   ================================================== */

/* --- Conteneur principal de la section --- */
.evaluations-section {
    width: 100%;
    background-color: var(--subtle-bg-color, #eef4fb);
    border: 1px solid var(--subtle-border-color, #dce9f8);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-sizing: border-box;
}

.evaluations-section h3 {
    text-align: center;
    font-size: 1.8em;
    font-weight: 600;
    color: var(--primary-dark-blue, #486c94);
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* --- Grille pour les cartes d'évaluation --- */
.evaluations-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* --- Style de la carte individuelle par année --- */
.evaluation-card {
    background-color: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 12px;
    box-shadow: var(--shadow, 0 4px 12px rgba(0,0,0,0.1));
    padding: 1rem 1.5rem;
    flex: 1 1 320px; /* Base pour la responsivité */
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.evaluation-card-title {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-dark-blue, #486c94);
    text-align: center;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-light-blue, #a6caf3);
}

/* --- Style pour chaque ligne d'évaluation (Version + boutons) --- */
.evaluation-item {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pousse le label à gauche et les boutons à droite */
    gap: 1rem;
    width: 100%;
}

.item-label {
    font-weight: 600;
    color: #555;
    flex-shrink: 0; /* Empêche le label de se réduire */
}

.item-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap; /* Permet aux boutons de passer à la ligne si besoin */
    justify-content: flex-end; /* Aligne les boutons à droite */
}

/* --- Séparateur fin entre les versions --- */
.item-separator {
    border: 0;
    border-top: 1px solid #e0e5ec;
    margin: 0.75rem 0;
}

/* ==================================================
   MOBILE RESPONSIVE IMPROVEMENTS
   ================================================== */
@media all and (orientation: portrait) {

    /* --- 1. INCREASE BASE FONT SIZE --- */
    /* Increase the base font size for the whole page.
       Using 'rem' units elsewhere will make them scale up accordingly. */
    body,
    html {
        font-size: 18px !important;
    }


    /* --- 2. OPTIMIZE RESOURCE BOXES --- */
    .resource-container {
        flex-direction: column;
        /* Force boxes to stack vertically */
        align-items: center;
        /* Center the stacked boxes */
        gap: 1.5rem;
        /* Reduce space between boxes */
        padding: 1.5rem 1rem;
        /* Adjust padding for mobile */
    }

    .resource-card {
        width: 75%;
        max-width: 90%;
        padding: .5rem;

        /* Ajoute ceci : */
        height: auto;
        /* <-- Empêche la carte de forcer une hauteur */
        flex-grow: 0 !important;
        /* <-- Évite l'extension verticale inutile */
        justify-content: flex-start;
        /* <-- Aligne le contenu en haut */
    }

    .resource-card h4 {
        font-size: 2rem;
        /* Larger heading */
    }

    .resource-card p {
        font-size: 1.5rem;
        /* Larger paragraph text */
    }

    .btn-modern {
        padding: 14px 28px;
        /* Make buttons bigger and easier to tap */
        font-size: 1.5rem;
    }


    /* --- 3. IMPROVE SEQUENCE & CHAPTER READABILITY --- */
    details.containerSequence {
        width: 95%;
        /* Use more of the available screen width */
    }

    .sequence-summary {
        padding: 1rem;
        /* Adjust padding */
    }

    /* Make the sequence title bigger and more prominent */
    .summary-main-title {
        font-size: 2.5rem;
    }

    .summary-chapter-list {
        font-size: 1.8rem;
    }

    .sequence-summary::after {
        font-size: 3.5rem;
        /* Make the +/- icon larger */
        right: 1rem;
    }

    .chapitre-summary {
        font-size: 2rem;
        /* Larger chapter titles */
    }

    /* This was the old responsive block, we'll keep its core logic here */
    .chapitre-content {
        flex-direction: column;
        gap: 1rem;
        font-size: 1.8rem;
        /* Increase font size of content inside chapters */
    }

    .plan,
    .activite,
    .quiz,
    .flashcards,.quizPrerequis {
        width: 100%;
        flex-basis: auto;
        max-width: none;
        margin-left: 0;
    }

    .evaluations {
        width: 100%;
        font-size: 1.8rem;
    }

    .evaluation-item {
        flex-direction: column; /* Empile le label et les boutons verticalement */
        align-items: center;    /* Centre les éléments empilés */
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .item-label {
        margin-bottom: 0.25rem;
    }
    
    .item-buttons {
        justify-content: center; /* Centre les boutons sur mobile */
    }

}

/* ************** Fenêtre modale ************ */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    padding-top: 100px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    position: relative;
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    width: 80%;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    animation-name: animatetop;
    animation-duration: 0.4s;
}

@keyframes animatetop {
    from {
        top: -300px;
        opacity: 0
    }

    to {
        top: 0;
        opacity: 1
    }
}

.close {
    color: white;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.modal-header {
    padding: 2px 16px;
    background-color: #5cb85c;
    color: white;
}

.modal-body {
    padding: 2px 16px;
}

.modal-footer {
    padding: 2px 16px;
    background-color: #5cb85c;
    color: white;
}


/* Custom Podcast Modal (to avoid conflicts) */
.modal-podcast-custom {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}

.modal-podcast-custom .modalPodcast-content {
    background-color: #fefefe;
    margin: 8% auto;
    padding: 0;
    border: none;
    width: 85%;
    max-width: 700px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Modal Header with close button */
.modal-podcast-custom .modalPodcast-content > h2 {
    background: linear-gradient(to right, rgb(72, 108, 148), rgb(166, 202, 243));
    color: white;
    margin: 0;
    padding: 1.5rem 4rem 1.5rem 2rem;
    font-size: 1.8em;
    font-weight: 600;
    position: relative;
}

/* Close button - bigger and on the right */
.modal-podcast-custom .close-btnPodcast {
    position: absolute;
    right: 1rem;
    top: 1rem; /* Anchors it 1rem from the top */
    z-index: 1001; /* Set a slightly higher z-index just in case */
    transform: none; /* No vertical translation needed for top alignment */
    color: rgb(255, 255, 255);
    font-size: 2.5em;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    visibility: visible;
    opacity: 1;
}

.modal-podcast-custom .close-btnPodcast:hover,
.modal-podcast-custom .close-btnPodcast:focus {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Podcast player section */
.modal-podcast-custom .podcast-player {
    padding: 2rem;
    background: white;
}

/* Hide the h3 title since we'll show it in the audio controls */
.modal-podcast-custom .podcast-player h3 {
    display: none;
}

/* Container for title + audio player */
.podcast-player-wrapper {
    background: var(--subtle-bg-color, #eef4fb);
    border: 1px solid var(--subtle-border-color, #dce9f8);
    border-radius: 12px;
    padding: 1rem;
}

.podcast-title-display {
    color: var(--primary-dark-blue);
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    text-align: center;
}

.modal-podcast-custom .podcast-player audio {
    width: 100%;
    border-radius: 8px;
    outline: none;
}

/* Button to open podcast modal */
.btn-podcast-custom {
    width: 100%;
    margin-top: 1rem;
    padding: 14px 24px;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    color: white;
    border: none;
    border-radius: 50px;
    background: linear-gradient(to right, rgb(115, 147, 184), rgb(166, 202, 243));
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.btn-podcast-custom:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.btn-podcast-custom:active {
    transform: translateY(0);
}

/* Add icon before button text */
.btn-podcast-custom::before {
    content: "🎧";
    font-size: 1.3em;
}

/* Mobile responsive */
@media all and (orientation: portrait) {
    .modal-podcast-custom .modalPodcast-content {
        width: 95%;
        margin: 15% auto;
    }
    
    .modal-podcast-custom .modalPodcast-content > h2 {
        font-size: 1.5em;
        padding: 1.25rem 3.5rem 1.25rem 1.5rem;
    }
    
    .modal-podcast-custom .close-btnPodcast {
        font-size: 2em;
        width: 36px;
        height: 36px;
    }
    
    .modal-podcast-custom .podcast-player {
        padding: 1.5rem;
    }
    
    .btn-podcast-custom {
        font-size: 1em;
        padding: 12px 20px;
    }
}