/* =============================================================================
   GED — Charte « Atelier » (piste 3 bis, 7 novembre 2026)

   Canevas des pistes : https://claude.ai/artifact/6dpPposxuDf25pKV7fn7er
   Audit qui la motive : Docs/AUDIT_UI_UX.md

   Chargée par base.html APRÈS les feuilles des pages, comme charte.css dans
   FO Mars : elle donne le même aspect partout aux éléments que chaque page
   avait dessinés à sa façon. Les jetons reprennent les NOMS de FO Mars
   (--fo-rouge, --encre, --trait…) : les deux outils parlent la même langue.
   La structure, elle, est propre à la GED : une barre de navigation verticale
   en encre, et des volets.
   ============================================================================= */

:root {
    /* Jetons FO (les mêmes noms que FO Mars, static/css/charte.css) */
    --fo-rouge: #e30613;
    --rouge-texte: #c62828;
    --rouge-bouton: #d32f2f;
    --rouge-bouton-survol: #b71c1c;
    --rouge-conf: #c8102e;
    --encre: #1c1c1c;
    --texte: #333333;
    --texte-doux: #575757;
    --texte-desactive: #6c757d;
    --trait: #e2e2e2;
    --trait-champ: #949494;
    --trait-fort: #1c1c1c;
    --fond-page: #fcfcfc;
    --fond-volet: #fafafa;
    --surface: #ffffff;
    --surface-douce: #f2f2f2;
    --fond-ligne-fo: #fff4f4;
    --surligne: #fff1a8;
    --fond-apercu: #fbe7e7;        /* le document que l'aperçu montre (20/11/2026) */
    --alerte-fond: #fff3cd;
    --alerte-texte: #6b4f00;
    --ombre-panneau: 0 10px 30px rgba(0, 0, 0, 0.12);
    --largeur-rail: 88px;
    /* Le fond de la barre de navigation et des bandeaux (17/11/2026) : un
       gris ardoise plutôt que l'encre. Des utilisateurs trouvaient le noir
       trop lourd. Le texte clair y garde un contraste de 5,6:1 (#d4d4d4) et
       de 8:1 (blanc). L'encre reste la couleur du texte et des bordures. */
    --fond-rail: #4a4f55;

    /* Les variables historiques de la GED, ramenées aux jetons : toutes les
       pages changent d'un coup, sans réécrire leurs feuilles. */
    --color-primary: #c62828;
    --color-primary-dark: #8c0a1c;
    --color-primary-light: #e30613;
    --color-text: #333333;
    --color-text-light: #575757;
    --color-bg: #fcfcfc;
    --color-white: #ffffff;
    --color-border: #e2e2e2;
    --color-border-light: #ececec;
    --color-hover: #f2f2f2;
    --radius: 4px;
    --radius-lg: 4px;
    --shadow-sm: none;
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.12);
}

body.atelier {
    font-family: Poppins, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--texte);
    background: var(--fond-page);
}

/* Les champs et boutons prennent la police de la page (sans quoi le
   navigateur leur donne la sienne). */
.atelier button,
.atelier input,
.atelier select,
.atelier textarea {
    font-family: inherit;
}

.atelier :focus-visible {
    outline: 2px solid var(--rouge-conf);
    outline-offset: 2px;
}

/* --- La coque : barre de navigation + contenu ------------------------------ */

body.atelier-avec-rail {
    padding-left: var(--largeur-rail);
}

.coque-contenu {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.coque-contenu .main-content {
    flex: 1 0 auto;
}

/* La recherche occupe toute la largeur : ses volets font leur propre mise
   en page (atelier-recherche.css). */
.main-content.main-plein {
    max-width: none;
    padding: 0;
}

.rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    width: var(--largeur-rail);
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 0 14px;
    background: var(--fond-rail);
    color: #ffffff;
}

.rail-marque {
    display: block;
    margin: 0 auto 12px;
}

.rail-marque img {
    display: block;
    width: 60px;
    height: auto;
}

.rail-lien {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border-left: 4px solid transparent;
    color: #d4d4d4;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
}

.rail-lien::-webkit-details-marker {
    display: none;
}

.rail-lien svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rail-lien:hover,
.rail-lien:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.rail-lien.actif {
    color: #ffffff;
    font-weight: 700;
    border-left-color: var(--fo-rouge);
    background: rgba(255, 255, 255, 0.08);
}

/* Importer : la seule action de la barre, en rouge. */
.rail-lien.rail-importer {
    margin: 6px 14px;
    padding: 8px 2px;
    border-left: 0;
    border-radius: var(--radius);
    background: var(--rouge-bouton);
    color: #ffffff;
    font-weight: 700;
}

.rail-lien.rail-importer:hover {
    background: var(--rouge-bouton-survol);
}

.rail-separateur {
    display: block;
    height: 1px;
    margin: 8px 16px;
    background: #444444;
}

/* Le compte du panier, sous son libellé */
.rail .panier-compte {
    display: inline-block;
    min-width: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ffffff;
    color: var(--encre);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 18px;
}

.rail .panier-compte[hidden] {
    display: none;
}

/* « Administrer » : un volet à côté de la barre */
.rail-groupe {
    position: relative;
}

.rail-volet {
    position: absolute;
    left: calc(100% + 6px);
    top: 0;
    z-index: 210;
    width: 250px;
    padding: 6px 0 8px;
    background: var(--surface);
    border-top: 4px solid var(--fo-rouge);
    box-shadow: var(--ombre-panneau);
}

/* Le pont invisible entre la barre et le volet : la souris qui traverse
   l'écart de 6px reste « sur » Administrer, le volet ne se replie pas. */
.rail-volet::before {
    content: "";
    position: absolute;
    top: -4px;
    bottom: 0;
    left: -6px;
    width: 6px;
}

.rail-volet-titre {
    margin: 6px 16px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--texte-doux);
}

.rail-volet-lien {
    display: block;
    padding: 8px 16px;
    color: var(--encre);
    font-size: 14px;
    text-decoration: none;
}

.rail-volet-lien:hover,
.rail-volet-lien:focus-visible {
    background: var(--surface-douce);
}

/* Le bas de la barre : la cloche, puis le compte */
.rail-bas {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
}

.rail .notif-block {
    position: relative;
    margin: 0;
}

.rail .notif-trigger {
    width: 44px;
    height: 44px;
    justify-content: center;
    border-radius: var(--radius);
}

.rail .notif-cloche {
    fill: #d4d4d4;
}

.rail .notif-compte {
    background: var(--fo-rouge);
    color: #ffffff;
}

.rail .notif-menu {
    top: auto;
    right: auto;
    bottom: 0;
    left: calc(100% + 10px);
}

.rail .user-block {
    position: relative;
}

.rail .user-trigger {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.rail .avatar-circle {
    width: 40px;
    height: 40px;
    background: #ffffff;
    color: var(--encre);
    font-weight: 700;
    font-size: 12px;
}

.rail .user-dropdown-menu {
    top: auto;
    right: auto;
    bottom: 0;
    left: calc(100% + 10px);
    min-width: 240px;
    color: var(--encre);
}

.user-dropdown-nom {
    display: block;
    padding: 0.6rem 1rem 0;
    font-weight: 700;
    color: var(--encre);
}

.user-dropdown-sous-titre {
    display: block;
    padding: 0.4rem 1rem 0.2rem;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--texte-doux);
}

.user-dropdown-voir-comme .user-dropdown-item,
.user-dropdown-deconnexion .user-dropdown-item {
    display: block;
    width: 100%;
    border: 0;
    background: none;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
}

/* Bandeau des comptes pas encore habilités */
.bandeau-simple {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: var(--fond-rail);
}

.bandeau-simple img {
    height: 28px;
}

.bandeau-simple-lien {
    color: #ffffff;
}

/* Se déconnecter : un formulaire (POST), qui ne doit rien changer à la mise
   en page ; dans le bandeau, son bouton garde l'allure d'un lien. */
.form-deconnexion {
    margin: 0;
}

button.bandeau-simple-lien {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Le bandeau du téléphone, caché sur ordinateur */
.bandeau-mobile {
    display: none;
}

/* Écran peu haut : la barre se resserre plutôt que de déborder */
@media (max-height: 760px) and (min-width: 769px) {
    .rail-lien {
        padding: 5px 4px;
        gap: 1px;
    }

    .rail-lien svg {
        width: 20px;
        height: 20px;
    }

    .rail-marque {
        margin-bottom: 6px;
    }

    .rail-separateur {
        margin: 4px 16px;
    }
}

/* Téléphone : un bandeau gris, la navigation se déplie par-dessus */
@media (max-width: 768px) {
    body.atelier-avec-rail {
        padding-left: 0;
    }

    .bandeau-mobile {
        position: sticky;
        top: 0;
        z-index: 190;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 56px;
        padding: 0 8px 0 16px;
        background: var(--fond-rail);
    }

    .bandeau-mobile-marque img {
        display: block;
        height: 26px;
    }

    .bandeau-mobile .nav-bascule {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        background: none;
        color: #ffffff;
    }

    .bandeau-mobile .nav-bascule svg {
        width: 24px;
        height: 24px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.2;
        stroke-linecap: round;
    }

    .rail {
        width: 270px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        overflow-y: auto;
        box-shadow: none;
    }

    .rail.ouvert {
        transform: none;
        box-shadow: 0 0 0 100vmax rgba(28, 28, 28, 0.55);
    }

    .rail-lien {
        flex-direction: row;
        gap: 14px;
        padding: 12px 18px;
        font-size: 15px;
        text-align: left;
    }

    .rail-lien.rail-importer {
        margin: 6px 16px;
        padding: 12px 16px;
    }

    .rail-volet {
        position: static;
        width: auto;
        border-top: 0;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
    }

    .rail-volet::before {
        display: none;
    }

    .rail-volet-titre {
        display: none;
    }

    .rail-volet-lien {
        padding: 10px 18px 10px 54px;
        color: #d4d4d4;
    }

    .rail-bas {
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 18px;
    }

    .rail .notif-menu,
    .rail .user-dropdown-menu {
        left: 0;
        bottom: calc(100% + 8px);
    }
}

/* --- Boutons : un seul bouton principal, rouge ; les autres bordés d'encre --
   (audit U4 : le vert et le bleu, texte blanc dessus, n'étaient pas lisibles :
   3,1:1 et 4,0:1). */

/* LA FORME, ICI ET NON PLUS DANS search.css (27/11/2026) : la charte ne
   donnait que la couleur, et une page qui ne chargeait pas search.css — Droits
   par profil, la fiche, Mon travail, les pages de compte — montrait des
   boutons sans hauteur ni marge, au gris du navigateur. Quatre rôles, comme
   dans Mars (charte.css) : principal rouge plein, secondaire blanc bordé
   d'encre, simple blanc au trait fin, suppression rouge sur blanc. */
.atelier :is(.btn-filter, .btn-primary, .btn-secondary, .btn-danger) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.atelier .btn-filter:not(.btn-filter-primary):not(.btn-filter-reset) {
    background: #ffffff;
    border: 1px solid var(--trait-champ);
    color: var(--encre);
    font-weight: 600;
}

.atelier .btn-filter:not(.btn-filter-primary):not(.btn-filter-reset):hover:not(:disabled) {
    border-color: var(--encre);
    background: var(--surface-douce);
}

.atelier .btn-danger {
    background: #ffffff;
    border: 2px solid var(--rouge-bouton);
    color: var(--rouge-bouton);
}

.atelier .btn-danger:hover:not(:disabled) {
    background: var(--rouge-bouton);
    color: #ffffff;
}

.atelier :is(.btn-filter, .btn-primary, .btn-secondary, .btn-danger):disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.atelier .btn-filter-primary,
.atelier .btn-primary,
.atelier .btn-download {
    background: var(--rouge-bouton);
    border-color: var(--rouge-bouton);
    color: #ffffff;
    font-weight: 700;
}

.atelier .btn-filter-primary:hover:not(:disabled),
.atelier .btn-primary:hover:not(:disabled),
.atelier .btn-download:hover {
    background: var(--rouge-bouton-survol);
    border-color: var(--rouge-bouton-survol);
    color: #ffffff;
}

.atelier .btn-filter-reset,
.atelier .btn-secondary {
    background: #ffffff;
    border: 2px solid var(--encre);
    color: var(--encre);
    font-weight: 700;
}

.atelier .btn-filter-reset:hover:not(:disabled),
.atelier .btn-secondary:hover:not(:disabled) {
    background: var(--encre);
    color: #ffffff;
}

.atelier .btn-filter {
    border-radius: var(--radius);
}

/* --- Champs : un cadre qui se voit (3:1) ----------------------------------- */

.atelier input[type="text"],
.atelier input[type="search"],
.atelier input[type="number"],
.atelier input[type="email"],
.atelier input[type="password"],
.atelier input[type="date"],
.atelier select,
.atelier textarea {
    border-color: var(--trait-champ);
    border-radius: var(--radius);
}

/* --- Messages ------------------------------------------------------------- */

.atelier .message {
    border-radius: 0;
}

/* --- Pied de page --------------------------------------------------------- */

.atelier .footer {
    background: transparent;
    border-top: 1px solid var(--trait);
    color: var(--texte-doux);
}

/* --- Ce qui se collait sous l'ancien bandeau rouge de 48 px --------------- */

.bandeau-voir-comme {
    top: 0;
}

.atelier .doc-viewer {
    top: 20px;
}

@media (max-width: 768px) {
    .bandeau-voir-comme {
        top: 56px;
    }

    .atelier .doc-viewer {
        top: 76px;
    }
}

/* L'en-tête de l'aperçu d'une fiche : ses boutons passent à la ligne plutôt
   que d'écraser le titre. */
.atelier .doc-viewer-header {
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Liens dans un texte (17/11/2026) ---------------------------------------
   Dans les bandeaux et les phrases d'explication, un lien restait au bleu
   souligné du navigateur, la seule tache de couleur hors charte de la page. */
.atelier .bandeau-en-cours a,
.atelier .corbeille-cible-texte a {
    color: var(--rouge-texte);
    font-weight: 600;
    text-decoration: none;
}

.atelier .bandeau-en-cours a:hover,
.atelier .corbeille-cible-texte a:hover {
    text-decoration: underline;
}
