/* ═══════════════════════════════════════════════
   PAGE DOCUMENTS — CDTT76
   ═══════════════════════════════════════════════ */

:root {
    --navy:       #0D2A6B;
    --navy-light: #1a3a85;
    --red:        #D4192C;
    --red-hover:  #b8152b;
    --light:      #F4F6FB;
    --border:     #e2e6f0;
    --text:       #1a1a2e;
    --muted:      #6b7280;
    --white:      #ffffff;
    --radius:     12px;
    --shadow:     0 2px 16px rgba(13,42,107,.08);
    --shadow-lg:  0 8px 32px rgba(13,42,107,.13);
    --transition: .22s ease;

    --pdf-color:  #e53935;
    --xlsx-color: #2e7d32;
    --docx-color: #1565c0;
    --file-color: #6b7280;
}

.page-documents .container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ═══ HERO ══════════════════════════════════════ */
.docs-hero {
    position: relative;
    background: var(--navy);
    color: var(--white);
    padding: 72px 0 64px;
    overflow: hidden;
    text-align: center;
}

.docs-hero__bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 60%, rgba(212,25,44,.16) 0%, transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(255,255,255,.05) 0%, transparent 40%);
    pointer-events: none;
}

.page-documents .section-label {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--red);
    background: rgba(212,25,44,.15);
    padding: 4px 14px;
    border-radius: 100px;
    margin-bottom: 16px;
}

.docs-hero__title {
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 14px;
    color: var(--white);
}

.docs-hero__title span { color: var(--red); }

.docs-hero__sub {
    font-size: .95rem;
    color: rgba(255,255,255,.65);
    max-width: 480px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

.docs-hero__stats {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 100px;
    padding: 10px 28px;
}

.docs-stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.docs-stat__num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--white);
}

.docs-stat__label {
    font-size: .8rem;
    color: rgba(255,255,255,.6);
}

.docs-stat__sep {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,.2);
    margin: 0 20px;
}

/* ═══ RÉCENTS ═══════════════════════════════════ */
.docs-recents {
    background: var(--white);
    padding: 40px 0 36px;
    border-bottom: 1px solid var(--border);
}

.docs-recents__header {
    margin-bottom: 20px;
}

.docs-recents__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.docs-recents__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/*
 * Card récent — structure :
 *   .recent-doc-card
 *     └─ .recent-doc-card__top   (flex: icône + infos)
 *     └─ .recent-doc-card__btn   (bouton à droite sur desktop)
 *
 * Desktop : card = flex-row, __top prend tout l'espace, bouton à droite
 * Mobile  : card = flex-col, __top reste row, bouton pleine largeur
 */
.recent-doc-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    transition: box-shadow var(--transition), transform var(--transition);
}

.recent-doc-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: transparent;
}

/* Icône + infos — prend tout l'espace disponible */
.recent-doc-card__top {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.recent-doc-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recent-doc-card__cat {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--red);
}

.recent-doc-card__title {
    font-size: .92rem;
    font-weight: 700;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.recent-doc-card__date {
    font-size: .72rem;
    color: var(--muted);
}

/* Bouton — ne rétrécit jamais */
.recent-doc-card__btn {
    flex-shrink: 0;
}

/* ═══ ICÔNES TYPE FICHIER ════════════════════════ */
.doc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .04em;
    flex-shrink: 0;
    color: var(--white);
}

.doc-icon--pdf  { background: var(--pdf-color); }
.doc-icon--xlsx { background: var(--xlsx-color); }
.doc-icon--xls  { background: var(--xlsx-color); }
.doc-icon--docx { background: var(--docx-color); }
.doc-icon--doc  { background: var(--docx-color); }

/* fallback */
.doc-icon:not([class*="--pdf"]):not([class*="--xlsx"]):not([class*="--xls"]):not([class*="--docx"]):not([class*="--doc"]) {
    background: var(--file-color);
}

/* ═══ CONTRÔLES (sticky) ═════════════════════════ */
.docs-controls {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(13,42,107,.05);
}

.docs-controls__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.docs-controls__filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.doc-pill {
    font-size: .78rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 100px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.doc-pill em {
    font-style: normal;
    font-size: .7rem;
    color: var(--muted);
    background: var(--light);
    padding: 1px 6px;
    border-radius: 100px;
}

.doc-pill:hover { border-color: var(--navy); color: var(--navy); }

.doc-pill.active {
    background: var(--red);
    border-color: var(--red);
    color: var(--white);
}

.doc-pill.active em {
    background: rgba(255,255,255,.2);
    color: rgba(255,255,255,.85);
}

.docs-controls__right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.docs-search { position: relative; }

.docs-search svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.docs-search input {
    padding: 7px 14px 7px 34px;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    font-size: .83rem;
    color: var(--text);
    outline: none;
    width: 200px;
    background: var(--light);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.docs-search input:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(13,42,107,.07);
    background: var(--white);
}

.docs-count {
    font-size: .78rem;
    color: var(--muted);
    white-space: nowrap;
    font-weight: 500;
}

/* ═══ LISTE ══════════════════════════════════════ */
.docs-list-section {
    background: var(--light);
    padding: 36px 0 72px;
}

.doc-no-results {
    text-align: center;
    color: var(--muted);
    padding: 48px 0;
    font-size: .95rem;
}

.docs-list {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.doc-row {
    display: grid;
    grid-template-columns: 48px 1fr auto auto;
    align-items: center;
    gap: 20px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: #f8f9fc; }

.doc-row__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: .6rem;
}

.doc-row__main { min-width: 0; }

.doc-row__title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-row__desc {
    font-size: .78rem;
    color: var(--muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-row__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    min-width: 120px;
    text-align: right;
}

.doc-row__cat {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--red);
    background: rgba(212,25,44,.07);
    padding: 2px 8px;
    border-radius: 100px;
    white-space: nowrap;
}

.doc-row__date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    color: var(--muted);
    white-space: nowrap;
}

.doc-row__action { flex-shrink: 0; }

.doc-row__unavailable {
    font-size: .75rem;
    color: var(--muted);
    font-style: italic;
}

/* ═══ BOUTONS ════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
}

.btn--primary { background: var(--red); color: var(--white); }
.btn--primary:hover { background: var(--red-hover); transform: translateY(-1px); }
.btn--sm { font-size: .8rem; padding: 7px 14px; }

/* ═══ RESPONSIVE ═════════════════════════════════ */

/* Tablette paysage : récents → 2 colonnes */
@media (max-width: 1024px) {
    .docs-recents__grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablette portrait */
@media (max-width: 768px) {
    .docs-recents__grid { grid-template-columns: 1fr; gap: 10px; }
    .doc-row { grid-template-columns: 44px 1fr auto; gap: 14px; }
    .doc-row__meta { display: none; }
}

/* Mobile */
@media (max-width: 540px) {
    .docs-hero { padding: 48px 0 44px; }
    .docs-hero__stats { flex-direction: column; gap: 8px; padding: 14px 22px; border-radius: 14px; }
    .docs-stat__sep { width: 36px; height: 1px; margin: 0; }

    /* Card récent : colonne, bouton pleine largeur */
    .recent-doc-card { flex-direction: column; align-items: stretch; gap: 12px; }
    .recent-doc-card__btn { width: 100%; justify-content: center; }

    /* Contrôles */
    .docs-controls__inner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .docs-controls__right { width: 100%; flex-direction: column; align-items: flex-start; gap: 8px; }
    .docs-search { width: 100%; }
    .docs-search input { width: 100%; box-sizing: border-box; }

    /* Lignes : 2 rangées */
    .doc-row {
        grid-template-columns: 40px 1fr;
        grid-template-rows: auto auto;
        gap: 8px 12px;
        padding: 14px 16px;
    }
    .doc-row__icon { grid-row: 1 / 3; align-self: center; }
    .doc-row__main { grid-column: 2; }
    .doc-row__action { grid-column: 2; justify-self: start; }
}