/* =============================================================================
   GED Force Ouvrière — Base styles
   ============================================================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #c8102e;
    --color-primary-dark: #a30d25;
    --color-primary-light: #df2e2b;
    --color-text: #333;
    --color-text-light: #6c757d;
    --color-bg: #f5f5f5;
    --color-white: #fff;
    --color-border: #dee2e6;
    --color-border-light: #e9ecef;
    --color-hover: #f8f9fa;
    --radius: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */

.header {
    background: var(--color-primary);
    color: var(--color-white);
    padding: 0 1.5rem;
    height: 48px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Groupe gauche : logo + menus */
.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-white);
}

.header-logo-img {
    display: block;
    height: 30px;
    width: auto;
}

/* UN LIEN NE VA JAMAIS À LA LIGNE. Sans cela, dès que la place manque — un
   nom d'utilisateur plus long à droite suffit : « Christophe ATTIAS » contre
   « Local DEV » —, « Tableau de bord » se coupait en deux lignes, la barre
   gagnait en hauteur, et les autres liens restaient collés en haut. Les liens
   restent centrés dans la barre quoi qu'il arrive, et se resserrent sur les
   écrans moins larges (cf. plus bas). */
.header-nav {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    white-space: nowrap;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.15);
}

/* Le panier porte son compte dans le bandeau, comme le faisait Maileva : une
   sélection qu'on ne voit pas est une sélection qu'on oublie, et qu'on refait
   le lendemain. La pastille disparaît quand le panier est vide. */
.nav-link-panier {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.panier-compte {
    display: inline-block;
    min-width: 1.15rem;
    padding: 0 0.32rem;
    border-radius: 9px;
    background: var(--color-white);
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.15rem;
}

/* --- Bloc utilisateur (droite) : avatar initiales + menu déroulant --- */
.user-block {
    position: relative;
    display: flex;
    align-items: center;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--color-white);
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: var(--radius);
    font: inherit;
    transition: background var(--transition);
}

.user-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
}

.avatar-circle {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-name {
    display: flex;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--color-white);
    white-space: nowrap;
}

.user-prenom {
    font-weight: 500;
}

.user-nom {
    font-weight: 700;
}

.dropdown-arrow {
    font-size: 0.7rem;
    opacity: 0.85;
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 190px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 200;
    flex-direction: column;
}

.user-dropdown-menu.open {
    display: flex;
}

.user-dropdown-role {
    padding: 0.55rem 1rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.user-dropdown-item {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background var(--transition);
}

.user-dropdown-item:hover {
    background: #ffecec;
}

.dropdown-separator {
    border: none;
    border-top: 1px solid var(--color-border-light);
    margin: 0;
}

/* --- Main content --- */

.main-content {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1 0 auto;
}

/* --- Footer --- */

.footer {
    flex-shrink: 0;
    background: var(--color-white);
    color: var(--color-text-light);
    text-align: center;
    font-size: 0.8rem;
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--color-primary);
}

.footer p {
    margin: 0;
}

.footer-version-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-version-link:hover {
    text-decoration: underline;
}

.footer-version-text {
    font-weight: 600;
}

/* --- Utilities --- */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
}

/* Le type de document en gris et noir (20/11/2026) : il se lit sans
   attirer l'œil plus que le titre, et ne se confond plus avec un lien. */
.badge-type {
    background: #e4e4e4;
    color: #1c1c1c;
}

.badge-section {
    background: #fce4ec;
    color: #c62828;
}

.badge-thematique {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-collection {
    background: #fff3e0;
    color: #ef6c00;
}

.badge-pages {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-extension {
    background: #e9ecef;
    color: #495057;
}

/* Le taux de pertinence dans le bandeau d'une carte. Gris, à dessein : il
   renseigne sans concurrencer le type ni la section, qui disent ce qu'est le
   document. Il ne paraît que lorsque c'est lui qui classe. */
.badge-pertinence {
    background: #eceff1;
    color: #546e7a;
    font-variant-numeric: tabular-nums;
}

/* --- Menu replié (E03) ------------------------------------------------------
   Sur un écran étroit, les entrées passent derrière le bouton « ☰ Menu » et se
   déplient en liste sous le bandeau. Deux seuils : le menu d'un gestionnaire
   ou d'un administrateur (dix à treize entrées) ne tient plus sous 1180 px ;
   celui d'un lecteur (trois) tient jusqu'au téléphone. */
.nav-bascule {
    display: none;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.nav-bascule-icone {
    font-size: 1rem;
    line-height: 1;
}

@media (max-width: 1180px) {
    .nav-bascule-longue {
        display: inline-flex;
    }
}

@media (max-width: 600px) {
    .nav-bascule {
        display: inline-flex;
    }
}

@media (max-width: 1180px) {
    .header-nav.header-nav-longue {
        display: none;
    }
}

@media (max-width: 600px) {
    .header-nav {
        display: none;
    }
}

@media (max-width: 1180px) {
    .header-nav.header-nav-longue.ouvert {
        position: absolute;
        top: 48px;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.4rem 1rem 0.8rem;
        background: var(--color-primary-dark);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
        z-index: 99;
    }
}

@media (max-width: 600px) {
    .header-nav.ouvert {
        position: absolute;
        top: 48px;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.4rem 1rem 0.8rem;
        background: var(--color-primary-dark);
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
        z-index: 99;
    }
}

@media (max-width: 1180px) {
    .header-nav.ouvert .nav-link {
        padding: 0.7rem 0.6rem;
        font-size: 0.95rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }
}

/* --- Responsive --- */

/* Le menu d'un administrateur compte douze entrées : sous 1500 px de large,
   elles se resserrent plutôt que de pousser la cloche et le nom hors de la
   barre. */
@media (max-width: 1500px) {
    .nav-link {
        padding: 0.4rem 0.45rem;
        font-size: 0.8rem;
    }

    .header-left {
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    /* Sur mobile : garder l'avatar seul, masquer le nom pour éviter l'encombrement */
    .user-name {
        display: none;
    }

    .header-left {
        gap: 1rem;
    }
}

/* --- Messages applicatifs (confirmations, erreurs) --- */
.messages {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    border-left: 3px solid var(--color-text-light);
    background: var(--color-white);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
}

.message-success {
    border-left-color: #2e6a4f;
    color: #1f4c38;
}

.message-error {
    border-left-color: var(--color-primary);
    color: var(--color-primary-dark);
}

/* ===========================================================================
   La cloche des notifications
   ---------------------------------------------------------------------------
   Le retour de ce que ce compte a lancé, et rien d'autre. Collée au bloc
   utilisateur : la barre de gauche dit où aller, cette zone-ci dit ce qui vous
   concerne. Le panneau reprend la mécanique du menu utilisateur (classe
   « open », fermeture au clic extérieur et à Échap).
   =========================================================================== */
.notif-block {
    position: relative;
    margin-right: 0.75rem;
}

.notif-trigger {
    position: relative;
    display: flex;
    align-items: center;
    border: 0;
    background: none;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius);
    line-height: 1;
}

.notif-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
}

.notif-cloche {
    width: 1.15rem;
    height: 1.15rem;
    display: block;
    /* Dessinée, et non écrite : un emoji garderait sa couleur d'origine sur le
       bandeau rouge, et changerait de forme d'un système à l'autre. */
    fill: var(--color-white);
}

.notif-compte {
    position: absolute;
    top: -0.1rem;
    right: -0.25rem;
    min-width: 1.05rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--color-white);
    color: var(--color-primary);
    font-size: 0.6875rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.05rem;
}

.notif-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 22rem;
    max-height: 26rem;
    overflow-y: auto;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.notif-menu.open {
    display: block;
}

.notif-entete {
    padding: 0.6rem 0.85rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-light);
    border-bottom: 1px solid var(--color-border-light);
}

.notif-item {
    display: block;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--color-border-light);
    text-decoration: none;
    color: var(--color-text);
}

.notif-item:hover {
    background: var(--color-hover);
}

/* Non lue : une barre à gauche et le titre appuyé. Ouvrir le panneau ne les
   efface pas — on marque au clic, ou par « Tout marquer comme lu ». */
.notif-item-nonlue {
    border-left: 3px solid var(--color-primary);
}

.notif-item-titre {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.15rem;
}

.notif-item-echec .notif-item-titre {
    color: var(--color-text-light);
}

.notif-item-echec.notif-item-nonlue {
    border-left-color: var(--color-text-light);
}

.notif-item-doc {
    font-size: 0.875rem;
    line-height: 1.3;
}

.notif-item-nonlue .notif-item-doc {
    font-weight: 600;
}

.notif-item-bas,
.notif-item-avalider {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.notif-item-avalider {
    color: var(--color-primary);
    font-weight: 600;
}

.notif-vide {
    padding: 1.25rem 0.85rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--color-text-light);
}

.notif-tout-lu {
    display: block;
    width: 100%;
    padding: 0.6rem;
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--color-primary);
}

.notif-tout-lu:hover {
    background: var(--color-hover);
}

/* --- Aperçu « voir comme » (administrateurs et gestionnaires) ---
   Sous le bandeau rouge, collé à lui en défilant : on ne doit pas oublier
   qu'on regarde avec les yeux d'un autre. */
.bandeau-voir-comme {
    position: sticky;
    top: 48px;
    z-index: 90;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.5rem 1.5rem;
    background: #fff4d6;
    border-bottom: 2px solid #f9a825;
    font-size: 0.88rem;
    color: #5d4300;
}

.bandeau-voir-comme-texte {
    flex: 1 1 22rem;
}

.bandeau-voir-comme-profils {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.bandeau-voir-comme button {
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius);
    font: inherit;
    cursor: pointer;
}

.bandeau-voir-comme-profil {
    background: var(--color-white);
    border: 1px solid #e0b84a;
    color: #5d4300;
}

.bandeau-voir-comme-profil:hover:not(:disabled) {
    background: #fffaf0;
}

.bandeau-voir-comme-profil:disabled {
    background: #f9a825;
    border-color: #f9a825;
    color: var(--color-white);
    font-weight: 600;
    cursor: default;
}

.bandeau-voir-comme-retour {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: var(--color-white);
    font-weight: 600;
}

.bandeau-voir-comme-retour:hover {
    background: var(--color-primary-dark);
}


/* --- Document en cours (7/11/2026) ---------------------------------------
   Importé, pas encore publié : seul son importateur le voit. Le bandeau le
   dit en tête de la fiche et de la page de modification, avec le geste qui
   le publie (_en_cours.html). Le badge marque ces documents dans les listes. */
.bandeau-en-cours {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    margin: 0 0 1rem;
    padding: 0.8rem 1rem;
    background: #fff8e1;
    border: 1px solid #f2c94c;
    border-left: 4px solid #e0a800;
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 0.9rem;
    line-height: 1.5;
}

.bandeau-en-cours-texte {
    flex: 1 1 28rem;
}

.bandeau-en-cours-depuis {
    color: var(--color-text-light);
    margin-left: 0.25rem;
}

/* Publier maintenant, ou programmer à un jour choisi (20/11/2026). */
.bandeau-en-cours-action {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.bandeau-en-cours-ou {
    color: var(--color-text-light);
}

.bandeau-en-cours-jour {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-publier {
    padding: 0.5rem 1.1rem;
    background: #2e7d32;
    border: 0;
    border-radius: var(--radius);
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.btn-publier:hover,
.btn-publier:focus-visible {
    background: #1b5e20;
}

.badge-en-cours {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    margin-right: 0.35rem;
    background: #fff3cd;
    border: 1px solid #e0a800;
    border-radius: 999px;
    color: #7a5b00;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    vertical-align: middle;
}
