*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root{
    --header-h: 80px;
    --footer-h: 60px;
    /* Thème clair par défaut */
    --bg: #f6feff;
    --text: #111827;
    --header-bg: #e1f7f9;
    --header-text: #595858;
    --link: rgb(98, 100, 100);
    --link-hover-bg: #333;
    --link-hover-text: #f6feff;
    --footer-bg: #333;
    --footer-text: #ffffff;
    --footer-hover-bg: #444;
    --border-soft: #dfdfdd;
    /* Surfaces et textes */
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e5e7eb;
    --text-strong: #111827;
    --text-muted: #6b7280;
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
}

.theme-dark{
    --bg: #0b1220;            /* fond général */
    --text: #e5e7eb;          /* texte général */
    --header-bg: #111827;     /* fond header */
    --header-text: #e5e7eb;   /* texte header */
    --link: #cbd5e1;          /* liens nav */
    --link-hover-bg: #334155; /* hover nav */
    --link-hover-text: #f8fafc;
    --footer-bg: #0b1220;     /* fond footer */
    --footer-text: #e5e7eb;   /* texte footer */
    --footer-hover-bg: #1f2937;
    --border-soft: #475569;   /* bordures douces */
    /* Surfaces et textes (dark) */
    --surface: #111827;
    --surface-2: #0f172a;
    --border: #334155;
    --text-strong: #e5e7eb;
    --text-muted: #9ca3af;
    --input-bg: #0b1220;
    --input-border: #475569;
}

body{
    font-family: Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container{
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - var(--header-h) - var(--footer-h));
}

@media (min-width: 992px){
  .container{
    width: min(1200px, 90%);
  }
}

/* Ensure the main content flexes to push footer down when content is short,
   without forcing an oversized min-height */
main.container{
    flex: 1 0 auto;
    min-height: auto;
}

header{
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 10px 0;
    min-height: var(--header-h);
}

.header-container{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.header-logo{
    width: 50px;
    height: 50px;
}

.logo{
    display: flex;
    flex-direction: column;
}

a{
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    padding: 0.6rem 0.4rem;
}

nav ul{
    list-style: none;
    display: flex;
    justify-content: center;
}

nav ul li{
    margin: 0 10px;
}

nav ul li a{
    color: var(--link);
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

nav ul li a:hover{
    color: var(--link-hover-text);
    background-color: var(--link-hover-bg);
}

footer{
    background-color: var(--footer-bg);
    margin-top:auto;
    color: var(--footer-text);
    padding: 10px 0;
    text-align: center;
    min-height: var(--footer-h);
}

h1{
    margin-bottom: 20px;
    font-weight: 800;
}

p{
    margin-bottom: 10px;
}

.header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-soft);
}

/* Footer */
footer{
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 10px 0;
    text-align: center;
    min-height: var(--footer-h);
}

footer .footerLinks{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 2rem;
}

footer .footerInfos{
    display: flex;
    justify-content: center;
    align-items: center;
}

footer .footerInfos a{
    margin: 0 0.5rem;
    color: var(--footer-text);
    text-decoration: none;
    padding: 0.5rem;
    border: 1px solid var(--border-soft);
    border-radius: 5px;
}

footer .footerInfos a:hover{
    background-color: var(--footer-hover-bg);
}

footer .footerLinksTerms{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.15rem;
}

footer .footerLinksTerms a{
    color: var(--footer-text);
    text-decoration: none;
}

footer .footerLinksTerms a:hover{
    text-decoration: underline;
}

/* Markdown code blocks: unified background */
pre { background:#000 !important; color:#fff !important; border:1px solid #222 !important; border-radius:6px !important; padding:12px 16px !important; overflow:auto !important; }
pre > code { background:transparent !important; display:block; padding:0; white-space:pre; }
/* Inline code */
:not(pre) > code { background:#f6f8fa; border:1px solid #eaecef; border-radius:4px; padding:.2em .4em; }
/* highlight.js & Prism */
pre > code.hljs, code.hljs { background:transparent !important; }
pre[class*="language-"] > code { background:transparent !important; }
/* Admin logs keep transparent background */
.card-log pre { background: transparent !important; border:none; padding:0; }

/* Confidentialité */
.confidentialite-section{
    margin-bottom: 2rem;
}

.confidentialite-section h2{
    margin-bottom: 1rem;
}

.confidentialite-section p{
    margin-bottom: 1rem;
}

.confidentialite-list{
    list-style: disc;
    margin-left: 2rem;
}

/* CGU */
.cgu-section{
    margin-bottom: 2rem;
}

.cgu-section h2{
    margin-bottom: 1rem;
}

.cgu-section p{
    margin-bottom: 1rem;
}

.cgu-list{
    list-style: disc;
    margin-left: 2rem;
}

.containerLogin{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90vh;
}

.loginCard{
    background-color: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.loginHeader{
    text-align: center;
    margin-bottom: 2rem;
}

.loginForm{
    display: flex;
    flex-direction: column;
}

.formGroup{
    margin-bottom: 1rem;
}

.formGroup input{
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 5px;
}

button{
    padding: 0.5rem 1rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:hover{
    background-color: #0056b3;
}

.loginFooter{
    text-align: center;
    margin-top: 2rem;
}

.loginFooter a{
    color: #007bff;
    text-decoration: none;
}

.loginFooter a:hover{
    text-decoration: underline;
}

/* Bouton retour en haut */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: none;
    z-index: 1000;
}

#back-to-top.visible {
    display: block;
    opacity: 0.7;
}

#back-to-top:hover {
    opacity: 1;
}

.row{display:flex;flex-wrap:wrap;gap:1rem}
.col-12{flex:1 1 100%}
@media(min-width:768px){.col-md-3{flex:0 0 calc(25% - 1rem)}}
.my-3{margin-top:1rem;margin-bottom:1rem}
.mb-0{margin-bottom:0}
.mb-2{margin-bottom:.5rem}
.me-2{margin-right:.5rem}
.small{font-size:.875rem}
.text-muted{color:#6c757d}
.d-flex{display:flex}
.justify-content-between{justify-content:space-between}
.align-items-center{align-items:center}
.flex-wrap{flex-wrap:wrap}
.gap-2{gap:.5rem}
.mt-2{margin-top:.5rem}
.g-3{gap:1rem}
@media(min-width:768px){.col-md-6{flex:0 0 calc(50% - 1rem)}}
.h-100{height:100%}
.align-middle td,.align-middle th{vertical-align:middle}
.card{background:var(--surface);border:1px solid var(--border);border-radius:8px;box-shadow:0 1px 2px rgba(16,24,40,.05)}
.card-body{padding:1rem;color:var(--text)}
.card-header{padding:.75rem 1rem;border-bottom:1px solid var(--border);background:var(--surface-2);color:var(--text-strong)}
.card-title{font-size:1rem;margin:0 0 .5rem 0}
.badge{display:inline-block;padding:2px 8px;border-radius:12px;background:#6c757d;color:#fff;font-size:.75rem}
.table-responsive{width:100%;overflow-x:auto}
.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:.5rem .75rem;border-top:1px solid var(--border);color:var(--text)}
.table thead th{border-bottom:2px solid var(--border);background:var(--surface-2);text-align:left;font-weight:600;color:var(--text-strong)}
.table-sm th,.table-sm td{padding:.4rem .5rem}
.alert{margin-bottom:1rem;padding:.75rem 1rem;border:1px solid var(--border);border-radius:6px;background:var(--surface-2);color:var(--text)}
/* Accents par sévérité via une bordure gauche colorée, compatibles dark/light */
.alert-info{border-left:4px solid #0ea5e9}
.alert-success{border-left:4px solid #16a34a}
.alert-danger{border-left:4px solid #dc2626}
.alert-warning{border-left:4px solid #f59e0b}

.col-24{width:100%}
.col-24 .row{display:grid;grid-template-columns:1fr;gap:1rem}
@media(min-width:768px){.col-24 .row{grid-template-columns:repeat(2,minmax(0,1fr))}}
.btn{display:inline-block;padding:.5rem .9rem;border:1px solid transparent;border-radius:6px;cursor:pointer;text-decoration:none;line-height:1.25}
.btn:hover{opacity:.95}
.btn-primary{background:#0d6efd;color:#fff;border-color:#0d6efd}
.btn-secondary{background:#6c757d;color:#fff;border-color:#6c757d}
.btn-outline-primary{background:transparent;color:#0d6efd;border-color:#0d6efd;font-size:1.2rem;}
.btn-outline-primary:hover{background:#0d6efd;color:#fff}
.btn-outline-secondary{background:transparent;color:#6c757d;border-color:#6c757d}
.btn-outline-secondary:hover{background:#6c757d;color:#fff}
.page-container{display:block}
.page-header{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:1rem}
.page-header h1{margin:0}
.page-description{color:#6c757d;margin-top:.25rem}
.page-actions{display:flex;gap:.5rem;flex-wrap:wrap}
.documents-list{display:grid;grid-template-columns:1fr;gap:1rem}
@media(min-width:768px){.documents-list{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(min-width:1024px){.documents-list{grid-template-columns:repeat(3,minmax(0,1fr))}}
.document-card{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:1rem;box-shadow:0 1px 2px rgba(16,24,40,.05)}
.document-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}
.document-type-badge{display:inline-block;padding:2px 8px;border-radius:12px;background:#0ea5e9;color:#fff;font-size:.75rem}
.document-date{color:#6b7280;font-size:.8rem}
.document-title{font-size:1.05rem;margin:.25rem 0 .5rem 0}
.document-title a{color:var(--text-strong)}
.document-title a:hover{text-decoration:underline}
.document-description{color:var(--text);margin-bottom:.5rem}
.document-card-footer{display:flex;justify-content:space-between;align-items:center;margin-top:.5rem}
.document-meta{display:flex;gap:1rem;align-items:center;margin-bottom:1rem}
.document-body{background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:1rem}
.document-actions{margin-top:1rem;display:flex;gap:.5rem;flex-wrap:wrap}
.empty-state{padding:2rem;text-align:center;border:1px dashed var(--input-border);border-radius:8px;background:var(--surface-2);color:var(--text)}
.formGroup label{display:block;font-weight:600;margin-bottom:.35rem}
.formGroup input,.formGroup select,.formGroup textarea{width:100%;padding:.55rem .65rem;border:1px solid var(--input-border);border-radius:6px;background:var(--input-bg);color:var(--text)}
.formGroup textarea{resize:vertical}
.formGroup .help{color:#6b7280;font-size:.85rem;margin-top:.25rem}

.modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;z-index:1050}
.modal{background:var(--surface);border-radius:10px;box-shadow:0 10px 25px rgba(0,0,0,.2);width:100%;max-width:520px;overflow:hidden;border:1px solid var(--border)}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:.75rem 1rem;border-bottom:1px solid var(--border);background:var(--surface-2);color:var(--text-strong)}
.modal-body{padding:1rem}
.modal-footer{display:flex;gap:.5rem;justify-content:flex-end;padding:0 1rem 1rem}

@media (max-width: 768px){
  .header-container{flex-direction:column;align-items:stretch}
}

/* Public announcements: shared styles */
.public-ann-page-title {
    margin: 0 0 12px;
    color: #15213d;
}

.public-ann-list {
    display: grid;
    gap: 14px;
    margin: 10px 0 20px;
}

.public-ann-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
    transition: box-shadow 0.2s ease;
}

.public-ann-card:hover {
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.10);
}

.public-ann-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.public-ann-pill {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.public-ann-pill.sev-info { background: #3b82f6; }
.public-ann-pill.sev-warning { background: #f59e0b; }
.public-ann-pill.sev-danger { background: #ef4444; }

.public-ann-title {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-strong);
}

.public-ann-content {
    color: var(--text);
    line-height: 1.6;
}

.public-ann-dates {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

@media (max-width: 768px) {
    .public-ann-card { padding: 12px; }
}

/* Unify public announcement severity colors with .alert palette */
.public-ann-pill.sev-info { background: #055160; }
.public-ann-pill.sev-warning { background: #664d03; }
.public-ann-pill.sev-danger { background: #842029; }

.public-ann-card.sev-info { border-left: 4px solid #055160; }
.public-ann-card.sev-warning { border-left: 4px solid #664d03; }
.public-ann-card.sev-danger { border-left: 4px solid #842029; }

/* Header search */
.header-search{display:flex;justify-content:flex-end;padding:8px 16px 0}
.header-search-form{display:flex;align-items:center;gap:0;max-width:600px;width:100%;justify-content:flex-end;position:relative}
.header-search-input{flex:1;min-width:220px;padding:8px 40px 8px 14px;border:1px solid var(--input-border);border-radius:999px;background:var(--input-bg);color:var(--text);transition:border-color .2s, box-shadow .2s}
.header-search-input::placeholder{color:var(--text-muted)}
.header-search-input:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.15)}
.header-search-submit{position:absolute;right:10px;top:50%;transform:translateY(-50%);background:transparent;border:none;color:var(--text);cursor:pointer;font-size:1rem;width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center}
.header-search-submit:hover{background:rgba(0,0,0,.06);color:#111827}

@media (max-width: 768px){
  .header-search{padding:8px 12px 0}
  .header-search-form{max-width:100%}
  .header-search-input{min-width:0}
}

/* Search page (scoped to the search form and its following siblings) */
form[action*="recherche"]{margin-bottom:12px}
form[action*="recherche"] ~ h2{margin:16px 0 8px;color:var(--text-strong);border-bottom:1px solid var(--border);padding-bottom:4px}
form[action*="recherche"] ~ ul.list-unstyled{margin:8px 0 12px;padding-left:0}
form[action*="recherche"] ~ ul.list-unstyled li{list-style:none;padding:6px 10px;border-radius:6px;transition:background-color .15s ease}
form[action*="recherche"] ~ ul.list-unstyled li:hover{background:var(--surface-2)}
form[action*="recherche"] ~ ul.list-unstyled a{color:#0d6efd;font-weight:600}
form[action*="recherche"] ~ ul.list-unstyled a:hover{text-decoration:underline}
form[action*="recherche"] ~ ul.list-unstyled .text-muted{display:block;margin-top:2px}

/* Last contents */
.list-last-contents {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.list-last-contents a {
    text-decoration: none;
    color: #0d6efd;
    font-weight: 600;
    border:1px solid #034dbc;
    padding: 5px 10px;
    margin-bottom: 0.3rem;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.list-last-contents a:hover {
    text-decoration: none;
    background: #0d6efd;
    color: #fff;
}

.list-last-contents div.list-last-contents-visibility{
    font-size: 12px;
    color: #fafdff;
    border-radius: 0.2rem 0.2rem;
    padding: 0.3rem 0.5rem;
    background: #034dbc;
}
