/*
 * Bandeau supérieur commun aux applications du CdC (voir docs/bandeau-commun.md).
 * Fichier unique dans cdcapps/Commun, chargé par chaque module : ne dépend d'aucune autre feuille de style.
 * Thème sombre : attribut data-theme="dark" sur <html>, ou thème du système si l'attribut est absent
 * (data-theme="light" force le clair).
 */
.cdc-header {
    --cdc-header-bg: #2f2f33;
    --cdc-header-fg: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    padding: 0.5rem 1.2rem;
    background: var(--cdc-header-bg);
    color: var(--cdc-header-fg);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
}
:root[data-theme="dark"] .cdc-header { --cdc-header-bg: #0e0e10; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .cdc-header { --cdc-header-bg: #0e0e10; }
    :root:not([data-theme]) .cdc-header-theme .cdc-i-moon { display: none; }
    :root:not([data-theme]) .cdc-header-theme .cdc-i-sun { display: block; }
}
.cdc-header a { color: inherit; }

.cdc-header-left,
.cdc-header-right,
.cdc-header-links { display: flex; align-items: center; flex-wrap: wrap; }
.cdc-header-left { gap: 0.4rem 1rem; min-width: 0; }
.cdc-header-right { gap: 0.6rem; margin-left: auto; }
.cdc-header-links { gap: 0.2rem 1rem; }

.cdc-header-brand { font-weight: 700; text-decoration: none; white-space: nowrap; }
.cdc-header-logo { height: 1.75rem; width: auto; max-width: 8rem; margin-right: 0.55rem; object-fit: contain; vertical-align: middle; }
.cdc-header-version { margin-left: 0.3rem; font-size: 0.65rem; font-weight: 400; opacity: 0.7; }

/* Fines barres blanches entre le nom, les liens et le complément. */
.cdc-header-links,
.cdc-header-extra { padding-left: 1rem; border-left: 1px solid rgba(255, 255, 255, 0.6); }
.cdc-header-links a { text-decoration: none; opacity: 0.85; }
.cdc-header-links a:hover { opacity: 1; }
.cdc-header-links a[aria-current="page"] { opacity: 1; text-decoration: underline; }
.cdc-header-extra { font-size: 0.75rem; opacity: 0.7; }

/* Liste déroulante (ex. « Administration ») : liens sous le bandeau, aux couleurs du bandeau. */
.cdc-header-menu { position: relative; }
.cdc-header-menu summary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    list-style: none;
    cursor: pointer;
    opacity: 0.85;
}
.cdc-header-menu summary::-webkit-details-marker { display: none; }
.cdc-header-menu summary:hover,
.cdc-header-menu[open] summary { opacity: 1; }
.cdc-header-menu summary[aria-current="page"] { opacity: 1; text-decoration: underline; }
.cdc-header-menu[open] summary svg { transform: rotate(180deg); }
.cdc-header-menu-list {
    position: absolute;
    top: calc(100% + 0.55rem);
    left: -0.6rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    min-width: 13rem;
    padding: 0.35rem;
    border-radius: 0 0 0.5rem 0.5rem;
    background: var(--cdc-header-bg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.cdc-header-menu-list a {
    padding: 0.4rem 0.6rem;
    border-radius: 0.35rem;
    text-decoration: none;
    white-space: nowrap;
    opacity: 0.9;
}
.cdc-header-menu-list a:hover { opacity: 1; background: rgba(255, 255, 255, 0.12); }
.cdc-header-menu-list a[aria-current="page"] { opacity: 1; font-weight: 600; background: rgba(255, 255, 255, 0.08); }

.cdc-header-user { text-decoration: none; opacity: 0.85; white-space: nowrap; }
.cdc-header-user:hover { opacity: 1; text-decoration: underline; }

.cdc-header-form { display: inline-flex; margin: 0; }
.cdc-header .cdc-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    color: inherit;
    box-shadow: none;
    cursor: pointer;
    opacity: 0.85;
}
.cdc-header .cdc-header-icon:hover,
.cdc-header .cdc-header-icon:focus-visible { opacity: 1; background: rgba(255, 255, 255, 0.15); }
.cdc-header-icon svg { display: block; }

/* Icône du thème : lune en clair (passer au sombre), soleil en sombre (passer au clair). */
.cdc-header-theme .cdc-i-sun { display: none; }
:root[data-theme="dark"] .cdc-header-theme .cdc-i-moon { display: none; }
:root[data-theme="dark"] .cdc-header-theme .cdc-i-sun { display: block; }

@media print {
    .cdc-header { display: none !important; }
}

/* Pages d'erreur communes (templates/erreur.php) : code HTTP discret au-dessus du titre. */
.cdc-erreur-statut { margin: 0 0 0.25rem; font-size: 0.9em; opacity: 0.7; }
