/*
 ██████╗███████╗███████╗
██╔════╝██╔════╝██╔════╝
██║     ███████╗███████╗
██║     ╚════██║╚════██║
╚██████╗███████║███████║
 ╚═════╝╚══════╝╚══════╝
*/

/* --- VARIABLES ET CONFIGURATION GLOBALE --- */
:root {
    /* Typographie */
    --font-serif: "Old Standard TT", serif;
    --font-display: 'Instrument Serif', serif;
    --font-mono: 'Consolas', 'Source Code Pro', Arial, Helvetica, sans-serif;
    --font-sans: 'Marianne', 'Source Code Pro', Arial, Helvetica, sans-serif;

    /* Palette de couleurs */
    --color-bg: #ffffff;
    --color-text: rgb(31, 31, 31);
    --color-primary: #0033B8;
    --color-link: #0056b3;
    --color-link-hover: #003d82;
    --color-border: #ddd;
    --color-tooltip: rgba(0, 0, 0, 0.94);
    --color-sub-text: rgb(187, 187, 187);
    --bg-hover: rgba(232, 238, 238, 0.4);

    /* Couleurs des matières */
    --mat-francais: #d1e1f0;
    --mat-maths: #f6d8d9;
    --mat-sport: #fff9c4;
    --mat-art: #fbe5d6;
    --mat-geo: #d8e5cc;
    --mat-autre: #f2f2f2;
    --mat-tech: #F5ADC3;
    --mat-phy: #FBB09B;

    /* Couleurs des tableaux */
    --primary-dark: #2c3e50;
    --secondary-dark: #34495e;
    --accent-gold: #c5a059; /* Un or terne et sobre */
    --light-bg: #fdfbf7;
    --text-main: #2c3e50;
    --border-color: #e0e0e0;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center; /* Attention sur mobile si le contenu dépasse la hauteur */
    min-height: 100vh;
    background-color: var(--color-bg);
    color: var(--color-text);
}

/* --- POLICES --- */
@font-face {
    font-family: "Marianne";
    src: url("../fonts/Marianne.woff2") format("woff2"),
         url("../fonts/Marianne.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Optimisation du chargement */
}

@font-face {
    font-family: "Consolas";
    src: url("../fonts/Consolas.woff2") format("woff2"),
         url("../fonts/Consolas.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Classes utilitaires de police */
.old-standard-tt-regular { font-family: var(--font-serif); font-weight: 400; font-style: normal; }
.old-standard-tt-bold { font-family: var(--font-serif); font-weight: 700; font-style: normal; }
.old-standard-tt-regular-italic { font-family: var(--font-serif); font-weight: 400; font-style: italic; }

.exemple_police {
    font-family: var(--font-serif);
    font-size: 20px;
    text-align: center;
    background-image: linear-gradient(to top right, #2D3748, #252d39);
    background-color: #2D3748;
    color: white;
}

/* --- STRUCTURE PRINCIPALE --- */
.container {
    font-family: var(--font-mono);
    max-width: 750px;
    width: 100%;
    background: var(--color-bg);
    padding: 40px;
    text-align: center;
}

h1, h4 {
    font-family: var(--font-display);
    letter-spacing: 2.5px;
}

h1 { font-size: 70px; margin-bottom: 100px; }
h4 { font-size: 20px; margin-block: 30px; text-transform: uppercase; }

h5 {
    font-family: var(--font-mono);
    font-size: 17px;
    text-align: center;
}

h6 {
    font-family: var(--font-mono);
    font-size: 18px;
    margin-bottom: 5px;
}

strong { color: var(--color-primary); }

li {
    margin-top: 15px;
    margin-left: -45px;
    list-style-type: none;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(233, 233, 233, 0.19);
    padding: 20px;
    border-radius: 10px;
}

p {
    text-indent: 2em; /* ou 30px, 5%, etc. */
}

ol.d { list-style-type: upper-roman; }

/* --- ACCORDÉON --- */
.accordion {
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    background: var(--color-bg);
    cursor: pointer;
    padding: 24px 20px;
    font-size: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease-in-out, transform 0.2s;
    gap: 50px;
    margin-top: 5px;
    border-radius: 3px;
}

.accordion:hover { background: var(--bg-hover); }

/* Styles partagés pour les sous-niveaux */
.accordion.sub, .accordion.subsub {
    font-family: var(--font-display);
    letter-spacing: 2.5px;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--color-sub-text);
    transition: ease-in-out .2s;
}

.accordion.sub { font-size: 20px; }
.accordion.subsub { font-size: 18px; margin-bottom: 0px; padding-bottom: 10px; }

.accordion.sub:hover, .accordion.subsub:hover {
    background: none;
    color: var(--color-text);
}

.accordion.sub.active, .accordion.subsub.active {
    color: var(--color-text);
}

.arrow {
    width: 10px;
    height: 10px;
    border-right: 2px solid #333;
    border-bottom: 2px solid #333;
    border-radius: 1px;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    display: inline-block;
}

.accordion.active .arrow {
    transform: rotate(-135deg);
}

.panel {
    display: none;
    text-align: justify;
    padding: 20px 10px;
    font-size: 18px;
    line-height: 1.5em;
    font-family: var(--font-mono);
}

/* --- TOOLTIP (INFOBULLE) --- */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 1.5px;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    background-color: var(--color-tooltip);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    font-style: normal;
}

.tooltip-text {
    visibility: hidden;
    width: 320px;
    background-color: var(--color-tooltip);
    color: #e9e9e9;
    text-align: center;
    font-size: 14px;
    padding: 12px;
    border-radius: 6px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
    transform-origin: bottom center;
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--color-tooltip) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* --- TABLEAUX --- */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    border: 1px solid var(--color-border);
    padding: 12px;
    text-align: center;
}

th {
    background-color: #003d82;
    color: white;
    text-transform: uppercase;
}

tr:nth-child(even) { background-color: var(--mat-autre); }

/* Matières */
.francais { background-color: var(--mat-francais); }
.maths { background-color: var(--mat-maths); }
.sport { background-color: var(--mat-sport); }
.art { background-color: var(--mat-art); }
.geo { background-color: var(--mat-geo); }
.autre { background-color: var(--mat-autre); }
.tech { background-color: var(--mat-tech); }
.phy { background-color: var(--mat-phy); }
.rien { background-color: var(--color-bg); }

/* Cellules complexes */
.split-cell { padding: 0; }
.top-part, .bottom-part { padding: 11px; height: 50%; }

.horaires { font-weight: bold; }
.pause { font-style: italic; background-color: #ffffff; height: 60px; }
#col-num { width: 40px; }
#col-horaire { width: 120px; }
.jour { min-width: 150px; }


/* --- FOOTER --- */
.footer {
    display: block;
    justify-content: center;
    align-items: center;
    font-size: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: rgb(168, 165, 165);
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    margin-top: 40px;
    width: 100%;
    margin-inline: auto;
    font-family: var(--font-mono);
    letter-spacing: 1px;
}

.footer a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
    cursor: pointer;
}

.footer a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

.autre_footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    width: 100%;
}

/* --- BOUTON RETOUR HAUT --- */
#scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--color-link-hover);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none; /* JS gère l'affichage normalement, ou .show */
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease-in-out;
    z-index: 1000;
}

#scroll-top-btn:hover {
    background-color: var(--color-link);
    transform: translateY(-5px);
}

#scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    display: flex; /* Nécessaire pour écraser le display:none par défaut */
}

/* --- UTILITAIRES DIVERS --- */
.rond { border-radius: 20px; }
.maj { margin-bottom: 15px; }

/* Note: Ces classes sont masquées mais ont une transformation définie.
   La transformation ne s'appliquera que si le display passe en block/flex via JS. */
.crucial, .important {
    display: none;
    transform: translateY(4px);
}

/* --- RESPONSIVE --- */
@media (max-width: 800px) {
    .accordion { font-size: 22px; }
    .panel { text-align: left; }
    .cacher-mobile { display: none; }
    .scroll-top { display: none; }
    
    .footer {
        flex-direction: column;
        text-align: center;
    }
    .footer img { margin: auto; }
    .footer p, .footer a { margin: 5px 0; }
    
    th, td {
        font-size: 14px;
        padding: 8px;
    }
}