/* Datatable, Treetable */

body .ui-datatable,
body .dashboard .ui-datatable {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: none;
}
.bgs-top-scrollbar {
  overflow-x: auto;
  overflow-y: hidden;
  height: 15px;
  background: #fff;
}
.bgs-top-scrollbar > div {
  height: 1px;
}
body .ui-datatable table {
  table-layout: auto;
}
body .ui-datatable.table-layout-fixed table {
  table-layout: fixed;
}

body .ui-datatable.NoColumnHeader thead {
  display: none;
}

body .ui-datatable .ui-datatable-header {
  border-width: 0 0 1px 0;
  border-color: #c2c2c2;
}

body .table-header {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  font-weight: 600;
}

body .table-header .table-header-buttons {
  display: flex;
  gap: 1rem;
}

body .ui-datatable thead th,
body .ui-datatable thead th.ui-state-active {
  background: white;
  vertical-align: top;
}

body .ui-datatable thead th .ui-sortable-column-icon {
  color: #adb5bd;
}
/* Sort icon is a sibling after the header facet content; a stacked facet (label + filter) is block-level and pushes it below, so pin it to the top-right only for those headers. */
body .ui-datatable thead th.ui-sortable-column:has(.table-header-stack) {
  position: relative;
  padding-right: 2rem;
}
body .ui-datatable thead th.ui-sortable-column:has(.table-header-stack) .ui-sortable-column-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin: 0;
}
body .ui-datatable thead th.ui-state-active .ui-sortable-column-icon {
  color: inherit;
}
body .ui-datatable thead th.ui-sortable-column.ui-state-focus {
  box-shadow: none;
}

/* Der Wrapper scrollt selbst horizontal und vertikal, damit die fixierte Kopfzeile an den Spalten ausgerichtet bleibt (PrimeFaces stickyHeader funktioniert mit horizontalem Scrollen nicht). */
body .ui-datatable.table-sticky-header .ui-datatable-tablewrapper {
  overflow: auto;
  max-height: calc(100vh - 8rem);
}
body .ui-datatable.table-sticky-header thead th,
body .ui-datatable.table-sticky-header thead th.ui-sortable-column:has(.table-header-stack) {
  position: sticky;
  top: 0;
  z-index: 2;
  /* Innerer Schatten statt border-bottom, da Rahmen bei sticky Zellen mit border-collapse nicht mitwandern. */
  box-shadow: inset 0 -1px 0 #ced4da;
}

body .ui-datatable .ui-datatable-data > tr:last-child > td {
  border: none;
}

body .ui-datatable.ui-datatable-sm .ui-datatable-data > tr > td {
  padding: 0.75rem 0.5rem;
}

body .ui-datatable .ui-datatable-data > tr > td,
body .ui-datatable .ui-datatable-data > tr > td a {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

body .ui-datatable .ui-datatable-data > tr > td.nowrap {
  white-space: nowrap;
}

body .ui-datatable .ui-datatable-data > tr > td a[href^="mailto:"] {
  color: var(--bgs-begasoft-blue, #004388);
  overflow-wrap: anywhere;
  word-break: normal;
}

body .ui-datatable .ui-datatable-data > tr > td a[href^="mailto:"]:hover,
body .ui-datatable .ui-datatable-data > tr > td a[href^="mailto:"]:focus {
  color: #00305f;
  text-decoration: underline;
}

/* Special Columns */
body .ui-datatable thead th.ColumnBoolean {
  width: 80px;
}

body .ui-datatable tbody td.ColumnBoolean {
  width: 80px;
}

body .ui-datatable thead th.ColumnTextXL {
  width: 18%;
  min-width: 16rem;
}

body .ui-datatable tbody td.ColumnTextL {
  width: 16%;
  min-width: 14rem;
}

th.shrink,
td.shrink {
  white-space: nowrap;
  width: 1%; /* forces the column to shrink to its minimal content width */
}

/* Paginator */
body .ui-datatable .ui-paginator {
  padding: 1rem 0.75rem;
}
body .ui-datatable .ui-paginator.ui-paginator-bottom {
  border: none;
}

body .ui-paginator .ui-paginator-pages .ui-paginator-page.ui-state-active {
  background-color: white;
  font-weight: 700;
  color: var(--text-color);
}

body .ui-datatable .ui-datatable-data > tr.ui-state-highlight {
  color: #494f57;
  background-color: #eef8f3;
}

body .ui-datatable thead th .table-header-stack {
  min-height: 6rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

body .ui-datatable thead th .table-header-stack .ui-column-filter {
  margin-top: auto;
}

/* Dossieranforderungen: kompakte, innerhalb des Viewports scrollbare Detailansicht */
body .dossier-anforderungen-overlay {
  max-width: min(48rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

/* Trennt die Minimalanforderungen optisch von den Maximalpunkte-Rubriken */
body .dossier-anforderungen-overlay hr.anforderung-gruppentrennung {
  border-top-color: #6c757d;
  border-top-width: 2px;
}

/* Special Table  dossierabschluss und checkBildungsanforderungen */
body #formSearchResult\:tableSearchResult_data .green-row {
  background-color: #e1f8e9;
}

body #formSearchResult\:tableSearchResult_data .red-row {
  background-color: #fdecec;
}

body #formSearchResult\:tableSearchResult_data .white-row {
  background-color: white;
}
