/* =========================
   SIMULATION CATALOGUE
========================= */

.catalogue-simulations {
    background-color: var(--fond-clair);
}

.catalogue-simulations > .container {
    max-width: 1200px;
}

.catalogue-simulations h2 {
    margin-bottom: 25px;
}

.selecteur-simulation {
    display: flex;
    align-items: end;
    gap: 18px;

    width: 100%;
    max-width: 900px;
    padding: 30px;

    background-color: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 10px;
    box-shadow: 0 12px 35px rgba(23, 34, 49, 0.06);
}

.champ-simulation {
    flex: 1;
}

.champ-simulation label {
    display: block;
    margin-bottom: 10px;

    color: var(--bleu-fonce);
    font-size: 0.78rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.champ-simulation select {
    width: 100%;
    min-height: 52px;
    padding: 0 45px 0 16px;

    color: var(--texte);
    background-color: var(--fond-clair);
    border: 1px solid var(--bordure);
    border-radius: 6px;
    cursor: pointer;

    font: inherit;
}

.champ-simulation select:focus {
    border-color: var(--orange);
    outline: 3px solid rgba(239, 107, 58, 0.18);
}

.bouton-ouvrir-simulation {
    min-height: 52px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.bouton-ouvrir-simulation:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    transform: none;
}

.etat-python {
    display: flex;
    gap: 12px;
    align-items: center;
    width: fit-content;
    margin-top: 35px;
    padding: 12px 16px;

    color: #415267;
    background-color: #edf1f5;
    border-radius: 5px;

    font-size: 0.8rem;
}

.indicateur-etat {
    width: 9px;
    height: 9px;
    background-color: #d99a27;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(217, 154, 39, 0.15);
}

.etat-python[data-state="ready"] .indicateur-etat {
    background-color: #2b9b67;
    box-shadow: 0 0 0 4px rgba(43, 155, 103, 0.15);
}

.etat-python[data-state="error"] .indicateur-etat {
    background-color: #c7483e;
    box-shadow: 0 0 0 4px rgba(199, 72, 62, 0.15);
}


/* =========================
   INTERACTIVE LABORATORY
========================= */

.laboratoire-simulation {
    scroll-margin-top: 95px;
    background-color: var(--fond);
}

.fond-simulation-alternatif {
    background-color: var(--fond-clair);
}

.entete-simulation {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 70px;
    align-items: end;
    margin-bottom: 45px;
}

.entete-simulation p:last-child {
    margin-bottom: 7px;
    color: var(--texte-secondaire);
    line-height: 1.8;
}

.entete-simulation code {
    padding: 2px 6px;
    color: #bd4c25;
    background-color: #ece7dc;
    border-radius: 3px;
}

.espace-simulation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    overflow: hidden;

    background-color: #ffffff;
    border: 1px solid var(--bordure);
    border-radius: 10px;
    box-shadow: 0 20px 55px rgba(23, 34, 49, 0.1);
}

.panneau-code,
.panneau-resultat {
    min-width: 0;
}

.panneau-code {
    display: flex;
    flex-direction: column;
    background-color: #091827;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.panneau-resultat {
    display: flex;
    flex-direction: column;
    background-color: #f7f9fb;
}

.barre-panneau {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    min-height: 52px;
    padding: 12px 18px;

    color: #9facb9;
    background-color: #06101c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);

    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.panneau-resultat .barre-panneau {
    color: #526275;
    background-color: #e9edf2;
    border-bottom-color: #d9e0e8;
}

.nom-fichier {
    color: var(--orange);
    text-transform: none;
}

.editeur-python {
    width: 100%;
    min-height: 720px;
    padding: 24px;
    resize: vertical;

    color: #dce6ef;
    background-color: #091827;
    border: none;
    outline: none;

    font-family: "Courier New", Courier, monospace;
    font-size: 0.82rem;
    line-height: 1.65;
    tab-size: 4;
}

.editeur-python:focus {
    box-shadow: inset 0 0 0 2px var(--orange);
}

.actions-simulation {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px;

    background-color: #06101c;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.bouton-execution,
.bouton-reinitialiser {
    padding: 12px 17px;
    cursor: pointer;
}

.bouton-execution:disabled {
    cursor: wait;
    opacity: 0.55;
    transform: none;
}

.bouton-reinitialiser {
    color: #d7e0e8;
    background-color: transparent;
    border: 1px solid #526273;
}

.bouton-reinitialiser:hover {
    background-color: #142d45;
}

.zone-graphique {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 1;
    min-height: 560px;

    padding: 20px;

    background-color: #ffffff;
}

.graphique-attente {
    max-width: 290px;

    color: #8290a0;

    font-size: 0.85rem;
    line-height: 1.7;
    text-align: center;
}

.image-resultat {
    display: block;

    width: 100%;
    height: 100%;
    max-height: 540px;

    object-fit: contain;
}

.image-resultat[hidden],
.graphique-attente[hidden] {
    display: none;
}

.console-simulation {
    min-height: 160px;
    padding: 18px;

    color: #dce6ef;
    background-color: #091827;
}

.console-simulation p {
    margin-bottom: 10px;

    color: var(--orange);

    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.console-simulation pre {
    max-height: 230px;
    margin: 0;
    overflow: auto;

    white-space: pre-wrap;
    overflow-wrap: anywhere;

    color: #c7d2dc;

    font-family: "Courier New", Courier, monospace;
    font-size: 0.78rem;
    line-height: 1.6;
}

.sr-only {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;
}


/* =========================
   LOADED SIMULATION
========================= */

.zone-simulation-chargee {
    margin-top: 50px;
    scroll-margin-top: 95px;
}

.simulation-placeholder {
    margin: 0;
    padding: 45px 25px;

    color: var(--texte-secondaire);
    background-color: #ffffff;

    border: 1px dashed var(--bordure);
    border-radius: 10px;

    text-align: center;
}

.zone-simulation-chargee .laboratoire-simulation {
    padding: 0;
    background-color: transparent;
}

.zone-simulation-chargee
.laboratoire-simulation > .container {
    width: 100%;
    max-width: none;
    padding: 0;
}

.zone-simulation-chargee
.laboratoire-simulation[hidden],
.simulation-placeholder[hidden] {
    display: none;
}


/* =========================
   PYTHON PREREQUISITES
========================= */

.prerequis-python {
    padding-top: 40px;
    padding-bottom: 40px;

    background-color: var(--fond-clair);
}


/* =========================
   COLLAPSIBLE TAB
========================= */

.onglet-python {
    overflow: hidden;

    color: white;

    background:
        radial-gradient(
            circle at 90% 15%,
            rgba(70, 125, 210, 0.3),
            transparent 35%
        ),
        linear-gradient(
            135deg,
            #071524,
            var(--bleu-fonce)
        );

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;

    box-shadow: 0 18px 45px rgba(11, 31, 58, 0.18);
}


/* =========================
   CLICKABLE HEADER
========================= */

.resume-python {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 14px 22px;

    cursor: pointer;
    list-style: none;

    transition: background-color 0.2s ease;
}

.resume-python::-webkit-details-marker {
    display: none;
}

.resume-python:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

.resume-python:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: -3px;
}

.resume-python h2 {
    margin: 3px 0;

    color: white;

    font-family: "Open Sans", Arial, sans-serif;
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    line-height: 1.2;
}

.resume-python .surtitre {
    margin: 0;

    font-size: 0.65rem;
}

.resume-python p:last-child {
    margin: 2px 0 0;

    color: rgba(255, 255, 255, 0.68);

    font-size: 0.82rem;
}

.surtitre-python {
    margin: 0;

    color: #8dccff;
}

.icone-onglet-python {
    display: grid;
    place-items: center;

    flex-shrink: 0;

    width: 48px;
    height: 48px;

    color: var(--orange);

    border: 2px solid var(--orange);
    border-radius: 50%;

    font-size: 2rem;
    font-weight: 300;
    line-height: 1;

    transition:
        transform 0.3s ease,
        color 0.3s ease,
        background-color 0.3s ease;
}

.onglet-python[open] .icone-onglet-python {
    color: white;
    background-color: var(--orange);

    transform: rotate(45deg);
}


/* =========================
   OPEN CONTENT
========================= */

.contenu-onglet-python {
    padding: 35px 32px 32px;

    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.entete-prerequis-python {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    align-items: start;

    gap: 60px;

    margin-bottom: 35px;
}

.entete-prerequis-python h3 {
    margin: 0;

    color: white;

    font-size: clamp(1.5rem, 3vw, 2.2rem);
    line-height: 1.2;
}

.entete-prerequis-python p {
    margin: 0;

    color: rgba(255, 255, 255, 0.75);

    line-height: 1.8;
}


/* =========================
   INFORMATION NOTE
========================= */

.note-python {
    margin-bottom: 30px;
    padding: 22px 25px;

    background-color: rgba(255, 255, 255, 0.08);

    border-left: 4px solid var(--orange);
}

.note-python strong {
    color: white;
}

.note-python p {
    margin: 7px 0 0;

    color: rgba(255, 255, 255, 0.72);
}


/* =========================
   OFFICIAL RESOURCES
========================= */

.liste-ressources-python {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.ressource-python {
    display: grid;
    grid-template-columns: 45px 1fr;

    gap: 20px;

    padding: 28px;

    border-right: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.ressource-python:hover {
    background-color: rgba(255, 255, 255, 0.08);

    transform: translateY(-3px);
}

.ressource-python > span {
    color: var(--orange);

    font-size: 0.75rem;
    font-weight: bold;
}

.ressource-python h3 {
    margin-bottom: 10px;

    color: white;

    font-size: 1.15rem;
}

.ressource-python p {
    color: rgba(255, 255, 255, 0.7);

    line-height: 1.7;
}

.ressource-python strong {
    color: var(--orange);

    font-size: 0.78rem;
}


/* =========================
   AVAILABLE PYTHON FUNCTIONS
========================= */

.onglet-fonctions {
    margin-top: 18px;

    overflow: hidden;

    background: #ffffff;

    border: 1px solid rgba(9, 24, 39, 0.10);
    border-radius: 14px;

    box-shadow:
        0 10px 28px rgba(9, 24, 39, 0.05);
}


/* ---------- Summary ---------- */

.resume-fonctions {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 18px 22px;

    cursor: pointer;
    list-style: none;

    transition:
        background-color 0.2s ease;
}

.resume-fonctions::-webkit-details-marker {
    display: none;
}

.resume-fonctions::marker {
    display: none;
    content: "";
}

.resume-fonctions:hover {
    background: rgba(9, 24, 39, 0.025);
}


/* ---------- Title block ---------- */

.resume-fonctions > div {
    display: flex;
    align-items: center;

    gap: 14px;
}

.surtitre-fonctions {
    margin: 0;

    color: var(--orange);

    font-size: 0.64rem;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.resume-fonctions h3 {
    margin: 0;

    color: #091827;

    font-size: 1rem;
    font-weight: 650;
}


/* ---------- Plus ---------- */

.icone-onglet-fonctions {
    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 34px;
    height: 34px;

    color: var(--orange);

    background: rgba(239, 107, 58, 0.06);

    border: 1px solid rgba(239, 107, 58, 0.25);
    border-radius: 50%;

    font-size: 1.35rem;
    line-height: 1;

    transition:
        transform 0.25s ease,
        background-color 0.25s ease,
        border-color 0.25s ease;
}

.resume-fonctions:hover .icone-onglet-fonctions {
    background: rgba(239, 107, 58, 0.12);

    border-color: rgba(239, 107, 58, 0.4);
}

.onglet-fonctions[open] .icone-onglet-fonctions {
    transform: rotate(45deg);
}


/* ---------- Open content ---------- */

.contenu-fonctions {
    padding: 22px;

    background:
        linear-gradient(
            180deg,
            rgba(9, 24, 39, 0.018),
            rgba(9, 24, 39, 0)
        );

    border-top: 1px solid rgba(9, 24, 39, 0.08);
}


/* ---------- Intro ---------- */

.intro-fonctions {
    max-width: 760px;

    margin: 0 0 18px;

    color: rgba(9, 24, 39, 0.68);

    font-size: 0.88rem;
    line-height: 1.6;
}


/* ---------- Grid ---------- */

.liste-fonctions {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 12px;
}


/* ---------- Function cards ---------- */

.fonction-python {
    padding: 16px 18px;

    background: #ffffff;

    border: 1px solid rgba(9, 24, 39, 0.08);
    border-radius: 10px;

    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.fonction-python:hover {
    transform: translateY(-2px);

    border-color: rgba(239, 107, 58, 0.25);

    box-shadow:
        0 8px 20px rgba(9, 24, 39, 0.06);
}

.fonction-python code {
    display: block;

    width: 100%;

    margin-bottom: 8px;

    color: var(--orange);

    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.5;

    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fonction-python p {
    margin: 0;

    color: rgba(9, 24, 39, 0.65);

    font-size: 0.8rem;
    line-height: 1.5;
}


/* ---------- Import example ---------- */

.exemple-import-fonctions {
    display: flex;
    align-items: center;

    gap: 14px;

    margin-top: 18px;
    padding: 14px 16px;

    color: white;
    background: #091827;

    border-radius: 10px;
}

.exemple-import-fonctions strong {
    flex-shrink: 0;

    margin: 0;

    color: rgba(255, 255, 255, 0.55);

    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.exemple-import-fonctions code {
    min-width: 0;

    color: white;

    font-size: 0.8rem;
    line-height: 1.5;

    white-space: normal;
    overflow-wrap: anywhere;
}


/* =========================
   RESPONSIVE DESIGN
========================= */

@media (max-width: 1050px) {

    .liste-fonctions {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 980px) {

    .espace-simulation {
        grid-template-columns: 1fr;
    }

    .panneau-code {
        border-right: none;
        border-bottom: 1px solid var(--bordure);
    }

    .editeur-python {
        min-height: 600px;
    }

}


@media (max-width: 800px) {

    .liste-fonctions {
        grid-template-columns: 1fr;
    }

    .resume-fonctions > div {
        align-items: flex-start;
        flex-direction: column;

        gap: 4px;
    }

    .exemple-import-fonctions {
        align-items: flex-start;
        flex-direction: column;

        gap: 8px;
    }

}


@media (max-width: 760px) {

    .entete-simulation {
        grid-template-columns: 1fr;

        gap: 25px;
    }

    .selecteur-simulation {
        align-items: stretch;
        flex-direction: column;

        padding: 22px;
    }

    .bouton-ouvrir-simulation {
        width: 100%;

        justify-content: center;
    }

    .editeur-python {
        min-height: 480px;

        padding: 18px;

        font-size: 0.75rem;
    }

    .zone-graphique {
        min-height: 370px;

        padding: 12px;
    }


    /* Python prerequisites */

    .resume-python {
        align-items: flex-start;

        padding: 24px 20px;
    }

    .icone-onglet-python {
        width: 42px;
        height: 42px;

        font-size: 1.7rem;
    }

    .contenu-onglet-python {
        padding: 28px 20px 22px;
    }

    .entete-prerequis-python {
        grid-template-columns: 1fr;

        gap: 18px;
    }

    .liste-ressources-python {
        grid-template-columns: 1fr;
    }

    .ressource-python {
        grid-template-columns: 35px 1fr;

        padding: 24px 20px;
    }

}