/* =========================================================
   CSMK TABLE SCROLL — HINT + SCROLLBAR CUSTOM + DRAG HANDLE
   Scope : body.coconsem
   ========================================================= */

/* =========================================================
   CSMK TABLE SCROLL — HINT + SCROLLBAR CUSTOM + DRAG HANDLE
   Scope : élargi (coconsem + contenus Brizy / entry-content / prose)
   ========================================================= */

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll,
:where(.entry-content, article.prose, .brz-root__container) .table-scroll{

  position: relative !important;

  /* NE JAMAIS dépasser 1100px */
  width: 100% !important;
  max-width: 1100px !important;
  min-width: 0 !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
  margin-bottom: 24px !important;
  margin-top: 61px;
  padding-bottom: 58px !important; /* réserve une vraie zone sous le tableau pour la UI */

  /* Empêche le débordement qui crée le scroll horizontal de page */
  overflow-y: visible !important; /* garde le hint/scrollbar visibles */
}

/* Le conteneur scrollable */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: block !important;

  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;

  /* La réserve verticale se fait désormais sur le wrapper parent */
  padding-bottom: 0 !important;

  cursor: auto;
}
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.has-x-overflow .table-scroll-inner{
  padding-bottom: 0 !important;
}

@media (hover: hover) and (pointer: fine){
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.has-x-overflow .table-scroll-inner{
    cursor: grab !important;
  }
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.is-dragging .table-scroll-inner{
    cursor: grabbing !important;
  }
}

/* =========================================================
   TABLE LAYOUT — “smart overflow”
   - Le tableau prend 100% de la colonne
   - MAIS les cellules ont un min-width => overflow seulement si nécessaire
   ========================================================= */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner table{
  width: max-content !important;
  min-width: 100% !important;
  max-width: 100% !important;
  table-layout: auto !important;
  border-collapse: collapse !important;
  background: #fff !important;
}

/* ✅ Min-width par cellule : déclenche un vrai overflow si le container est trop étroit */
/* Desktop : on laisse le tableau respirer, pas de min-width qui force l’overflow */
@media (min-width: 1024px){
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th,
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td,
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th:first-child,
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td:first-child,
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th:nth-child(3),
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td:nth-child(3){
    min-width: 0 !important;
	font-weight:normal!important
  }
}

/* Mobile : on garde une lisibilité minimale (scroll interne OK) */
@media (max-width: 1023px){
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th,
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td{
    min-width: 160px !important;
  }
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th:first-child,
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td:first-child{
    min-width: 170px !important;
  }
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th:nth-child(3),
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td:nth-child(3){
    min-width: 140px !important;
  }
}
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner tbody td{
	    line-height: 18px;
    padding-bottom: 19px;
    padding-top: 13px;
}
/* ✅ Colonne 1 souvent plus courte / “label” */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th:first-child,
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td:first-child{
  font-weight: 700;
}

/* ✅ Mobile: on réduit juste les min-width pour éviter un overflow trop violent */
@media (max-width: 480px){
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner{
    /*padding-bottom: 56px !important;*/
  }

  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner th,
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner td{
    min-width: 160px;
  }
}



/* Masquer le scrollbar natif seulement quand overflow (UI custom active) */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.has-x-overflow .table-scroll-inner{
  scrollbar-width: none !important;     /* Firefox */
  -ms-overflow-style: none !important;  /* Edge legacy */
}
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.has-x-overflow .table-scroll-inner::-webkit-scrollbar{
  height: 0 !important;                 /* Chrome/Safari */
}

/* =========================
   Custom scrollbar (track)
   ========================= */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scrollbar{
  position: absolute !important;
  left: 14px !important;
  right: 14px !important;
  bottom: 40px !important;

  height: 8px !important;
  border-radius: 999px !important;
  background: rgba(0,0,0,.10) !important;
  overflow: hidden !important;

  z-index: 2 !important;

  opacity: 0 !important;
  visibility: hidden;
  transform: translateY(4px) !important;
  transition: opacity .2s ease, transform .2s ease !important;

  pointer-events: none !important;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.has-x-overflow .csmk-scrollbar{
  opacity: 1 !important;
  visibility: visible;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scrollbar .csmk-scrollbar-thumb{
  height: 100% !important;
  width: 46px;
  border-radius: 999px !important;

  background: var(--csmk-table-scrollbar-color, #ff2b2b) !important;
  transform: translateX(0);

  transition: transform .06s linear, width .12s ease, background .15s ease !important;

  pointer-events: auto !important;
  touch-action: none !important;
  cursor: grab !important;
}
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.is-dragging .csmk-scrollbar .csmk-scrollbar-thumb{
  background: var(--csmk-table-scrollbar-color, #ff2b2b) !important;
  cursor: grabbing !important;
}

/* =========================
   Handle rouge “Glissez”
   ========================= */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scroll-hint{
  position: absolute !important;
  right: 12px !important;
  bottom: 0 !important;

  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;

  padding: 10px 14px !important;
  border-radius: 999px !important;

  background: var(--csmk-table-scrollbar-color, #ff2b2b) !important;
  color: #fff !important;

  box-shadow: 0 10px 22px rgba(0,0,0,.22) !important;

  z-index: 3 !important;

  pointer-events: auto !important;
  touch-action: none !important;

  user-select: none !important;
  -webkit-user-select: none !important;

  opacity: 0 !important;
  visibility: hidden;
  transform: translateY(6px) !important;
  transition: opacity .2s ease, transform .2s ease, background .15s ease, box-shadow .15s ease !important;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.has-x-overflow .csmk-scroll-hint{
  opacity: 1 !important;
  visibility: visible;
  transform: translateY(0) !important;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.is-dragging .csmk-scroll-hint{
  background: var(--csmk-table-scrollbar-color, #ff2b2b) !important;
  box-shadow: 0 14px 26px rgba(0,0,0,.28) !important;
}

/* Texte */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scroll-hint .csmk-hint-text{
  font-weight: 900 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  letter-spacing: .2px !important;
  white-space: nowrap !important;
}

/* Zone flèches ↔ */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scroll-hint .csmk-hint-arrows{
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  animation: csmkNudgeBoth 1.1s ease-in-out infinite !important;
}

/* Bulles flèches */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scroll-hint .csmk-hint-arrow{
  width: 28px !important;
  height: 28px !important;
  display: grid !important;
  place-items: center !important;

  border-radius: 999px !important;
  background: rgba(255,255,255,.18) !important;

  font-size: 16px !important;
  line-height: 1 !important;
}

@keyframes csmkNudgeBoth{
  0%   { transform: translateX(0); opacity: .85; }
  50%  { transform: translateX(8px); opacity: 1; }
  100% { transform: translateX(0); opacity: .85; }
}

@media (prefers-reduced-motion: reduce){
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scroll-hint .csmk-hint-arrows{
    animation: none !important;
  }
}

/* Mobile compact: juste l’UI du hint */
@media (max-width: 480px){
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scroll-hint{
    right: 10px !important;
    bottom: 0 !important;
    padding: 10px 14px !important;
  }
  :where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .csmk-scroll-hint .csmk-hint-text{
    font-size: 17px !important;
  }
}

/* Safety: if old JS still toggles .hint-hidden, keep handle visible while dragging */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll.hint-hidden.is-dragging .csmk-scroll-hint{
  opacity: 1 !important;
  visibility: visible;
  transform: translateY(0) !important;
}

/* =========================================================
   PATCH: ne JAMAIS dépasser 1100px en desktop (zéro scroll page)
   ========================================================= */
/* =========================================================
   1) STOP overflow-x global (filet de sécurité)
   ========================================================= */
html, body{
  max-width: 100% !important;
  overflow-x: hidden !important;
}

/* =========================================================
   2) Fix WordPress Admin Bar: screen-reader-text qui déborde
   (quand connecté)
   ========================================================= */
#wpadminbar .screen-reader-text,
#wpadminbar .screen-reader-text *{
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;

  /* double sécurité moderne + legacy */
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;

  white-space: nowrap !important;
  border: 0 !important;
}

/* IMPORTANT : on respecte l’accessibilité au focus (WP standard) */
#wpadminbar .screen-reader-text:focus{
  clip: auto !important;
  clip-path: none !important;
  height: auto !important;
  width: auto !important;
  overflow: visible !important;
  position: static !important;
  white-space: normal !important;
}

/* Empêche les enfants flex de dépasser (cause #1 des scrollbars horizontales fantômes) */
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll,
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner{
  min-width: 0 !important;
  max-width: 100% !important;
  display: block !important;
}


/* =========================
   Apparence des tableaux
   ========================= */
:root{
  --csmk-table-header-bg: #d3b588;
  --csmk-table-header-text: #ffffff;
  --csmk-table-row-odd-bg: #fbf8f2;
  --csmk-table-row-even-bg: #f2ede3;
  --csmk-table-title-color: #8a8172;
  --csmk-table-border-color: #d8d0c2;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .csmk-table-title{
  margin: 0 0 10px !important;
  font-size: .98rem !important;
  line-height: 1.35 !important;
  font-weight: 400 !important;
  color: var(--csmk-table-title-color) !important;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner table{
  background: #fff !important;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner thead th,
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner thead td{
  background: var(--csmk-table-header-bg) !important;
  color: var(--csmk-table-header-text) !important;
  font-weight: 400 !important;
  border: 1px solid var(--csmk-table-border-color) !important;
}

:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner tbody tr:nth-child(odd) td,
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner tbody tr:nth-child(odd) th{
  background: var(--csmk-table-row-odd-bg) !important;
}
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner tbody tr:nth-child(even) td,
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner tbody tr:nth-child(even) th{
  background: var(--csmk-table-row-even-bg) !important;
}
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner tbody td,
:where(body.coconsem, .entry-content, article.prose, .brz-root__container) .table-scroll .table-scroll-inner tbody th{
  border: 1px solid var(--csmk-table-border-color) !important;
  vertical-align: top !important;
}
