/* Data- en hulpmiddelenpagina's */

.tools-page {
  background: var(--color-bg);
}

.tools-page .content {
  width: min(100% - 32px, var(--container-wide));
  margin-inline: auto;
  padding-block: clamp(26px, 4vw, 54px);
}

.tool-shell,
.tools-page .content > div:first-child:not(#example1) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tool-heading {
  margin-bottom: var(--space-5);
}

.tool-heading h1 {
  margin-bottom: 0;
}

.tool-heading p,
.tool-meta {
  color: var(--color-muted);
}

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 16px 0;
}

.tool-controls form,
.tool-select {
  display: flex;
  flex: 1 1 330px;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.tool-controls label,
.tool-select label {
  color: var(--color-dark);
  font-weight: 760;
}

.tool-controls select,
.tool-select select {
  flex: 1 1 260px;
  min-width: min(100%, 260px);
}

.tools-page .hide,
.tools-page .hide_rows {
  min-height: 42px;
  margin: 0;
  border-color: rgba(223, 169, 51, 0.28) !important;
  background: #fff8e7 !important;
  color: #76530c !important;
  box-shadow: none;
}

.tools-page .hide:hover,
.tools-page .hide_rows:hover {
  border-color: var(--color-gold) !important;
  background: #ffefbd !important;
  color: #583d08 !important;
}

.competition-name-filter {
  position: relative;
  margin-left: auto;
}

.competition-name-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-dark);
  font-size: 0.84rem;
  font-weight: 760;
  cursor: pointer;
  list-style: none;
}

.competition-name-filter summary::-webkit-details-marker {
  display: none;
}

.competition-name-filter summary::after {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin: -4px 3px 0 1px;
  border-right: 1.5px solid var(--color-muted);
  border-bottom: 1.5px solid var(--color-muted);
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.competition-name-filter[open] summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}

.competition-name-filter summary small {
  margin-left: auto;
  color: var(--color-muted);
  font-size: 0.7rem;
  font-weight: 650;
}

.competition-name-filter__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(330px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.competition-name-filter__actions {
  display: flex;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.competition-name-filter__actions button {
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  border-color: var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-blue-dark);
  font-size: 0.72rem;
  box-shadow: none;
}

.competition-name-filter__actions button:hover,
.competition-name-filter__actions button:focus-visible {
  transform: none;
  border-color: var(--color-blue);
  background: var(--color-blue-soft);
  color: var(--color-blue-dark);
  box-shadow: none;
}

.competition-name-filter__options {
  display: grid;
  gap: 3px;
  max-height: 280px;
  margin-top: 9px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.competition-name-filter__options label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  margin: 0;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.82rem;
  cursor: pointer;
}

.competition-name-filter__options label:hover {
  background: var(--color-blue-soft);
}

.competition-name-filter__options input {
  flex: 0 0 auto;
  width: 17px;
  min-height: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--color-blue-dark);
}

.tools-page .center {
  margin-inline: auto;
}

.tools-page #example1 {
  width: 100% !important;
  height: min(68vh, 760px) !important;
  min-height: 430px;
  margin: 16px 0 0 !important;
  border: 0;
  border-radius: 0;
  overflow: auto;
  background: var(--color-surface);
  box-shadow: none;
}

.tools-page .handsontable th {
  color: var(--color-dark);
  font-weight: 760;
}

.tools-page .handsontable td,
.tools-page .handsontable th {
  border-color: var(--color-border);
}

.tools-page img {
  border-radius: var(--radius);
}

.tool-description {
  max-width: 980px;
}

.tool-description h2 {
  margin: 28px 0 8px;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
}

.tool-description img {
  display: block;
  width: min(100%, 760px);
  margin: 18px 0;
  border: 0;
  box-shadow: none;
}

/* Speertijden */

.spear-times-wrap {
  margin-top: 18px;
}

.spear-times-table {
  min-width: 700px;
  margin: 0;
}

.spear-times-table th,
.spear-times-table td {
  padding: 11px 14px;
}

.spear-times-table tbody th {
  background: var(--color-surface);
  color: var(--color-dark);
  font-size: 0.9rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: none;
}

.spear-times-table tbody tr:hover th,
.spear-times-table tbody tr:hover td {
  background: #f5fafb;
}

.spear-times-table .spear-times__row--achieved th,
.spear-times-table .spear-times__row--achieved td {
  background: #eaf8f2;
}

.spear-times-table .spear-times__row--achieved:hover th,
.spear-times-table .spear-times__row--achieved:hover td {
  background: #dff3ea;
}

.spear-times__check {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-right: 7px;
  place-items: center;
  border-radius: 50%;
  background: #16845d;
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
}

.spear-times__distance,
.spear-times__time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.spear-times__target {
  color: var(--color-blue-dark);
  font-weight: 760;
}

/* Persoonlijke tijden en wedstrijdlimieten */

.tool-table-section {
  margin-top: 30px;
}

.tool-table-section h2 {
  margin: 0 0 12px;
  color: var(--color-dark);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.tool-section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tool-section-heading h2,
.tool-section-heading .hide {
  margin: 0;
}

.personal-times-table,
.personal-limits-table,
.competition-times-table {
  margin: 0;
}

.personal-times-table {
  min-width: 820px;
}

.personal-limits-table {
  min-width: 980px;
}

.competition-times-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.competition-times__col-name {
  width: 18%;
}

.competition-times__col-age {
  width: 8%;
}

.competition-times__col-distance {
  width: 11%;
}

.competition-times__col-stroke {
  width: 29%;
}

.competition-times-table--single .competition-times__col-metric {
  width: 17%;
}

.competition-times-table--double .competition-times__col-age {
  width: 7%;
}

.competition-times-table--double .competition-times__col-distance {
  width: 9%;
}

.competition-times-table--double .competition-times__col-stroke {
  width: 18%;
}

.competition-times-table--double .competition-times__col-metric {
  width: 12%;
}

.personal-times-table th,
.personal-times-table td,
.personal-limits-table th,
.personal-limits-table td,
.competition-times-table th,
.competition-times-table td {
  padding: 10px 12px;
}

.personal-times-table tbody th,
.personal-limits-table tbody th,
.competition-times-table tbody th {
  background: var(--color-surface);
  color: var(--color-dark);
  font-size: 0.88rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: none;
}

.personal-times__distance,
.personal-times__time,
.personal-times__date,
.competition-times__distance,
.competition-times__time,
.competition-times__age {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.personal-times-table .is-achieved,
.personal-limits-table .is-achieved,
.competition-times-table .is-achieved {
  background: #eaf8f2;
  color: #0d6847;
  font-weight: 760;
}

.personal-times-table .is-split {
  background: #fff8d8;
  color: #76530c;
}

.limit-comparison {
  min-width: 110px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.limit-comparison strong,
.limit-comparison__own {
  display: block;
}

.limit-comparison__own {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid currentColor;
  color: var(--color-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.competition-times-wrap,
.personal-times-wrap,
.personal-limits-wrap {
  margin-top: 14px;
}

.competition-times-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
}

.competition-times__event-distance,
.competition-times__event-stroke {
  position: sticky;
  z-index: 3;
  background: #f1f6f8;
}

.competition-times__event-distance {
  left: 0;
  width: 88px;
  min-width: 88px;
  text-align: center;
  white-space: nowrap;
}

.competition-times__event-stroke {
  left: 88px;
  width: 160px;
  min-width: 160px;
}

.competition-times-table thead .competition-times__event-distance,
.competition-times-table thead .competition-times__event-stroke {
  z-index: 5;
}

.competition-times__swimmer-heading,
.competition-times__swimmer-result {
  width: 164px;
  min-width: 164px;
  text-align: center;
}

.competition-times__swimmer-heading {
  vertical-align: bottom;
}

.competition-times__swimmer-heading span,
.competition-times__swimmer-heading small {
  display: block;
}

.competition-times__swimmer-heading span {
  color: var(--color-dark);
  font-size: 0.76rem;
  line-height: 1.25;
  text-transform: none;
}

.competition-times__swimmer-heading small {
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.competition-times__swimmer-result {
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

.competition-times__swimmer-result > strong,
.competition-times__swimmer-result > .competition-times__own {
  display: block;
}

.competition-times__swimmer-result > .competition-times__own,
.competition-times__pool-result .competition-times__own {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid currentColor;
  color: var(--color-muted);
  font-size: 0.76rem;
}

.competition-times__pool-result {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  align-items: baseline;
  padding: 5px;
  border-radius: 5px;
}

.competition-times__pool-result + .competition-times__pool-result {
  margin-top: 7px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

.competition-times__pool-result small {
  color: var(--color-muted);
  font-size: 0.66rem;
}

.competition-times__pool-result .competition-times__own {
  grid-column: 1 / -1;
}

.competition-times__empty {
  color: var(--color-faint);
}

.competition-times__swimmer {
  vertical-align: top;
  border-right: 1px solid var(--color-border);
  overflow-wrap: anywhere;
}

.competition-times__age {
  vertical-align: top;
  border-right: 1px solid var(--color-border);
  font-weight: 700;
}

.competition-times-table--hide-times .competition-times__own {
  display: none;
}

/* Wedstrijdinformatie */

.competition-info-wrap {
  margin-top: 18px;
}

.competition-info-table {
  min-width: 720px;
  margin: 0;
  table-layout: fixed;
}

.competition-info__col-name {
  width: 36%;
}

.competition-info__col-date {
  width: 16%;
}

.competition-info-table thead tr:first-child th:not(:first-child) {
  text-align: center;
}

.competition-info-table tbody th {
  background: var(--color-surface);
  color: var(--color-dark);
  font-size: 0.9rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: none;
}

.competition-info-table tbody td {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Clubrecords */

.records-heading,
.records-heading h1 {
  width: 100%;
  max-width: none;
}

.records-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 26px;
  margin: -4px 0 30px;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.records-filter-group {
  display: grid;
  gap: 7px;
}

.records-detail-filters {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.records-select-filter {
  display: grid;
  gap: 7px;
  margin: 0;
}

.records-select-filter select {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 7px 34px 7px 11px;
  border-color: var(--color-border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: 0.84rem;
}

.records-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.records-filter-submit,
.records-filter-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin: 0;
  padding: 7px 14px;
  border: 1px solid var(--color-blue-dark);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.records-filter-submit {
  background: var(--color-blue-dark);
  color: var(--color-white);
}

.records-filter-reset {
  background: var(--color-surface);
  color: var(--color-blue-dark);
}

.records-filter-submit:hover,
.records-filter-submit:focus-visible,
.records-filter-reset:hover,
.records-filter-reset:focus-visible {
  transform: none;
  border-color: var(--color-blue);
  background: var(--color-blue);
  color: var(--color-white);
  text-decoration: none;
}

.records-filter-label {
  color: var(--color-muted);
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.records-filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.records-filter-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.records-filter-option:hover,
.records-filter-option:focus-visible {
  border-color: var(--color-blue);
  background: var(--color-blue-soft);
  color: var(--color-blue-dark);
  text-decoration: none;
}

.records-filter-option.is-active {
  border-color: var(--color-blue-dark);
  background: var(--color-blue-dark);
  color: var(--color-white);
}

.records-empty {
  margin: 0;
  padding: 24px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-muted);
  text-align: center;
}

.records-table-shell,
.relay-record-group .table-scroll {
  overflow: auto;
  border-radius: 6px;
  background: var(--color-surface);
}

.records :is(th, td),
.records thead th:first-child,
.records thead th:last-child,
.records .stijl-header > * {
  border-radius: 0;
}

/* Aflossingsrecords */

.relay-record-groups {
  display: grid;
  gap: 24px;
}

.relay-record-group {
  min-width: 0;
}

.relay-records {
  min-width: 740px;
  margin: 0;
  table-layout: fixed;
}

.records .stijl-header > * {
  padding: 10px 12px;
  background: #e7f1f5;
  color: var(--color-blue-dark);
  font-size: 0.78rem;
  letter-spacing: 0.055em;
  text-align: left;
}

.records:not(.relay-records) .stijl-header > * {
  padding-block: 13px;
  font-size: 0.95rem;
  font-weight: 850;
  text-align: center;
}

.relay-records th,
.relay-records td {
  padding: 10px 12px;
  vertical-align: top;
}

.relay-records thead th {
  font-size: 0.7rem;
}

.relay-records__distance {
  width: 82px;
}

.relay-records tbody th.relay-records__distance {
  background: var(--color-surface);
  color: var(--color-blue-dark);
  font-size: 0.9rem;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: none;
}

.relay-record-entry {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 2px 0;
}

.relay-record-entry--current {
  margin: -4px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: rgba(250, 250, 0, 0.21);
}

.relay-record-entry__time {
  color: var(--color-dark);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.relay-record-entry__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.relay-record-entry__swimmers {
  display: grid;
  gap: 1px;
  padding-top: 7px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.8rem;
  line-height: 1.35;
}

.relay-record-entry__swimmers span:not(:last-child)::after {
  content: ",";
}

.relay-records__empty {
  display: grid;
  min-height: 92px;
  place-items: center;
  color: var(--color-muted);
  font-size: 1.2rem;
}

.legend-table {
  min-width: 0;
}

.legend-table th:first-child,
.legend-table td:first-child {
  width: 92px;
  text-align: center;
}

.legend-swatch {
  display: inline-block;
  width: 46px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
}

.legend-swatch--orange {
  background: #f0a443;
}

.legend-swatch--red {
  background: #e1645d;
}

.legend-swatch--outline {
  box-shadow: inset 0 0 0 3px #e1645d;
}

.legend-swatch--green {
  background: #66cf9c;
}

.legend-swatch--yellow {
  background: #f6dd68;
}

.tools-page iframe {
  width: 100%;
  min-height: 72vh;
  border: 0;
  border-radius: 0;
  background: var(--color-surface);
  box-shadow: none;
}

@media (max-width: 620px) {
  .tools-page .content {
    width: min(100% - 24px, var(--container-wide));
    padding-block: 24px 44px;
  }

  .tool-shell,
  .tools-page .content > div:first-child:not(#example1) {
    padding: 0;
    border-radius: 0;
  }

  .records-filter-bar {
    align-items: stretch;
    padding: 14px;
  }

  .records-filter-group {
    width: 100%;
  }

  .records-detail-filters {
    grid-template-columns: 1fr;
  }

  .records-filter-actions {
    flex-wrap: wrap;
  }

  .competition-name-filter {
    width: 100%;
    margin-left: 0;
  }

  .competition-name-filter__panel {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .tool-controls,
  .tool-controls form,
  .tool-select {
    align-items: stretch;
    flex-direction: column;
  }

  .tools-page .hide,
  .tools-page .hide_rows,
  .tool-controls select,
  .tool-select select {
    width: 100%;
  }

  .tools-page #example1 {
    height: 62vh !important;
    min-height: 390px;
  }

  .relay-records {
    min-width: 660px;
  }
}
