/* =========================================================
   TABULATOR CORE
   ========================================================= */

.tabulator {
  position: relative;
  border: 1px solid #dee2e6;
  border-radius: 9px;
  background-color: #fff;
  font-size: 0.9375em;
  text-align: left;
  overflow: hidden;
  transform: translateZ(0);
}

.tabulator-tableholder {
  overflow: hidden;
  border: none;
}

.tabulator-header,
.tabulator-tableholder,
.tabulator-table {
  background-color: #fff;
}

.tabulator-header {
  border-top-left-radius: 9px;
  border-top-right-radius: 9px;
}

.tabulator-responsive-collapse {
  border-radius: 0 0 9px 9px;
}

@media (max-width: 767.98px) {
.tabulator .tabulator-footer .tabulator-footer-contents {
    padding: 0 10px 5px 10px;
}

.tabulator .tabulator-footer .tabulator-page {
    margin: 10px 5px 5px 5px;
/*    padding: 2px;*/
}
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title {
    padding-right: 15px
}

/* 1. SMALL SCREENS (Up to 767px): Hide First/Last, keep Numbers + Prev/Next */
@media (max-width: 767.98px) {
    .tabulator .tabulator-footer .tabulator-page[data-page="first"],
    .tabulator .tabulator-footer .tabulator-page[data-page="last"] {
        display: none !important;
    }
}

/* 2. EXTRA SMALL SCREENS (Up to 575px): Also hide Numbered buttons */
@media (max-width: 575.98px) {
    /* Target all buttons NOT named 'prev' or 'next' and hide them */
    .tabulator .tabulator-footer .tabulator-page:not([data-page="prev"]):not([data-page="next"]) {
        display: none !important;
    }

    /* Ensure Prev and Next remain visible and look like buttons */
    .tabulator .tabulator-footer .tabulator-page[data-page="prev"],
    .tabulator .tabulator-footer .tabulator-page[data-page="next"] {
        display: inline-block !important;
    }
}

/* =========================================================
   TABULATOR DENSITY MODES
   ========================================================= */
.tabulator-row .tabulator-responsive-collapse table {
    font-size: 0.9375rem;
}

.tabulator-responsive-collapse {
    border-radius: 0px;
}

.tabulator-density-compact .tabulator-row {
  min-height: 28px;
}

.tabulator-density-compact .tabulator-cell {
  padding: 0.25rem 0.5rem;
  font-size: 0.9375rem;
  line-height: 1.25;
  white-space: nowrap;
}

.tabulator-density-default .tabulator-row {
  min-height: 36px;
}

.tabulator-density-default .tabulator-cell {
  padding: 0.35rem 0.3rem;
  font-size: 1em;
  line-height: 1.5;
  white-space: nowrap;
}


.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: normal;
    vertical-align: bottom;
    white-space: normal;
    width: 100%;
}

/* Make header cell content vertically centered */
.tabulator-col .tabulator-col-content {
    display: flex;
    align-items: center;   /* vertical centering */
    height: 100%;
}

/* Ensure the title block can wrap */
.tabulator-col .tabulator-col-title {
    white-space: normal !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
    padding: 6px;
}

/* =========================================================
   FACETS PANEL
   ========================================================= */

.facets-panel {
  max-height: 100vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* =========================================================
   FACET BLOCK (CARD-LIKE)
   ========================================================= */

.facet-block {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  max-height: 300px;
  overflow: hidden;
  padding: 0;
}

/* SUMMARY (HEADER) */

.facet-block > summary {
  padding: 0.5rem 0.75rem;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.8125em;
}

.facet-block > summary:hover,
.facet-block[open] > summary {
  background-color: #e9ecef;
}

.facet-block > summary::-webkit-details-marker {
  display: none;
}

/* CHEVRON */
.facet-chevron-icon {
  width: 1rem;
  height: 1rem;
  display: inline-block;
  transition: transform 0.2s ease;
}

.facet-block[open] .facet-chevron-icon {
  transform: rotate(90deg);
}

/* =========================================================
   FACET BODY
   ========================================================= */
.facet-block[open] .facet-body {
  max-height: var(--facet-expanded-max-height, 200px);
  overflow-y: auto;
  padding-right: 4px;
  min-height: 130px;
}

.facet-block:not([open]) .facet-body,
.facet-block:not([open]) .facet-clear {
  display: none;
}

/* =========================================================
   FACET CONTENT
   ========================================================= */
.facet-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.facet-option {
  all: unset;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8125em;
}

.facet-option:hover {
  background-color: #f1f3f5;
}

.facet-option--active {
  background-color: #0d6efd;
  color: #fff;
}

.facet-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* META */

.facet-count {
  color: #6c757d;
}

.facet-clear {
  all: unset;
  font-size: 0.8rem;
  color: #0d6efd;
  cursor: pointer;
  margin: 0.25rem 0;
}

.facet-clear:hover {
  text-decoration: underline;
}

/* =========================================================
   SCROLLBARS
   ========================================================= */
.facet-body::-webkit-scrollbar,
.facets-panel::-webkit-scrollbar {
  width: 6px;
}

.facet-body::-webkit-scrollbar-thumb,
.facets-panel::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 4px;
}

/* =========================================================
   TABLE WRAPPER
   ========================================================= */
.table-responsive {
  background-color: #fff;
}

/* =========================================================
   SKELETON LOADER
   ========================================================= */
.facet-skeleton {
  height: 28px;
  border-radius: 0.25rem;
  background: linear-gradient(
    90deg,
    #e9ecef 25%,
    #f8f9fa 37%,
    #e9ecef 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  margin-bottom: 0.25rem;
}

@keyframes skeleton-loading {
  0%   { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}


/* Target the specific column class or all cells */
.text-wrap-column {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: anywhere;    /* Modern browsers */
    /* Break at any character if needed  word-break: break-all;*/
}

/* Ensure the anchor tag inside the formatter also respects wrapping */
.text-wrap-column a {
    white-space: normal !important;
    display: inline-block; /* Helps with multi-line click area */
    word-wrap: break-word;      /* Legacy support */
    overflow-wrap: anywhere;    /* Modern browsers */
    /* Break at any character if needed */
}

/* Tooltips in tabulator */
.tab-tooltip {
  position: absolute;
  background: #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  max-width: 260px;
  white-space: normal;
  z-index: 10000;
  pointer-events: none;
}

.text-wrap-column [data-tooltip] {
  cursor: pointer;
}
