/* Basis, strak stijlen + sticky header en 3 vaste kolommen met kolomlijnen*/

/* Globale box-sizing en paginahoogte */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Basis typografie en kleuren */
:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.35;
}

/* Variabelen voor vaste kolombreedtes */
:root {
  /* meer = hogere kop */
  --thead-pad-y: 10px;
  --cell-pad-y: 10px;
  --col1: 100px;
  --col2: 84px;
  --col3: 76px;
  --line: #e5e5e5;
  --head-bg: #f8f8f8;
  --cell-bg: #ffffff;
  --hover-bg: #fafafa;
  --z-body-fixed: 2;
  --z-head: 3;
  --z-head-fixed: 4;
}

/* Pagina basis */
body {
  margin: 0;
  padding: 16px;
  background: #fff;
  color: #111;
}

/* Wrapper */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
}

/* Titel */
h1 {
  font-size: 1.25rem;
  margin: 0 0 12px 0;
  text-align: center;
}

/* Bovenbalk */
.bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
  margin: 10px 0 16px 0;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e6e6e6;
  color: #111;
  font-size: 0.9rem;
  margin-left: 8px;
}

/* Zoekveld */
input[type="search"] {
  padding: 8px 10px;
  border: 1px solid #bbb;
  border-radius: 8px;
  width: 100%;
  max-width: 200px;
  margin-bottom: 10px;
}

/* Scrollcontainer voor tabel (verticaal + horizontaal) */
.tablewrap {
  position: relative;
  width: 100%;
  max-height: 70vh;      /* hier begint verticaal scrollen binnen de container */
  overflow: auto;        /* tabel scrollt, header erboven blijft staan */
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
}

/* Tabelbasis */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* Tabelkop */
thead th {
  position: sticky;
  top: 0;
  background: var(--head-bg);
  z-index: var(--z-head);
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--line);
  padding: var(--thead-pad-y) 12px;
  line-height: 1.25;

  /* meerdere regels toegestaan */
  white-space: normal;
  /* breekt lange woorden/URL's */
  overflow-wrap: anywhere;
  /* laat normale woordbreking toe */
  word-break: normal;

  border-right: 1px solid var(--line);
  /* horizontaal centreren */
  text-align: center;
  /* verticaal centreren */
  vertical-align: middle;
}

/* Cellen */
tbody td {
  border-bottom: 1px solid #f1f1f1;
  padding: var(--cell-pad-y) 12px;
  line-height: 1.25;
  font-size: 0.95rem;
  background: var(--cell-bg);

  /* meerdere regels toegestaan */
  white-space: normal;
  /* breekt lange woorden/URL's */
  overflow-wrap: anywhere;
  /* laat normale woordbreking toe */
  word-break: normal;

  border-right: 1px solid var(--line);
  /* horizontaal centreren */
  text-align: center;
  /* verticaal centreren */
  vertical-align: middle;
}

/* Groter lettertype voor kolom Ranking */
tbody td.cell-ranking {
  font-size: 1.15rem;
  font-weight: 700;
}

/* Bold voor kolom Totaal punten */
tbody td.cell-total {
  font-weight: 700;
}


thead th:first-child,
tbody td:first-child {
  border-left: 1px solid var(--line);
}

tbody tr:hover {
  background: var(--hover-bg);
}

/* Kolombreedtes vaste kolommen */
thead th:nth-child(1),
tbody td:nth-child(1) {
  width: var(--col1);
  min-width: var(--col1);
  max-width: var(--col1);
}

thead th:nth-child(2),
tbody td:nth-child(2) {
  width: var(--col2);
  min-width: var(--col2);
  max-width: var(--col2);
}

thead th:nth-child(3),
tbody td:nth-child(3) {
  width: var(--col3);
  min-width: var(--col3);
  max-width: var(--col3);
  /* Rechter rand van kolom 3 dikker */
  border-right-width: 3px;
  border-right-color: black;
}

/* Kolombreedte voor alle kolommen vanaf 4 */
thead th:nth-child(n+4),
tbody td:nth-child(n+4) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
}

/* Sticky kolommen 1–3 */
thead th:nth-child(1),
tbody td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: var(--z-body-fixed);
  background: var(--cell-bg);
}

thead th:nth-child(2),
tbody td:nth-child(2) {
  position: sticky;
  left: var(--col1);
  z-index: var(--z-body-fixed);
  background: var(--cell-bg);
}

thead th:nth-child(3),
tbody td:nth-child(3) {
  position: sticky;
  left: calc(var(--col1) + var(--col2));
  z-index: var(--z-body-fixed);
  background: var(--cell-bg);
}

/* Kruisingen kop + vaste kolommen bovenop */
thead th:nth-child(1),
thead th:nth-child(2),
thead th:nth-child(3) {
  z-index: var(--z-head-fixed);
  background: var(--head-bg);
}

/* Toegankelijkheidsklasse */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hint-search, .hint {
  display: flex;
  justify-content: center;
  /* ruimte tussen de twee regels */
  gap: 8px;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;       
}

/* Hinttekst */
.hint p {
  font-size: 0.9rem;
  margin-top: 5px;
  margin-bottom: 5px;
}

/* Footer */
footer {
  font-size: 0.6rem;
  padding: 0px;
  text-align: center;
  border-top: 1px solid;
}

footer .author {
  font-weight: bold;
}

footer span {
  font-size: smaller;
}

/* Mobiele weergave: smallere kolommen + tekst nog leesbaar */
@media (max-width: 600px) {

  /* Op mobiel: lagere tabel zodat hint + footer in beeld kunnen blijven */
  .tablewrap {
    max-height: 60vh;
  }

  /* Iets minder page padding voor meer ruimte */
  body {
    padding: 6px;
  }

  /* Iets kleinere kop- en celhoogte en kolombreedtes */
  :root {
    --thead-pad-y: 6px;
    --cell-pad-y: 6px;
    --col1: 70px;
    --col2: 60px;
    --col3: 60px;
  }

  .hint {
    flex-direction: column;
    align-items: center;
    gap: 0;
    
  }

  .hint p {
    font-size: 0.6rem;
    margin-top: 0;
    margin-bottom: 0;
  }

  /* Kleinere tekst en minder horizontale padding in de tabel */
  thead th,
  tbody td {
    font-size: 0.6rem;
    padding-left: 4px;
    padding-right: 4px;
  }

  /* Op mobiel Ranking iets groter houden dan de rest */
  tbody td.cell-ranking {
    font-size: 0.8rem;
    font-weight: 700;
  }

  /* Totaal punten blijft bold op mobiel */
  tbody td.cell-total {
    font-weight: 700;
  }

  /* Alle kolommen vanaf 4 nog smaller zodat het geheel op mobiel beter past,
     teksten breken automatisch op meerdere regels */
  thead th:nth-child(n+4),
  tbody td:nth-child(n+4) {
    width: 45px;
    min-width: 45px;
    max-width: 45px;
  }
  
  /* Badge: statusregels onder elkaar tonen op mobiel */
  .badge {
    display: block;
    white-space: pre-line;
    margin-left: 0;
    margin-top: 4px;
  }

  /* Footer */
  footer {
    font-size: 0.5rem;
    padding: 0px;
    text-align: center;
    border-top: 1px solid;
  }

  footer .author {
    font-weight: bold;
  }

  footer span {
    font-size: smaller;
  }

  /* Latijnse tekst in de footer verbergen op mobiel */
  footer .latin {
    display: none;
  }
}
