/* Wiederverwendbare, progressiv erweiterte Datentabellen */

.od-data-table {
  min-width: 0;
  scroll-margin-top: 92px;
  border: 1px solid var(--cream-300);
  border-radius: 10px;
  background: rgb(255 253 248 / 96%);
  box-shadow: 0 3px 11px rgb(39 50 36 / 10%);
}

.od-data-table-toolbar {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--cream-300);
  background: linear-gradient(120deg, #fff, var(--cream-100));
}

.od-data-table-search-toggle,
.od-data-table-size select,
.od-data-table-search button,
.od-data-table-pagination button {
  min-height: 38px;
  border: 1px solid rgb(7 95 49 / 27%);
  border-radius: 7px;
  color: var(--green-900);
  background: #fff;
  font: inherit;
}

.od-data-table-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 750;
}

.od-data-table-search-toggle:hover,
.od-data-table-search-toggle[aria-expanded="true"],
.od-data-table-pagination button:hover:not(:disabled) {
  border-color: var(--gold);
  background: #fffaf0;
}

.search-icon {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid currentcolor;
  border-radius: 50%;
}

.search-icon::after {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: currentcolor;
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
}

.od-data-table-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.od-data-table-size select {
  min-width: 68px;
  padding: 5px 25px 5px 9px;
}

.od-data-table-search {
  padding: 13px 14px 14px;
  border-bottom: 1px solid var(--cream-300);
  background: #fffdf8;
}

.od-data-table-search > label {
  display: block;
  margin-bottom: 6px;
  color: var(--green-950);
  font-size: 0.78rem;
  font-weight: 750;
}

.od-data-table-search > div {
  display: flex;
  gap: 8px;
}

.od-data-table-search input {
  min-width: 0;
  min-height: 40px;
  flex: 1;
  padding: 8px 11px;
  border: 1px solid var(--cream-400);
  border-radius: 7px;
  color: var(--green-950);
  background: #fff;
  font: inherit;
}

.od-data-table-search input:focus,
.od-data-table-size select:focus,
.od-data-table button:focus-visible,
.od-data-table-viewport:focus-visible {
  outline: 3px solid rgb(221 163 0 / 32%);
  outline-offset: 2px;
}

.od-data-table-search button {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
}

.od-data-table-scroll-hint {
  display: none;
  margin: 0;
  padding: 7px 12px;
  color: var(--muted);
  background: #f8f5e9;
  font-size: 0.72rem;
}

.od-data-table-viewport {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
}

.od-data-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #20382a;
  font-size: 0.84rem;
}

.od-data-table th,
.od-data-table td {
  width: auto;
  height: auto;
  padding: 10px 11px;
  border-right: 1px solid rgb(215 209 190 / 62%);
  border-bottom: 1px solid #ddd7c5;
  line-height: 1.35;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
}

.od-data-table th:last-child,
.od-data-table td:last-child {
  border-right: 0;
}

.od-data-table thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  color: var(--green-950);
  background: #eaf0e5;
  box-shadow: inset 0 -1px 0 #ccd5c7;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
}

.od-data-table thead tr:nth-child(2) th {
  top: 37px;
}

.od-data-table tbody tr:nth-child(even) {
  background: rgb(232 239 226 / 42%);
}

.od-data-table tbody tr:hover {
  background: #fff8db;
}

.od-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.od-data-table tr[hidden] {
  display: none;
}

.od-data-table td:first-child,
.od-data-table th:first-child,
.od-data-table td:nth-last-child(-n + 2),
.od-data-table th:nth-last-child(-n + 2) {
  text-align: inherit;
}

.od-data-table td.is-number,
.od-data-table th.is-number {
  text-align: right;
  white-space: nowrap;
}

.od-data-table td.is-centered,
.od-data-table th.is-centered {
  text-align: center;
}

.od-data-table td.is-player {
  min-width: 160px;
  font-weight: 700;
}

.od-data-table td.is-player a,
.od-data-table .pair-link {
  color: var(--green-800);
  text-decoration: underline;
  text-decoration-color: rgb(7 95 49 / 35%);
  text-underline-offset: 3px;
}

.od-data-table td.is-player a:hover,
.od-data-table .pair-link:hover {
  color: var(--green-700);
  text-decoration-color: var(--gold);
}

.od-data-table .is-positive {
  color: #08783f;
  font-weight: 800;
}

.od-data-table .is-negative,
.od-data-table .is-incomplete {
  color: #a52d27;
  font-weight: 800;
}

.od-data-table .is-neutral {
  color: var(--muted);
}

.od-data-table tr.is-podium {
  background: linear-gradient(90deg, rgb(255 245 202 / 88%), rgb(255 253 248 / 88%));
}

.od-data-table .rank-medal {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgb(221 163 0 / 46%);
  border-radius: 50%;
  color: var(--green-950);
  background: #fff7d2;
  font-weight: 900;
}

.od-data-table .player-stars {
  margin-left: 6px;
  color: var(--gold);
  font-size: 0.86rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.od-data-table .calculation {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.od-data-table-empty {
  margin: 0;
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.od-data-table-footer {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-top: 1px solid var(--cream-300);
  background: linear-gradient(120deg, var(--cream-100), #fff);
}

.od-data-table-footer > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.od-data-table-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.od-data-table-pagination button {
  min-width: 38px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
}

.od-data-table-pagination button[aria-current="page"] {
  border-color: var(--green-800);
  color: #fff;
  background: var(--green-800);
}

.od-data-table-pagination button:disabled {
  cursor: default;
  opacity: 0.42;
}

.od-data-table-pagination .pagination-gap {
  display: inline-grid;
  min-width: 25px;
  place-items: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .od-data-table-scroll-hint {
    display: block;
  }
}

@media (max-width: 760px) {
  .od-data-table-toolbar,
  .od-data-table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .od-data-table-search-toggle,
  .od-data-table-size select,
  .od-data-table-search button,
  .od-data-table-pagination button {
    min-height: 44px;
  }

  .od-data-table-size {
    justify-content: space-between;
  }

  .od-data-table-search-toggle {
    justify-content: center;
  }

  .od-data-table-search > div {
    flex-direction: column;
  }

  .od-data-table th,
  .od-data-table td {
    padding: 9px 10px;
    font-size: 0.78rem;
  }

  .od-data-table-footer > p {
    text-align: center;
  }

  .od-data-table-pagination {
    justify-content: center;
  }
}
