/* TST SYSTEM V22 - CSS public découpé par zones.
   Le fichier reste le point d’entrée unique appelé par base.html. */
@import url("public/01-base-layout.css");
@import url("public/02-public-pages.css");
@import url("public/03-components.css");

/* V24.2 - Mode maintenance administrateur */
.maintenance-admin-banner{
    position:fixed;
    top:88px;
    left:0;
    right:0;
    z-index:70;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:14px;
    padding:10px 18px;
    background:#b91c1c;
    color:#fff;
    box-shadow:0 10px 28px rgba(0,0,0,.28);
    font-size:14px;
}
.maintenance-admin-banner strong{font-weight:900;}
.maintenance-admin-banner a{
    color:#fff;
    font-weight:900;
    text-decoration:underline;
    text-underline-offset:4px;
}
.maintenance-public-page{
    min-height:calc(100vh - 180px);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:70px 20px;
    background:radial-gradient(circle at 15% 10%,rgba(215,25,32,.22),transparent 35%),linear-gradient(135deg,#050609,#121722);
}
.maintenance-public-card{
    max-width:720px;
    width:100%;
    text-align:center;
    background:rgba(255,255,255,.055);
    border:1px solid rgba(255,255,255,.14);
    border-radius:28px;
    padding:44px 34px;
    box-shadow:0 28px 70px rgba(0,0,0,.35);
}
.maintenance-public-logo{
    max-height:76px;
    max-width:220px;
    object-fit:contain;
    margin-bottom:24px;
}
.maintenance-public-card h1{
    font-size:clamp(34px,4vw,56px);
    margin:10px 0 18px;
}
.maintenance-public-card p:not(.eyebrow){
    color:rgba(255,255,255,.78);
    line-height:1.75;
    font-size:17px;
}
.maintenance-public-actions{
    display:flex;
    justify-content:center;
    flex-wrap:wrap;
    gap:12px;
    margin-top:28px;
}
.maintenance-public-actions a{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:48px;
    padding:12px 18px;
    border-radius:10px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.16);
    color:#fff;
    font-weight:800;
}
@media(max-width:900px){
    .maintenance-admin-banner{top:76px;flex-direction:column;gap:6px;text-align:center;}
}

/* V24.2.1 - Navigation par ancres avec topbar fixe */
html{
    scroll-padding-top:104px;
}

[id]{
    scroll-margin-top:104px;
}

@media(max-width:900px){
    html{scroll-padding-top:92px;}
    [id]{scroll-margin-top:92px;}
}

/* Si le mode maintenance est actif côté administrateur, on tient compte aussi de la bannière. */
body.has-maintenance-banner{
    --anchor-offset:150px;
}
body.has-maintenance-banner [id]{
    scroll-margin-top:150px;
}
@media(max-width:900px){
    body.has-maintenance-banner [id]{scroll-margin-top:138px;}
}


/* V24.2.2 - Offset d'ancrage robuste, piloté par JS en priorité */
html{scroll-padding-top:var(--tst-anchor-offset, 104px);}
[id]{scroll-margin-top:var(--tst-anchor-offset, 104px);}
body.has-maintenance-banner{--tst-anchor-offset:150px;}
@media(max-width:900px){
    html{scroll-padding-top:var(--tst-anchor-offset, 92px);}
    [id]{scroll-margin-top:var(--tst-anchor-offset, 92px);}
    body.has-maintenance-banner{--tst-anchor-offset:138px;}
}

/* =====================================================
   V25.2 - Centre de documentation public
   ===================================================== */
.documents-public-page .documents-search-section{
    padding-top:0!important;
}
.documents-public-search{
    display:grid;
    grid-template-columns:minmax(240px,1.4fr) minmax(200px,.7fr) auto auto;
    gap:14px;
    align-items:end;
    padding:20px;
    border:1px solid var(--line);
    border-radius:24px;
    background:rgba(255,255,255,.045);
}
.documents-public-search label{
    display:flex;
    flex-direction:column;
    gap:8px;
    color:#fff;
    font-weight:800;
}
.documents-public-search input,
.documents-public-search select{
    width:100%;
    min-height:48px;
    border:1px solid rgba(255,255,255,.16);
    border-radius:14px;
    background:rgba(255,255,255,.07);
    color:#fff;
    padding:12px 14px;
    font:inherit;
}
.documents-category-block{
    margin-bottom:46px;
}
.public-documents-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
    gap:18px;
}
.public-document-card{
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    gap:18px;
    min-height:190px;
    padding:22px;
    border:1px solid var(--line);
    border-radius:24px;
    background:linear-gradient(180deg,rgba(255,255,255,.06),rgba(255,255,255,.025));
    box-shadow:0 18px 40px rgba(0,0,0,.18);
}
.public-document-main{
    display:flex;
    align-items:flex-start;
    gap:16px;
}
.public-document-icon{
    width:56px;
    min-width:56px;
    height:56px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:18px;
    background:rgba(215,25,32,.13);
    border:1px solid rgba(215,25,32,.25);
    font-size:28px;
}
.public-document-content{
    display:flex;
    flex-direction:column;
    gap:8px;
    min-width:0;
}
.public-document-content strong{
    color:#fff;
    font-size:18px;
    line-height:1.25;
}
.public-document-content em{
    color:rgba(255,255,255,.72);
    font-style:normal;
    line-height:1.5;
}
.public-document-content small,
.document-meta-line{
    color:rgba(255,255,255,.58);
    line-height:1.45;
}
.public-document-actions{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
}
.public-document-actions .btn{
    flex:1 1 120px;
}
.document-meta-line{
    display:flex;
    flex-wrap:wrap;
    gap:10px 18px;
    margin:18px 0 0;
}
.document-meta-line span{
    padding:8px 12px;
    border-radius:999px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.12);
}
.document-info-list{
    display:grid;
    grid-template-columns:180px 1fr;
    gap:12px 18px;
    margin:0;
}
.document-info-list dt{
    color:var(--muted);
    font-weight:800;
}
.document-info-list dd{
    margin:0;
    color:#fff;
}
.public-empty-state{
    padding:34px;
    border:1px solid var(--line);
    border-radius:24px;
    background:rgba(255,255,255,.045);
}
.public-document-card.compact{
    min-height:auto;
}
@media(max-width:900px){
    .documents-public-search{
        grid-template-columns:1fr;
    }
    .document-info-list{
        grid-template-columns:1fr;
    }
    .public-document-main{
        align-items:center;
    }
}

/* =====================================================
   V25.3 - Centre de téléchargement public
   ===================================================== */
.download-center-page .download-center-hero{
    padding-bottom:34px;
}
.download-center-tools{
    padding-top:0!important;
    padding-bottom:24px!important;
}
.download-center-search{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto auto;
    gap:12px;
    align-items:center;
    padding:14px;
    border:1px solid var(--line);
    border-radius:20px;
    background:rgba(255,255,255,.04);
}
.download-center-search input{
    width:100%;
    min-height:52px;
    padding:0 18px;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.14);
    background:#080a0f;
    color:#fff;
    font:inherit;
}
.download-categories-section{
    padding-top:24px!important;
}
.download-category-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(210px,1fr));
    gap:18px;
}
.download-category-card{
    position:relative;
    min-height:220px;
    padding:28px 22px;
    border:1px solid rgba(255,255,255,.10);
    border-radius:6px;
    background:rgba(255,255,255,.045);
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:16px;
    text-align:center;
    transition:transform .18s ease,border-color .18s ease,background .18s ease;
}
.download-category-card:hover{
    transform:translateY(-4px);
    border-color:rgba(215,25,32,.55);
    background:rgba(255,255,255,.065);
}
.download-category-icon{
    width:78px;
    height:78px;
    display:grid;
    place-items:center;
}
.download-category-icon img{
    width:68px;
    height:68px;
    filter:invert(29%) sepia(88%) saturate(3305%) hue-rotate(341deg) brightness(97%) contrast(94%);
}
.download-category-card strong{
    font-size:20px;
    color:#fff;
}
.download-category-card small{
    color:var(--muted);
}
.download-category-card em{
    position:absolute;
    right:20px;
    bottom:20px;
    width:34px;
    height:34px;
    border-radius:50%;
    display:grid;
    place-items:center;
    background:rgba(255,255,255,.08);
    color:#fff;
    font-style:normal;
}
.download-list-heading{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:18px;
    margin:18px 0;
}
.download-list-heading h3{
    margin:0;
    font-size:30px;
}
.download-resource-list{
    display:grid;
    gap:12px;
}
.download-resource-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:16px;
    align-items:center;
    padding:16px;
    border:1px solid rgba(255,255,255,.11);
    border-radius:18px;
    background:linear-gradient(180deg,rgba(255,255,255,.055),rgba(255,255,255,.025));
}
.download-resource-main{
    display:flex;
    align-items:center;
    gap:16px;
    min-width:0;
}
.download-file-icon{
    width:58px;
    height:58px;
    border-radius:16px;
    background:rgba(215,25,32,.10);
    border:1px solid rgba(215,25,32,.22);
    display:grid;
    place-items:center;
    flex:0 0 auto;
}
.download-file-icon img{
    width:30px;
    height:30px;
    filter:invert(29%) sepia(88%) saturate(3305%) hue-rotate(341deg) brightness(97%) contrast(94%);
}
.download-resource-content{
    display:flex;
    flex-direction:column;
    gap:5px;
    min-width:0;
}
.download-resource-content strong{
    color:#fff;
    font-size:17px;
}
.download-resource-content em{
    color:rgba(255,255,255,.76);
    font-style:normal;
    line-height:1.45;
}
.download-resource-content small{
    color:var(--muted);
    line-height:1.45;
}
.download-resource-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    justify-content:flex-end;
}
.download-detail-hero{
    display:grid;
    grid-template-columns:110px minmax(0,1fr);
    gap:26px;
    align-items:start;
    background:linear-gradient(180deg,rgba(255,255,255,.055),rgba(255,255,255,.025));
    border:1px solid rgba(255,255,255,.11);
    border-radius:26px;
    padding:34px!important;
}
.download-detail-icon{
    width:96px;
    height:96px;
    border-radius:24px;
    display:grid;
    place-items:center;
    background:rgba(215,25,32,.10);
    border:1px solid rgba(215,25,32,.24);
}
.download-detail-icon img{
    width:52px;
    height:52px;
    filter:invert(29%) sepia(88%) saturate(3305%) hue-rotate(341deg) brightness(97%) contrast(94%);
}
.document-meta-line{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin:18px 0;
}
.document-meta-line span{
    padding:7px 10px;
    border-radius:999px;
    background:rgba(255,255,255,.07);
    color:rgba(255,255,255,.78);
    font-size:13px;
}
.document-info-list{
    display:grid;
    grid-template-columns:220px 1fr;
    gap:12px 18px;
}
.document-info-list dt{
    color:var(--muted);
    font-weight:800;
}
.document-info-list dd{
    margin:0;
}
@media(max-width:900px){
    .download-center-search,
    .download-resource-row,
    .download-detail-hero{
        grid-template-columns:1fr;
    }
    .download-resource-actions{
        justify-content:flex-start;
    }
    .download-list-heading{
        align-items:flex-start;
        flex-direction:column;
    }
}

/* V25.4 - Centre de téléchargement simplifié */
.document-category-admin-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:12px;
    align-items:center;
}
.document-category-toggle{
    min-height:46px;
    padding:12px 14px;
    border:1px solid var(--admin-border, rgba(255,255,255,.12));
    border-radius:12px;
    background:rgba(255,255,255,.035);
}
.simplified-document-detail .document-meta-line span:empty{display:none}

/* V25.5 - Centre de téléchargement public simplifié */
.download-category-card em{display:none!important;}
.download-category-card small{margin-top:2px;}
.download-resource-actions .btn{white-space:nowrap;}
@media(max-width:760px){
    .download-resource-actions .btn{width:100%;}
}

/* V26 - consultation directe des ressources */
.document-viewer-header{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
}
.document-viewer-title{
    padding-top:20px;
    padding-bottom:20px;
}
.document-viewer-frame-section{
    padding-top:0;
}
.document-viewer-frame{
    width:100%;
    height:min(82vh, 760px);
    min-height:560px;
    border:1px solid rgba(15,23,42,.14);
    border-radius:18px;
    background:#fff;
}

/* V26.4 - finitions centre de téléchargement */
.download-center-return{
    padding-top:0!important;
    padding-bottom:10px!important;
}
.download-center-return .btn{
    width:max-content;
}
.download-center-search .btn.secondary{
    background:rgba(255,255,255,.08);
    border-color:rgba(255,255,255,.16);
}
.download-resource-actions .btn.primary[href^="http"]{
    white-space:normal;
}
.public-empty-state .btn{
    margin-top:14px;
}
@media(max-width:760px){
    .download-center-search{
        grid-template-columns:1fr;
    }
    .download-center-search .btn,
    .download-center-return .btn{
        width:100%;
        justify-content:center;
        text-align:center;
    }
    .download-category-card{
        min-height:180px;
    }
    .download-category-icon{
        width:64px;
        height:64px;
    }
    .download-category-icon img{
        width:56px;
        height:56px;
    }
    .download-resource-main{
        align-items:flex-start;
    }
}


/* V26.6 - ressources directes et lecteur PDF responsive */
.download-resource-main{
    text-decoration:none;
}
.download-resource-main:hover strong{
    color:#fff;
}

/* V26.7 - lecteur PDF proportionnel : scroll sur la page, pas dans le cadre */
.document-viewer-page .document-viewer-header,
.document-viewer-page .document-viewer-title,
.document-viewer-page .document-viewer-frame-section{
    max-width:980px;
}
.document-viewer-page .document-viewer-title{
    padding-top:8px;
    padding-bottom:18px;
}
.document-viewer-frame-section{
    padding-top:0!important;
    padding-bottom:46px!important;
}
.document-viewer-frame{
    display:block;
    width:100%;
    height:auto;
    min-height:0;
    aspect-ratio:210 / 297;
    border:1px solid rgba(255,255,255,.22);
    border-radius:18px;
    background:#2f2f2f;
    overflow:hidden;
}
@media(min-width:1200px){
    .document-viewer-page .document-viewer-frame-section{
        max-width:900px;
    }
}
@media(max-width:760px){
    .document-viewer-header{
        justify-content:flex-start;
        padding-top:22px!important;
        padding-bottom:10px!important;
    }
    .document-viewer-header .btn{
        width:100%;
        justify-content:center;
        text-align:center;
    }
    .document-viewer-title{
        padding-top:6px!important;
        padding-bottom:10px!important;
    }
    .document-viewer-title .eyebrow,
    .document-viewer-title h1,
    .document-viewer-title p{
        margin-bottom:8px;
    }
    .document-viewer-frame-section{
        padding-left:12px!important;
        padding-right:12px!important;
        padding-bottom:24px!important;
    }
    .document-viewer-frame{
        border-radius:14px;
    }
}
@media(max-width:480px){
    .document-viewer-page .document-viewer-header,
    .document-viewer-page .document-viewer-title,
    .document-viewer-page .document-viewer-frame-section{
        max-width:100%;
    }
    .document-viewer-frame-section{
        padding-left:10px!important;
        padding-right:10px!important;
    }
}
