/* ===== Google Font ===== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

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

/* Transitions ciblées (remplace l'ancienne règle « * { transition: all } » qui ralentissait tout le site) */
a, button, input, select, textarea, .btn, nav, footer, body {
    transition: color .15s ease, background-color .2s ease, border-color .15s ease, box-shadow .15s ease;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

/* ===== Variables (clair) ===== */
:root {
    --light: #f6f6f9;
    --primary: #1976D2;
    --light-primary: #CFE8FF;
    --grey: #eee;
    --dark-grey: #AAAAAA;
    --dark: #363949;
    --danger: #D32F2F;
    --light-danger: #FECDD3;
    --warning: #FBC02D;
    --light-warning: #FFF2C6;
    --success: #388E3C;
    --light-success: #BBF7D0;
    --body-color: #E4E9F7;
    --nav-color: #0950BF;
    --side-nav: #010718;
    --text-color: #FFF;
    --search-bar: #F2F2F2;
    --search-text: #010718;
    --page-max: 1200px; /* largeur max des contenus */
    --gutter: 16px; /* padding latéral */
}

/* ===== Thème sombre ===== */
body.dark {
    --body-color: #18191A;
    --nav-color: #242526;
    --side-nav: #242526;
    --text-color: #CCC;
    --search-bar: #242526;
    --light: #181a1e;
    --grey: #25252c;
    --dark: #fbfbfb;
}

/* ===== Body ===== */
body {
    background: var(--body-color);
    color: var(--dark);
}

/* ===== Barre de navigation ===== */
nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 70px;
    width: 100%;
    background-color: var(--nav-color);
    z-index: 100;
}

body.dark nav {
    border: 1px solid #393838;
}

nav .nav-bar {
    position: relative;
    height: 100%;
    max-width: var(--page-max);
    width: 100%;
    background-color: var(--nav-color);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    nav .nav-bar .sidebarOpen {
        color: var(--text-color);
        font-size: 25px;
        padding: 5px;
        cursor: pointer;
        display: none;
    }

    nav .nav-bar .logo a {
        font-size: 25px;
        font-weight: 500;
        color: var(--text-color);
        text-decoration: none;
    }

.menu .logo-toggle {
    display: none;
}

.nav-bar .nav-links {
    display: flex;
    align-items: center;
}

    .nav-bar .nav-links li {
        list-style: none;
        margin: 0 5px;
    }

.nav-links li a {
    position: relative;
    font-size: 17px;
    font-weight: 400;
    color: var(--text-color);
    text-decoration: none;
    padding: 10px;
}

    .nav-links li a::before {
        content: '';
        position: absolute;
        left: 50%;
        bottom: 0;
        transform: translateX(-50%);
        height: 6px;
        width: 6px;
        border-radius: 50%;
        background-color: var(--text-color);
        opacity: 0;
        transition: all 0.3s ease;
    }

/* Mode nuit & recherche */
.nav-bar .darkLight-searchBox {
    display: flex;
    align-items: center;
}

.darkLight-searchBox .dark-light, .darkLight-searchBox .searchToggle {
    height: 40px;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 5px;
}

.dark-light i, .searchToggle i {
    position: absolute;
    color: var(--text-color);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .dark-light i.sun {
        opacity: 0;
        pointer-events: none;
    }

.dark-light.active i.sun {
    opacity: 1;
    pointer-events: auto;
}

.dark-light.active i.moon {
    opacity: 0;
    pointer-events: none;
}

.searchToggle i.cancel {
    opacity: 0;
    pointer-events: none;
}

.searchToggle.active i.cancel {
    opacity: 1;
    pointer-events: auto;
}

.searchToggle.active i.search {
    opacity: 0;
    pointer-events: none;
}

.searchBox {
    position: relative;
}

    .searchBox .search-field {
        position: absolute;
        bottom: -85px;
        right: 5px;
        height: 50px;
        width: 300px;
        display: flex;
        align-items: center;
        background-color: var(--nav-color);
        padding: 3px;
        border-radius: 6px;
        box-shadow: 0 5px 5px rgba(0,0,0,0.1);
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s ease;
    }

.searchToggle.active ~ .search-field {
    bottom: -74px;
    opacity: 1;
    pointer-events: auto;
}

.search-field::before {
    content: '';
    position: absolute;
    right: 14px;
    top: -4px;
    height: 12px;
    width: 12px;
    background-color: var(--nav-color);
    transform: rotate(-45deg);
    z-index: -1;
}

.search-field input {
    height: 100%;
    width: 100%;
    padding: 0 45px 0 15px;
    outline: none;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    color: var(--search-text);
    background-color: var(--search-bar);
}

body.dark .search-field input {
    color: var(--text-color);
}

.search-field i {
    position: absolute;
    right: 15px;
    font-size: 22px;
    color: var(--nav-color);
    cursor: pointer;
}

body.dark .search-field i {
    color: var(--text-color);
}

/* ===== Liens & icônes ===== */
a {
    text-decoration: none;
}

.bx {
    font-size: 1.7rem;
}

/* ===== Sidebar (si tu l’utilises) ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    background: var(--light);
    width: 230px;
    height: 100%;
    z-index: 2000;
    overflow-x: hidden;
    scrollbar-width: none;
    transition: all 0.3s ease;
}

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar.close {
        width: 60px;
    }

/* ===== Contenu principal (centrage !) ===== */
.content {
    position: relative;
    background-color: var(--light);
    color: var(--dark);
}

/* Wrapper visuel de la page épreuve — CENTRÉ */
.boitevisuEp {
    /* override de l'ancien style inline */
    margin: 100px auto 0 !important;
    padding: 0 var(--gutter);
    max-width: var(--page-max);
    width: 100%;
}

/* ===== En-tête & blocs ===== */
.content main {
    width: 100%;
    padding: 36px var(--gutter);
    max-height: calc(100vh - 56px);
}

    .content main .header .left h1 {
        font-size: 36px;
        font-weight: 600;
        margin: 50px 0 10px;
        color: var(--dark);
    }

/* ===== Boutons spécifiques ===== */
.btnCons, .btnDeTraite, .btnCons:disabled, .btnDeTraite:disabled {
    width: 80%;
    border-radius: 10px;
    color: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto;
    font-weight: bold;
}

.btnCons {
    background: #088A61;
    cursor: pointer;
}

.btnDeTraite {
    background: var(--danger);
    cursor: pointer;
}

.btnCons:disabled {
    background: #5eaa92;
    cursor: default;
}

.btnDeTraite:disabled {
    background: #EFB7C5;
    cursor: default;
}

/* ===== Cartes / tableaux (extraits) ===== */
.smallText {
    margin: auto;
    font-size: small;
    color: var(--dark);
}

.textTableauAnnale {
    font-size: medium;
    margin: auto;
    text-align: center;
}

.niveautable {
    font-size: 13px;
    padding: 6px 6px;
    color: var(--light);
    border-radius: 20px;
    font-weight: 700;
    margin: auto;
}

/* ===== Grille page visualisation ===== */
.boiteContenuEpreuveVisu {
    display: grid;
    grid-template-rows: auto auto;
    grid-template-columns: 30% 70%;
    grid-gap: 30px;
    margin: 200px auto 0; /* CENTRÉ */
    padding: 0 var(--gutter);
    max-width: var(--page-max); /* CENTRÉ */
    grid-template-areas:
        "titre titre"
        "utilisateur epreuve";
}

.boiteTitre {
    grid-area: titre;
    color: var(--dark);
    margin: 0 auto;
    width: 100%;
}

.boiteEpreuve {
    grid-area: epreuve;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.boiteInfoUti {
    grid-area: utilisateur;
    display: grid;
    background: var(--light);
    border-radius: 12px;
    text-align: center;
    height: auto;
    grid-template-rows: 60px 40px 40px 40px 40px 40px;
    grid-template-columns: 70% 30%;
    grid-template-areas:
        "NomPrenoms NomPrenoms"
        "etab etab"
        "QCons RCons"
        "QTrat RTrat"
        "boutTrait boutTrait"
        "boutDeTrait boutDeTrait";
}

.boiteNoPren {
    grid-area: NomPrenoms;
    color: var(--dark);
    margin-top: 15px;
}

.boitetab {
    grid-area: etab;
    color: var(--dark);
}

.boiteOuvert {
    grid-area: QCons;
    margin: auto;
    color: var(--dark);
}

.boiteROuvert {
    grid-area: RCons;
    margin: auto;
    color: var(--dark);
}

.boiteTraite {
    grid-area: QTrat;
    margin: auto;
    color: var(--dark);
}

.boiteRTraite {
    grid-area: RTrat;
    margin: auto;
    color: var(--dark);
}

.boiteBtnTraite {
    grid-area: boutTrait;
    width: 100%;
    margin: auto;
    text-align: center;
    color: var(--dark);
}

.boiteBtnDeTraite {
    grid-area: boutDeTrait;
    width: 100%;
    margin: 0 auto 15px;
    text-align: center;
    color: var(--dark);
}

/* ===== Viewer PDF (iframe ratio quand utilisé) ===== */
.ratio {
    min-height: 75vh;
    max-width: 1000px;
    margin-inline: auto;
}

    .ratio > * {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        display: block;
    }

/* ===== PDF.js viewer (canvas) ===== */
#pdfjsViewer {
    height: calc(100dvh - 220px);
    max-height: 100dvh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 8px;
}

@media (min-width: 992px) {
    #pdfjsViewer {
        height: 75vh;
    }
}

/* ===== Modale corrigé ===== */
.modal .ratio {
    max-width: 1100px;
    margin-inline: auto;
}

@media (max-width: 790px) {
    .modal .ratio {
        --bs-aspect-ratio: 0 !important;
        height: min(85dvh, 700px) !important;
    }
}

/* ===== Utilitaires ===== */
.vertical-line {
    border-left: 2px solid #04070c;
    height: 300px;
    margin: auto;
    display: inline-block;
}

.thumbnail img {
    width: 100%;
}

footer {
    margin: 50px 0;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    nav .nav-bar .sidebarOpen {
        display: block;
    }

    .menu {
        position: fixed;
        height: 100%;
        width: 320px;
        left: -100%;
        top: 0;
        padding: 20px;
        background-color: var(--side-nav);
        z-index: 100;
        transition: all 0.4s ease;
    }

    nav.active .menu {
        left: 0;
    }

    nav.active .nav-bar .navLogo a {
        opacity: 0;
        transition: all 0.3s ease;
    }

    .menu .logo-toggle {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .logo-toggle .siderbarClose {
        color: var(--text-color);
        font-size: 24px;
        cursor: pointer;
    }

    .nav-bar .nav-links {
        flex-direction: column;
        padding-top: 30px;
    }

    .nav-links li a {
        display: block;
        margin-top: 20px;
    }

    /* Form nav compact */
    .content nav form .form-input input {
        display: none;
    }

    .content nav form .form-input button {
        width: auto;
        height: auto;
        background: transparent;
        color: var(--dark);
        border-radius: 0;
    }

    .content nav form.show .form-input input {
        display: block;
        width: 100%;
    }

    .content nav form.show .form-input button {
        width: 36px;
        height: 100%;
        color: var(--light);
        background: var(--danger);
        border-radius: 0 36px 36px 0;
    }

    /* Grille page épreuve en colonne (centrée) */
    .boiteContenuEpreuveVisu {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        grid-gap: 15px;
        margin: 140px auto 0;
        max-width: var(--page-max);
        grid-template-areas:
            "titre"
            "epreuve"
            "utilisateur"
            "fin";
    }

    .boiteInfoUti {
        width: 90%;
        margin: 0 auto;
    }

    .boiteEpreuve {
        width: 100%;
        margin: 0 auto;
    }

    /* Iframe ratio (si utilisé) full-height mobile */
    :root {
        --viewer-offset: 140px;
    }

    .ratio {
        --bs-aspect-ratio: 0 !important;
        height: calc(100dvh - var(--viewer-offset)) !important;
        min-height: calc(100dvh - var(--viewer-offset)) !important;
        max-height: 100dvh !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 auto !important;
    }

        .ratio > * {
            width: 100% !important;
            height: 100% !important;
        }
}

@media (orientation: landscape) and (max-width: 990px) {
    .ratio {
        --bs-aspect-ratio: 0 !important;
        height: calc(100dvh - 100px) !important;
        min-height: calc(100dvh - 100px) !important;
    }
}
