/**
 * TC Hub Filters — barre de filtres unifiée des hubs (activités, agriturismos, hébergements,
 * restaurants), même design que le hub des circuits (tc-circuits). 19/09/2026.
 *
 * Le balisage des 4 hubs est parallèle (…-filterbar > …-fb-item[data-filter] > bouton + panneau de
 * radios) : hubfilters.js pose les classes .tcfb-* dessus, ce CSS est donc indépendant du préfixe du
 * hub. Les règles propres à chaque plugin (dropdowns absolus, bouton par filtre) sont neutralisées
 * ici avec une spécificité doublée (.tcfb.tcfb) et !important sur les propriétés de mise en page.
 *
 * Mobile (leçon du bug des circuits, 19/09) : sur téléphone TOUT est empilé pleine largeur avec
 * min-width:0 — des éléments flex en flex:0 0 auto de largeur « max-content » débordaient de la
 * carte et se faisaient couper par le bord de l'écran.
 */
.tcfb.tcfb {
    --tcfb-blue: #2C4A6E;
    --tcfb-blue-l: #5B84AC;
    --tcfb-cream: #F2EDE4;
    --tcfb-gold: #C9973A;
    --tcfb-dark: #1A1612;
    display: block !important;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    background: #fff;
    border: 1px solid #e4e1da;
    border-radius: 12px;
    box-shadow: none;
    padding: 18px 22px 20px;
    margin: 16px 0 20px;
    position: relative;
    color: var(--tcfb-dark);
}
.tcfb.tcfb *, .tcfb.tcfb *::before, .tcfb.tcfb *::after { box-sizing: border-box; }
.tcfb-hide { display: none !important; }

/* ── En-tête : compteur, réinitialiser, bouton mobile ─────────────────── */
.tcfb .tcfb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.tcfb .tcfb-count { font-weight: 700; color: var(--tcfb-blue); min-height: 1.2em; }
.tcfb .tcfb-head-actions { display: flex; align-items: center; gap: 16px; }
.tcfb .tcfb-reset {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--tcfb-blue-l); font-size: .82rem; font-weight: 600; text-decoration: underline;
}
.tcfb .tcfb-reset:hover { color: var(--tcfb-blue); }
.tcfb .tcfb-toggle {
    display: none;
    background: var(--tcfb-blue); color: #fff; border: none; border-radius: 6px;
    padding: 8px 14px; font-size: .84rem; font-weight: 600; cursor: pointer;
}

/* ── Corps : sections en ligne qui passent à la ligne ─────────────────── */
.tcfb .tcfb-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px 34px; }
.tcfb .tcfb-section { flex: 0 1 auto; min-width: 0; position: relative; margin: 0; padding: 0; }
.tcfb .tcfb-title {
    font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: #8a8378; margin: 0 0 10px; line-height: 1.2;
}

/* Le bouton-dropdown d'origine disparaît pour les filtres en chips ; les panneaux restent ouverts
   même si le JS du hub leur remet l'attribut hidden après un choix. */
.tcfb.tcfb .tcfb-section--chips > [class$="-fb-btn"] { display: none !important; }
.tcfb.tcfb .tcfb-section--chips > .tcfb-panel,
.tcfb.tcfb .tcfb-section--chips > .tcfb-panel[hidden] {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    position: static !important;
    width: auto !important; min-width: 0 !important; max-width: 560px !important; max-height: none !important;
    padding: 0 !important; margin: 0 !important;
    border: 0 !important; box-shadow: none !important; background: transparent !important;
    overflow: visible !important;
}

/* ── Chips (radios / cases cochables habillés en pastilles) ───────────── */
.tcfb.tcfb .tcfb-opt {
    display: inline-flex !important; align-items: center; gap: 6px;
    width: auto !important; margin: 0 !important;
    padding: 6px 13px !important;
    border: 1px solid var(--tcfb-blue-l); border-radius: 999px; background: #fff;
    color: var(--tcfb-blue); font-size: .82rem !important; font-weight: 600; line-height: 1.2;
    white-space: nowrap; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.tcfb .tcfb-opt:hover { background: var(--tcfb-cream) !important; }
.tcfb .tcfb-opt input {
    position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none;
}
.tcfb .tcfb-opt svg { width: 14px; height: 14px; flex-shrink: 0; }
.tcfb .tcfb-opt.is-active { background: var(--tcfb-blue) !important; border-color: var(--tcfb-blue); color: #fff; }
.tcfb .tcfb-opt:focus-within { outline: 2px solid var(--tcfb-blue-l); outline-offset: 2px; }

/* Variantes de couleur (même logique que type / encadrement / durée des circuits) */
.tcfb [data-filter="prix"] .tcfb-opt { border-color: var(--tcfb-gold); color: #8a6420; font-size: .78rem !important; padding: 5px 11px !important; }
.tcfb [data-filter="prix"] .tcfb-opt:hover { background: #FBF3E4 !important; }
.tcfb [data-filter="prix"] .tcfb-opt.is-active { background: var(--tcfb-gold) !important; border-color: var(--tcfb-gold); color: #fff; }
.tcfb [data-filter="note"] .tcfb-opt,
.tcfb [data-filter="duree"] .tcfb-opt,
.tcfb [data-filter="specs"] .tcfb-opt { border-color: #7A8B99; color: #4a5a68; font-size: .78rem !important; padding: 5px 11px !important; }
.tcfb [data-filter="note"] .tcfb-opt.is-active,
.tcfb [data-filter="duree"] .tcfb-opt.is-active,
.tcfb [data-filter="specs"] .tcfb-opt.is-active { background: #4a5a68 !important; border-color: #4a5a68; color: #fff; }

/* Partenaires : pastilles avec logo */
.tcfb .tcfb-opt--op { border: 1.5px solid #e4e1da !important; border-radius: 8px !important; padding: 5px 9px 5px 5px !important; gap: 6px; color: #4a4a4a; }
.tcfb .tcfb-opt--op img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.tcfb .tcfb-opt--op .tcfb-op-fallback {
    width: 22px; height: 22px; border-radius: 4px; background: var(--tcfb-cream); color: var(--tcfb-blue);
    font-weight: 700; font-size: .78rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tcfb .tcfb-opt--op:hover { border-color: var(--tcfb-blue-l) !important; }
.tcfb .tcfb-opt--op.is-active { background: #EEF3F8 !important; border-color: var(--tcfb-blue) !important; color: var(--tcfb-blue); }
.tcfb .tcfb-opt--op .tcfb-op-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tcfb .tcfb-opt--op .tcfb-op-n { color: #8a8378; font-weight: 500; font-size: .74rem; }

/* ── Zone : dropdown avec recherche, à la façon du sélecteur de ville des circuits ── */
.tcfb .tcfb-section--dropdown { min-width: 210px; }
.tcfb.tcfb .tcfb-section--dropdown > [class$="-fb-btn"] {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #fff; border: 1px solid #d9d5cb; border-radius: 6px; padding: 8px 10px;
    font-size: .84rem; font-weight: 400; color: var(--tcfb-dark); cursor: pointer;
}
.tcfb .tcfb-section--dropdown > [class$="-fb-btn"] > svg:first-child { display: none; }
.tcfb .tcfb-section--dropdown > [class$="-fb-btn"] [class$="-fb-label"] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcfb.tcfb .tcfb-section--dropdown > .tcfb-panel {
    position: absolute !important; z-index: 30; top: calc(100% + 6px); left: 0;
    width: 440px !important; max-width: 80vw !important; min-width: 0 !important; max-height: 340px !important;
    overflow-y: auto; background: #fff; border: 1px solid #e4e1da !important; border-radius: 10px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,.14) !important; padding: 12px !important;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.tcfb.tcfb .tcfb-section--dropdown > .tcfb-panel[hidden] { display: none !important; }
.tcfb .tcfb-dd-search {
    grid-column: 1 / -1; width: 100%; border: 1px solid #d9d5cb; border-radius: 6px;
    padding: 7px 10px; font-size: .84rem; margin: 0 0 6px;
}
.tcfb.tcfb .tcfb-dd-opt {
    display: block !important; padding: 6px 7px !important; margin: 0 !important; border-radius: 5px;
    font-size: .8rem !important; color: #4a4a4a; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border: 0 !important; background: none;
}
.tcfb .tcfb-dd-opt:hover { background: var(--tcfb-cream); }
.tcfb .tcfb-dd-opt input { display: none; }
.tcfb .tcfb-dd-opt.is-active { background: var(--tcfb-blue); color: #fff; }
.tcfb .tcfb-dd-opt--all { grid-column: 1 / -1; font-weight: 700; }

/* ── Tri ─────────────────────────────────────────────────────────────── */
.tcfb .tcfb-section--order select {
    border: 1px solid #d9d5cb; border-radius: 6px; padding: 8px 10px; font-size: .84rem;
    background: #fff; color: var(--tcfb-dark); cursor: pointer; max-width: 100%;
}

/* Éléments d'origine devenus inutiles (remplacés par l'en-tête) */
.tcfb.tcfb [class$="-fb-reset"] { display: none !important; }

/* ═══════════════════════ Mobile / tablette ═══════════════════════ */
@media (max-width: 900px) {
    .tcfb.tcfb { padding: 14px 14px 16px; }
    .tcfb .tcfb-toggle { display: inline-block; }
    .tcfb .tcfb-body { display: none; margin-top: 4px; }
    .tcfb .tcfb-body.is-open { display: flex; }
    /* pleine largeur, jamais plus large que la carte */
    .tcfb .tcfb-section { flex: 1 1 100%; width: 100%; max-width: 100%; }
    .tcfb.tcfb .tcfb-section--chips > .tcfb-panel,
    .tcfb.tcfb .tcfb-section--chips > .tcfb-panel[hidden] { max-width: 100% !important; }
    .tcfb .tcfb-section--dropdown { min-width: 0; }
    .tcfb.tcfb .tcfb-section--dropdown > .tcfb-panel { width: 100% !important; max-width: 100% !important; }
    .tcfb .tcfb-opt--op { max-width: 100%; }
    .tcfb .tcfb-section--order select { width: 100%; }
}
@media (max-width: 640px) {
    .tcfb.tcfb .tcfb-section--dropdown > .tcfb-panel { grid-template-columns: repeat(2, 1fr); }
    .tcfb .tcfb-head { flex-wrap: wrap; }
}

/* ═══════════ Cards des hubs hébergements et activités sur mobile (19/09/2026) ═══════════
   Sous 1024 px, la vue « liste + carte » (split) passe en colonne (flex-direction: column-reverse)
   MAIS garde align-items: flex-start : en colonne, chaque bloc prend alors la largeur de son contenu
   (jusqu'à 590 px, rangée de boutons / commentaire Tosco sur une ligne) au lieu de celle de l'écran, et
   les cards dépassent du cadre — contrairement aux agriturismos et restaurants qui étirent leurs blocs.
   On étire ici la liste et la carte à 100 %, sans toucher au CSS des deux plugins. */
@media (max-width: 1024px) {
    .tcha-split-layout, .tcact-split-layout { align-items: stretch; }
    .tcha-split-list, .tcact-split-list,
    .tcha-split-map,  .tcact-split-map { flex: 0 0 auto; width: 100%; max-width: 100%; min-width: 0; }
}
/* Pagination : les numéros passent à la ligne au lieu de dépasser à droite */
@media (max-width: 640px) {
    .tcha-pagination, .tcact-pagination { flex-wrap: wrap; justify-content: center; max-width: 100%; gap: 6px; }
    .tcha-pg-pages, .tcact-pg-pages { flex-wrap: wrap; justify-content: center; max-width: 100%; }
}
