/* ColumnFilter – Excel-artige Spaltenfilter für DataTables (users/js/column-filter.js) */

/* --- Spaltenkopf --- */
table.dataTable thead th.cf-th {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  padding-right: 8px !important;
  white-space: nowrap;
}
table.dataTable thead th.cf-th:before,
table.dataTable thead th.cf-th:after {
  display: none !important; /* Standard-Sortierpfeile von DataTables ausblenden */
}
table.dataTable thead th.cf-th.sorting,
table.dataTable thead th.cf-th.sorting_asc,
table.dataTable thead th.cf-th.sorting_desc {
  padding-right: 8px !important;
}
table.dataTable thead th.cf-th:hover,
table.dataTable thead th.cf-th.cf-open {
  background-color: #f2f4f7;
}
.cf-th-inner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
}
.cf-th-icons {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75em;
}
.cf-th-icons .cf-sort {
  color: #2c2629;
  display: none;
}
.cf-th-icons .cf-sort.is-active {
  display: inline-block;
}
.cf-th-icons .cf-filter {
  color: #c9cbd0;
}
.cf-th-icons .cf-filter.is-active {
  color: hsl(217, 71%, 53%);
}

/* --- Popover --- */
.cf-popover {
  position: absolute;
  z-index: 1100;
  width: 320px;
  max-width: calc(100vw - 16px);
  background: #fff;
  border: 1px solid #dbdbdb;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(10, 10, 10, 0.15);
  font-size: 0.9rem;
  display: none;
}
.cf-popover.is-open {
  display: block;
}
.cf-popover .cf-section {
  padding: 8px 10px;
  border-bottom: 1px solid #ededed;
}
.cf-popover .cf-section:last-child {
  border-bottom: 0;
}
.cf-popover .cf-title {
  font-weight: 600;
  color: #2c2629;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cf-popover .cf-close {
  cursor: pointer;
  color: #7a7a7a;
  padding: 6px;
}
.cf-sort-row {
  display: flex;
  gap: 6px;
}
.cf-sort-row .button {
  flex: 1;
  justify-content: flex-start;
}
.cf-sort-row .button.is-active {
  background-color: hsl(217, 71%, 53%);
  border-color: transparent;
  color: #fff;
}
.cf-list-items {
  max-height: 40vh;
  overflow-y: auto;
  margin-top: 4px;
  -webkit-overflow-scrolling: touch;
}
.cf-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  min-height: 40px; /* Tablet: gut antippbar */
  cursor: pointer;
  border-radius: 4px;
}
.cf-item:hover {
  background: #f5f5f5;
}
.cf-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: none;
}
.cf-item-all {
  border-bottom: 1px solid #ededed;
  font-weight: 600;
  border-radius: 0;
}
.cf-item .cf-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cf-list-empty {
  color: #7a7a7a;
  padding: 10px 6px;
  font-style: italic;
}
.cf-range {
  display: flex;
  gap: 6px;
  align-items: center;
}
.cf-range .field {
  flex: 1;
  margin-bottom: 0 !important;
}
.cf-range .label {
  font-size: 0.75rem;
  margin-bottom: 2px;
  color: #7a7a7a;
}
.cf-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.cf-footer {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.cf-popover .input,
.cf-popover .button {
  min-height: 36px;
}

/* --- Toolbar über der Tabelle --- */
.cf-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 10px;
  border-bottom: 1px solid #ededed;
  margin-bottom: 8px;
}
.cf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-height: 32px;
}
.cf-chips .tags {
  margin-bottom: 0 !important;
}
.cf-chips .tags .tag {
  margin-bottom: 0 !important;
  height: 2em;
}
.cf-chips .tag.is-delete {
  cursor: pointer;
}
.cf-chips .tag.cf-chip-value {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  line-height: 2em;
}
.cf-chips .cf-chip-value:hover {
  text-decoration: underline;
  cursor: pointer;
}
.cf-chips-empty {
  color: #7a7a7a;
  font-size: 0.85rem;
  align-self: center;
}
.cf-actions {
  display: flex;
  gap: 6px;
  flex: none;
}
.cf-columns .dropdown-content {
  max-height: 60vh;
  overflow-y: auto;
  min-width: 220px;
}
.cf-columns .dropdown-item.cf-item {
  min-height: 38px;
  padding: 0 12px;
}
.cf-columns .dropdown-item.cf-columns-default {
  border-top: 1px solid #ededed;
  color: hsl(217, 71%, 53%);
  cursor: pointer;
}

/* --- Gespeicherte Filter --- */
.cf-views-label {
  display: inline-block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.cf-views .dropdown-content {
  min-width: 280px;
  max-width: 360px;
  max-height: 60vh;
  overflow-y: auto;
}
.cf-views .dropdown-item {
  white-space: nowrap;
}
/* Eine Zeile: Name links (füllt), Mistkübel ganz rechts.
   Selektoren bewusst spezifisch, damit Bulma/Bootstrap (.dropdown-item { display: block })
   sie nicht überschreiben. */
.cf-views .dropdown-content .dropdown-item.cf-view-item {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px; /* Tablet: gut antippbar */
  padding: 2px 8px 2px 12px;
}
.cf-views .dropdown-content .dropdown-item.cf-view-item.is-active {
  background-color: #eef3fc;
}
.cf-views .cf-view-item .cf-view-load {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 40px;
  color: #2c2629;
  text-decoration: none;
}
.cf-views .cf-view-item .cf-view-load:hover {
  color: hsl(217, 71%, 45%);
}
.cf-views .cf-view-item.is-active .cf-view-load {
  font-weight: 600;
  color: hsl(217, 71%, 45%);
}
.cf-views .cf-view-item .cf-view-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cf-views .cf-view-item .button.cf-view-delete {
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
}
.cf-views .dropdown-content a.dropdown-item.cf-view-save {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-right: 1rem;
  color: hsl(217, 71%, 45%);
  text-decoration: none;
}
.cf-views-empty {
  color: #7a7a7a;
  font-style: italic;
}

/* Tablet: Toolbar umbrechen, wenn es eng wird */
@media screen and (max-width: 1023px) {
  .cf-toolbar {
    flex-wrap: wrap;
  }
  .cf-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* --- Kompaktmodus (enge Layouts, z.B. DocuFlow neben PDF-Vorschau) ---
   Buttons nur mit Icon (Beschriftung im title), Chips schmaler, alles darf umbrechen. */
.cf-toolbar.cf-compact {
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 6px;
}
.cf-toolbar.cf-compact .cf-btn-text,
.cf-toolbar.cf-compact .cf-views-label {
  display: none;
}
.cf-toolbar.cf-compact .cf-views-button.has-view .cf-views-label {
  display: inline-block;
  max-width: 110px;
  margin-left: 4px;
  font-size: 0.8rem;
}
.cf-toolbar.cf-compact .cf-actions {
  width: auto;
  margin-left: auto;
  gap: 4px;
}
.cf-toolbar.cf-compact .cf-chips {
  min-height: 30px;
  gap: 4px;
}
.cf-toolbar.cf-compact .cf-chips .tags .tag {
  font-size: 0.7rem;
}
.cf-toolbar.cf-compact .cf-chips .tag.cf-chip-value {
  max-width: 160px;
}
.cf-toolbar.cf-compact .cf-chips-empty {
  font-size: 0.8rem;
}
