/* ═══════════════════════════════════════════════════════════════════════
   Bibliothèque Numérique — Charte institutionnelle RDC
   Ministère de la Formation Professionnelle
   Palette : Bleu #003087 · Or #F7A800 · Rouge #CE1126
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────────── */
:root {
    --rdc-blue:     #003087;
    --rdc-blue-lt:  #1a4fa8;
    --rdc-blue-bg:  #eef2fb;
    --rdc-red:      #CE1126;
    --rdc-gold:     #F7A800;
    --rdc-dark:     #1a1f3c;
    --rdc-bg:       #f2f4f9;
    --border:       #dde3ee;
    --text-muted:   #6b7280;
    --radius:       8px;
}

/* ── Fil d'Ariane ───────────────────────────────────────────────────── */
.bib-breadcrumb {
    background: var(--rdc-dark);
    padding: 10px 0;
    font-size: 12px;
    color: rgba(255,255,255,.55);
    margin: 0;
}
.bib-breadcrumb a {
    color: rgba(255,255,255,.75);
    text-decoration: none;
    transition: color .15s;
}
.bib-breadcrumb a:hover { color: var(--rdc-gold); }
.bib-sep { margin: 0 8px; color: rgba(255,255,255,.28); }
.bib-current { color: var(--rdc-gold); font-weight: 600; }

/* ── Hero ───────────────────────────────────────────────────────────── */
.bib-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(140deg, #001050 0%, var(--rdc-blue) 55%, #1a4fa8 100%);
    padding: 56px 0 48px;
    color: #fff;
    margin-top: 0;
}
/* Accent diagonal rouge (drapeau RDC) */
.bib-hero::before {
    content: '';
    position: absolute;
    top: 0; right: -80px;
    width: 380px; height: 100%;
    background: linear-gradient(135deg, transparent 35%, rgba(206,17,38,.15) 35%);
    pointer-events: none;
}
/* Bandeau tricolore bas */
.bib-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--rdc-blue) 0%, var(--rdc-gold) 33%,
        var(--rdc-red) 66%, var(--rdc-gold) 100%
    );
}
.bib-hero-inner { position: relative; z-index: 1; }

.bib-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(247,168,0,.14);
    border: 1px solid rgba(247,168,0,.35);
    color: var(--rdc-gold);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .9px;
    text-transform: uppercase;
    padding: 5px 16px;
    border-radius: 999px;
    margin-bottom: 18px;
}
.bib-hero h1 {
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.25;
}
.bib-hero-icon { color: var(--rdc-gold); margin-right: 10px; }
.bib-subtitle {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: rgba(255,255,255,.6);
    margin-bottom: 12px;
}
.bib-desc {
    font-size: 14px;
    color: rgba(255,255,255,.82);
    max-width: 580px;
    line-height: 1.7;
    margin-bottom: 0;
}
.bib-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(247,168,0,.16);
    border: 1.5px solid rgba(247,168,0,.42);
    color: var(--rdc-gold);
    font-size: 13px;
    font-weight: 700;
    padding: 7px 20px;
    border-radius: 999px;
    margin-top: 22px;
}

/* ── Barre de filtres sticky ────────────────────────────────────────── */
.bib-filters {
    background: #fff;
    border-bottom: 3px solid var(--rdc-blue);
    padding: 14px 0;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: 0 4px 18px rgba(0,48,135,.09);
}
.bib-filter-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 12px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* Champ recherche */
.bib-search-wrap {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    min-width: 220px;
    position: relative;
}
.bib-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    color: var(--rdc-blue);
    font-size: 14px;
    pointer-events: none;
}
.bib-search-wrap input[type="text"] {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--rdc-dark);
    outline: none;
    background: #fafbff;
    -webkit-transition: border-color .2s, box-shadow .2s;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    height: auto;
    line-height: 1.4;
    box-shadow: none;
}
.bib-search-wrap input[type="text"]:focus {
    border-color: var(--rdc-blue);
    box-shadow: 0 0 0 3px rgba(0,48,135,.09);
    background: #fff;
}

/* Suggestions autocomplete */
#suggestions {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 600;
    background: #fff;
    border: 1.5px solid var(--rdc-blue);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,48,135,.12);
    display: none;
}
.suggestion-item,
a.suggestion-item,
a.list-group-item.suggestion-item {
    padding: 10px 16px !important;
    font-size: 13px !important;
    cursor: pointer;
    color: var(--rdc-dark) !important;
    border: none !important;
    border-bottom: 1px solid #f0f3fa !important;
    display: block !important;
    text-decoration: none !important;
    background: #fff !important;
    border-radius: 0 !important;
    -webkit-transition: background .12s, color .12s;
    transition: background .12s, color .12s;
}
.suggestion-item:last-child,
a.suggestion-item:last-child { border-bottom: none !important; }
.suggestion-item:hover,
a.suggestion-item:hover {
    background: var(--rdc-blue-bg) !important;
    color: var(--rdc-blue) !important;
}

/* Sélecteur catégorie */
.bib-select {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--rdc-dark);
    background: #fafbff;
    outline: none;
    min-width: 200px;
    cursor: pointer;
    height: auto;
    line-height: 1.4;
    -webkit-transition: border-color .2s, box-shadow .2s;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23003087' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    box-shadow: none;
}
.bib-select:focus {
    border-color: var(--rdc-blue);
    box-shadow: 0 0 0 3px rgba(0,48,135,.09);
    background-color: #fff;
}

/* ── Section résultats ──────────────────────────────────────────────── */
.bib-section {
    background: var(--rdc-bg);
    padding: 36px 0 70px;
    min-height: 400px;
}
.bib-results-bar {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.bib-results-count {
    font-size: 13px;
    color: var(--text-muted);
}
.bib-results-count strong { color: var(--rdc-blue); font-weight: 700; }

/* ── États spéciaux ─────────────────────────────────────────────────── */
.bib-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
    font-size: 14px;
    width: 100%;
}
.bib-loading i {
    font-size: 28px;
    color: var(--rdc-blue);
    opacity: .5;
}

/* Spinner CSS autonome (ne dépend pas de Font Awesome) */
@keyframes bib-spin {
    to { transform: rotate(360deg); }
}
.bib-spinner {
    display: inline-block;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(0, 48, 135, .18);
    border-top-color: var(--rdc-blue);
    border-radius: 50%;
    animation: bib-spin .75s linear infinite;
}
.bib-empty {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-muted);
    width: 100%;
}
.bib-empty i {
    font-size: 56px;
    display: block;
    margin-bottom: 18px;
    color: #c5cfdf;
}
.bib-empty p { font-size: 14px; margin-bottom: 6px; }
.bib-empty a { color: var(--rdc-blue); }

/* ── Grille equal-height (override Bootstrap 3 float) ──────────────── */
#resultats {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
/* Chaque colonne devient un conteneur flex pour que la carte s'étire */
#resultats > .bib-card-wrap {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

/* ── Carte document ─────────────────────────────────────────────────── */
.bib-card-wrap { margin-bottom: 24px; }

.bib-card {
    background: #fff;
    border: 1px solid var(--border);
    border-top: 4px solid var(--rdc-blue);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    box-shadow: 0 2px 12px rgba(0,48,135,.07);
    -webkit-transition: box-shadow .25s, -webkit-transform .22s;
    transition: box-shadow .25s, transform .22s;
}
.bib-card:hover {
    box-shadow: 0 14px 40px rgba(0,48,135,.18);
    -webkit-transform: translateY(-5px);
    transform: translateY(-5px);
}
/* Bouton passe en or au survol de la carte */
.bib-card:hover .bib-card-link {
    background: var(--rdc-gold);
    color: var(--rdc-dark) !important;
}

/* ── Barre de couleur supérieure selon le type ──────────────────────── */
.bib-card.type-pdf,
.bib-card.type-comm  { border-top-color: var(--rdc-red); }
.bib-card.type-law   { border-top-color: var(--rdc-dark); }
.bib-card.type-guide { border-top-color: #0a7c5c; }
.bib-card.type-word  { border-top-color: #2B579A; }
.bib-card.type-excel { border-top-color: #217346; }

/* ── Zone icône ─────────────────────────────────────────────────────── */
.bib-card-img {
    height: 132px;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    background: rgba(0, 48, 135, .05);
    position: relative;
    border-bottom: 1px solid var(--border);
}
/* Fond coloré selon type de la carte parente */
.bib-card.type-pdf  .bib-card-img,
.bib-card.type-comm .bib-card-img { background: rgba(206, 17, 38, .06); }
.bib-card.type-law  .bib-card-img { background: rgba(26, 31, 60, .06); }
.bib-card.type-guide .bib-card-img { background: rgba(10, 124, 92, .06); }
.bib-card.type-word .bib-card-img { background: rgba(43, 87, 154, .07); }
.bib-card.type-excel .bib-card-img { background: rgba(33, 115, 70, .07); }

/* Cercle blanc derrière l'icône */
.bib-card-img::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .68);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
}
.bib-card-img i {
    font-size: 40px;
    position: relative;
    z-index: 1;
    opacity: .82;
    -webkit-transition: -webkit-transform .22s;
    transition: transform .22s;
}
.bib-card:hover .bib-card-img i {
    -webkit-transform: scale(1.12);
    transform: scale(1.12);
}

/* Couleurs icône selon type */
.icon-pdf   { color: var(--rdc-red); }
.icon-word  { color: #2B579A; }
.icon-excel { color: #217346; }
.icon-ppt   { color: #D24726; }
.icon-law   { color: var(--rdc-blue); }
.icon-book  { color: #0a7c5c; }
.icon-chart { color: #166534; }
.icon-comm  { color: var(--rdc-red); }
.icon-img   { color: #7c3aed; }
.icon-arch  { color: #92400e; }
.icon-def   { color: var(--rdc-blue); }

/* ── Corps de la carte ──────────────────────────────────────────────── */
.bib-card-body {
    padding: 16px 18px 14px;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

/* Badge type de document */
.bib-card-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #fff;
    background: var(--rdc-blue);
    padding: 3px 10px;
    border-radius: 4px;
    -ms-flex-item-align: start;
    align-self: flex-start;
    margin-bottom: 10px;
}
.bib-card-type.type-pdf,
.bib-card-type.type-comm  { background: var(--rdc-red); }
.bib-card-type.type-law   { background: var(--rdc-dark); }
.bib-card-type.type-guide { background: #0a7c5c; }
.bib-card-type.type-word  { background: #2B579A; }
.bib-card-type.type-excel { background: #217346; }

/* Titre : flex:1 pousse le footer en bas ; line-clamp borne la hauteur */
.bib-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--rdc-dark);
    line-height: 1.55;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mention / référence */
.bib-card-mention {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Date de publication */
.bib-card-date {
    font-size: 11px;
    color: var(--text-muted);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 5px;
    margin-bottom: 14px;
}
.bib-card-date i { color: var(--rdc-blue); opacity: .65; }

/* Pied de carte — séparé du corps par un trait */
.bib-card-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Bouton télécharger / consulter */
.bib-card-link {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #fff !important;
    background: var(--rdc-blue);
    padding: 10px 14px;
    border-radius: 6px;
    text-decoration: none !important;
    width: 100%;
    -webkit-transition: background .2s, color .2s;
    transition: background .2s, color .2s;
}
.bib-card-link:hover,
.bib-card-link:focus {
    background: var(--rdc-gold);
    color: var(--rdc-dark) !important;
    text-decoration: none !important;
}

/* ── Pagination ─────────────────────────────────────────────────────── */
.bib-pagination-wrap {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
    width: 100%;
}

.bib-page-info {
    font-size: 12.5px;
    color: var(--text-muted);
}
.bib-page-info strong { color: var(--rdc-blue); font-weight: 700; }

/* Liste de pages */
.bib-pagination { margin: 0; }
.bib-page-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 4px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* Bouton / span de page */
.bib-page-btn {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 5px;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--rdc-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    -webkit-transition: background .18s, border-color .18s, color .18s, box-shadow .18s;
    transition: background .18s, border-color .18s, color .18s, box-shadow .18s;
    font-family: inherit;
    line-height: 1;
    vertical-align: middle;
}
button.bib-page-btn:hover,
button.bib-page-btn:focus {
    background: var(--rdc-blue-bg);
    border-color: var(--rdc-blue);
    color: var(--rdc-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,48,135,.1);
}

/* Page active */
.bib-page-btn.bib-page-active {
    background: var(--rdc-blue);
    border-color: var(--rdc-blue);
    color: #fff;
    cursor: default;
    box-shadow: 0 3px 10px rgba(0,48,135,.28);
}

/* Désactivé */
.bib-page-btn.bib-page-disabled {
    opacity: .38;
    cursor: not-allowed;
    background: #f5f6fa;
    border-color: var(--border);
    color: var(--text-muted);
}

/* Boutons Préc. / Suiv. */
.bib-page-prev,
.bib-page-next {
    padding: 0 14px;
    font-size: 12px;
    letter-spacing: .2px;
}

/* Points de suspension */
.bib-page-dots {
    display: inline-block;
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    line-height: 38px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 992px) {
    .bib-hero h1 { font-size: 26px; }
}
@media (max-width: 768px) {
    .bib-hero { padding: 38px 0 32px; }
    .bib-hero h1 { font-size: 22px; }
    .bib-filter-row {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: stretch;
        -ms-flex-align: stretch;
        align-items: stretch;
    }
    .bib-search-wrap,
    .bib-select { min-width: 100%; width: 100%; }
}
@media (max-width: 480px) {
    .bib-hero h1 { font-size: 19px; }
    .bib-hero-badge { font-size: 10px; }
    .bib-card-img { height: 100px; }
    .bib-card-img i { font-size: 34px; }
    .bib-card-img::before { width: 66px; height: 66px; }
}
