/* =====================================================
   BLOGHUB – mod_data – Vue liste – CSS COMPLET
   Objectif : tuiles côte à côte + pas d'article complet
   ===================================================== */

.bh-wrap {
    --bh-orange: #F29100;
    --bh-gray: #575756;
    --bh-bg: #ffffff;
    --bh-card: #ffffff;
    --bh-border: #ececec;

    background: var(--bh-bg);
    padding: 16px;
    border-radius: 16px;
}

/* =====================================================
     1) GRID ROBUSTE SUR LE CONTENEUR RÉEL MOODLE
     IMPORTANT : sélecteur très spécifique pour battre le thème
     ===================================================== */

/* page mod_data + conteneur exact */
body#page-mod-data-view #data-listview-content.box.py-3 {
    display: grid !important;
    gap: 16px !important;

    /* auto-fill => 3/4 colonnes selon largeur */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    align-items: stretch !important;

    /* certains thèmes injectent des styles de layout */
    float: none !important;
    width: 100% !important;
}

/* Le header/hero doit prendre toute la largeur */
body#page-mod-data-view #data-listview-content.box.py-3>.bh-wrap {
    grid-column: 1 / -1 !important;
}

/* Les cartes doivent être des items de grille */
body#page-mod-data-view #data-listview-content.box.py-3>article.bh-card {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100%;
    margin: 0 !important;
    /* évite les marges qui “cassent” l’alignement */
}

/* =====================================================
     2) HEADER
     ===================================================== */

.bh-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border: 1px solid var(--bh-border);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}

.bh-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
}

.bh-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bh-orange);
    box-shadow: 0 8px 20px rgba(242, 145, 0, .25);
}

.bh-title {
    font-weight: 950;
    color: var(--bh-gray);
    font-size: 20px;
    line-height: 1.1;
}

.bh-subtitle {
    color: #9ca3af;
    font-size: 12px;
    margin-top: 2px;
}

.bh-search {
    flex: 1;
    min-width: 260px;
    max-width: 720px;
    position: relative;
}

.bh-searchicon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    opacity: .55;
}

.bh-searchinput {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    outline: none;
    background: #f3f4f6;
    transition: all .2s ease;
}

.bh-searchinput:focus {
    border-color: var(--bh-orange);
    box-shadow: 0 0 0 3px rgba(242, 145, 0, .2);
    background: #fff;
}

.bh-pill {
    display: inline-block;
    padding: 6px 10px;
    background: #f3f4f6;
    border-radius: 999px;
    color: var(--bh-gray);
    font-weight: 900;
    font-size: 13px;
}

/* =====================================================
     3) HERO + filtres
     ===================================================== */

.bh-main {
    padding: 18px 2px 4px;
}

.bh-hero {
    max-width: 760px;
    margin: 8px auto 18px;
    text-align: center;
}

.bh-hero h2 {
    margin: 0;
    font-size: 28px;
    color: var(--bh-gray);
    font-weight: 950;
}

.bh-hero p {
    margin: 10px 0 0;
    color: #6b7280;
    line-height: 1.6;
}

.bh-thematics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 16px 0 18px;
}

.bh-chip {
    border: 0;
    padding: 9px 12px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 13px;
    cursor: pointer;
    background: #f3f4f6;
    color: var(--bh-gray);
    transition: all .15s ease;
}

.bh-chip:hover {
    transform: translateY(-1px);
    background: #e9ecef;
}

.bh-chip.is-active {
    background: var(--bh-orange);
    color: #fff;
}

/* =====================================================
     4) CARTES
     ===================================================== */

.bh-card {
    background: var(--bh-card);
    border: 1px solid var(--bh-border);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
    transition: transform .2s ease, box-shadow .2s ease;
}

.bh-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .10);
}

.bh-cardmedia {
    position: relative;
}

.bh-cardimg {
    height: 190px;
    background: linear-gradient(135deg, #eee, #ddd);
    position: relative;
    overflow: hidden;
}

.bh-cardimg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bh-cardimg-fallback {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #f1f1f1, #dedede);
}

.bh-cardimg:has(img) .bh-cardimg-fallback {
    display: none;
}

.bh-thematic {
    position: absolute;
    top: 12px;
    left: 12px;
}

.bh-tag {
    margin: 2px;
    border: 0;
    background: var(--bh-orange);
    color: #fff;
    font-weight: 950;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
}

.bh-cardbody {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    background-color: #ffffff;
}

.bh-cardtitle {
    margin: 0;
    font-size: 18px;
    font-weight: 950;
    color: var(--bh-gray);
    line-height: 1.25;
}

/* résumé clampé */
.bh-cardexcerpt {
    margin: 0;
    color: #4b5563;
    font-size: 13.5px;
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.bh-cardfooter {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Tags Moodle */
.bh-tags {
    margin: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.bh-tags a {
    margin: 2px;
    padding: 7px 10px;
    background: #f3f4f6;
    border-radius: 12px;
    color: var(--bh-gray);
    font-weight: 950;
    font-size: 12px;
    text-decoration: none;
}

.bh-tags a:hover {
    background: var(--bh-orange);
    color: #fff;
}

/* Bouton "Lire" stylé depuis ##more## */
.bh-readwrap .action-icon {
    display: inline-flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bh-orange);
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 950;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
    transition: filter .15s ease, transform .15s ease;
    white-space: nowrap;
}

.bh-readwrap .action-icon:hover {
    filter: brightness(.95);
    transform: translateY(-1px);
}

.bh-readwrap .action-icon i.icon {
    display: none;
}

.bh-readwrap .action-icon::after {
    content: "Lire →";
}

/* =====================================================
     5) Anti “article complet” en liste : sécurité
     ===================================================== */
.bh-card .data-field-html {
    display: none !important;
}

.bh-card iframe,
.bh-card video,
.bh-card audio {
    display: none !important;
}

/* =====================================================
     6) No results
     ===================================================== */
.bh-noresults {
    text-align: center;
    padding: 34px 10px;
}

.bh-noresults-ico {
    width: 84px;
    height: 84px;
    border-radius: 999px;
    margin: 0 auto 10px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    opacity: .65;
}

.bh-noresults h3 {
    margin: 0;
    color: var(--bh-gray);
    font-weight: 950;
}

.bh-noresults p {
    margin: 8px 0 0;
    color: #6b7280;
}

.bh-back {
    margin: 2px 0 12px;
}

.bh-backlink {
    display: inline-block;
    color: var(--bh-gray);
    text-decoration: none;
    font-weight: 950;
    padding: 8px 10px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--bh-border);
}

.bh-backlink:hover {
    color: var(--bh-orange);
    border-color: #f3d7ad;
}

/* ===== Fiche : bouton retour (spécifique page mod_data) ===== */
body#page-mod-data-view .bh-back {
    margin: 10px 0 14px !important;
}

body#page-mod-data-view a#bh-backlink.bh-backlink {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;

    padding: 10px 12px !important;
    border-radius: 12px !important;

    background: #ffffff !important;
    border: 1px solid #ececec !important;

    color: #575756 !important;
    text-decoration: none !important;
    font-weight: 900 !important;

    box-shadow: 0 6px 18px rgba(0, 0, 0, .06) !important;
}

body#page-mod-data-view a#bh-backlink.bh-backlink:hover {
    border-color: #F29100 !important;
    color: #F29100 !important;
}

/* ===== Liste : badge thématique (plus lisible) ===== */
body#page-mod-data-view .bh-tag {
    background: #F29100 !important;
    color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, .06) !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
    text-shadow: none !important;
}

/* ===== Liste : bouton Lire (##more## => .action-icon) ===== */
body#page-mod-data-view .bh-readwrap .action-icon {
    background: #F29100 !important;
    color: #ffffff !important;

    border: 1px solid rgba(0, 0, 0, .06) !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;

    text-shadow: none !important;
    opacity: 1 !important;
}

/* On neutralise des styles thèmes possibles */
body#page-mod-data-view .bh-readwrap .action-icon,
body#page-mod-data-view .bh-readwrap .action-icon * {
    color: #fff !important;
}

/* Hover plus propre */
body#page-mod-data-view .bh-readwrap .action-icon:hover {
    filter: brightness(.97) !important;
    transform: translateY(-1px) !important;
}

/* image du haut de fiche de depasse plus */
#page-mod-data-view img.list_picture {
    border: 0;
    width: -webkit-fill-available;
}

/*masquer les champs seo sur la vue fiche */
details.bh-seo {
    display: none;
}

/* NEW CSS VUE LISTE */
.bh-thematics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}

.bh-chip {
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    color: #575756;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.bh-chip:hover {
    background: #ececec;
}

.bh-chip.active {
    background: #F29100;
    border-color: #F29100;
    color: #fff;
}

/* Option : si tu veux garder l'icône, commente ces 2 lignes */
/* body#page-mod-data-view .bh-readwrap .action-icon i.icon{display:none !important;} */
/* body#page-mod-data-view .bh-readwrap .action-icon::after{content:"Lire →" !important;} */

/* AJOUT DU 27 MARS 2026 */
.bh-header {
    display: block;
}

.bh-header-top {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.bh-title-main {
    margin: 0;
    font-size: 28px;
    font-weight: 950;
    color: #575756;
    line-height: 1.2;
}

.bh-subtitle-main {
    margin-top: 6px;
    color: #6b7280;
    line-height: 1.5;
}

.bh-searchdata {
    display: none !important;
}

/* Ajout Laureen 04/26 */

.pagination {
    display: none !important;
}

#page-mod-data-view img.list_picture {
    object-fit: cover;
}