/*
 * Stijlen voor ParedisPro.
 * De applicatie gebruikt een eenvoudige lay‑out met drie tabs.
 * Binnen de tijdwaarneming staan de resultaten en startlijst naast elkaar.
 */

/*
 * Kleuren voor ParedisPro dark theme
 * Gebaseerd op de aangeleverde palet:
 *  - Achtergrond: #0B0B0D
 *  - Surface/kaarten: #121316
 *  - Tekst primair: #E9E9EE
 *  - Tekst secundair: #A8ACB3
 *  - Accent: #4DB6AC (teal)
 *  - Randen: #23252B
 */

:root {
  /* Licht thema voor de adminmodule met accentkleur uit het display */
  --bg: #ffffff;            /* achtergrond */
  --surface: #f7f9fc;       /* kaarten en formulieren */
  --text-primary: #212529;  /* primaire tekstkleur */
  --text-secondary: #6c757d;/* secundaire/muted tekst */
  --accent: #4db6ac;        /* teal accentkleur overgenomen van display */
  --border: #dee2e6;        /* randen en tabelkop */
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
}

.app-header {
  background-color: var(--surface);
  color: var(--text-primary);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

/* Navigatie tabs */
.app-header nav .tab {
  background: none;
  border: none;
  color: var(--text-primary);
  margin-left: 0.5rem;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-size: 0.9rem;
}
.app-header nav .tab:hover {
  color: var(--accent);
}
.app-header nav .tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

/* Zoekdropdown: container en items. Gebruikt in plaats van de browser datalist. */
.search-container {
  position: relative;
}
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--surface);
  border: 1px solid var(--border);
  z-index: 1000;
  max-height: 12rem;
  overflow-y: auto;
  display: none;
}
.search-option {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}
.search-option:hover {
  background-color: var(--border);
}

/* Weergave van vorige en volgende combinatie in de tijdwaarneming. Maak er een
   compacte kaart van met subtiele rand en achtergrond, zodat het aansluit
   bij de moderne look. */
.prev-next-display {
  margin-top: 0.5rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 0.85rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.prev-next-display div {
  flex: 1 1 200px;
}

main {
  padding: 1rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

form {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

form label {
  flex: 1 1 200px;
  font-size: 0.9rem;
}

form input {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 0.3rem;
  background-color: var(--bg);
  color: var(--text-primary);
}

form button {
  background-color: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

form button:hover {
  /* Gebruik een lichtere tint van de teal accentkleur voor hover. */
  background-color: #5ebdb4;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--surface);
  color: var(--text-primary);
}

th, td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
}

thead th {
  background-color: var(--border);
  text-align: left;
}

tbody tr:nth-child(odd) {
  background-color: var(--bg);
}

tbody tr:nth-child(even) {
  background-color: var(--surface);
}

/* Stijl voor het totaaloverzicht in de financiën. Zorg voor compacte tabellen met
   donkere achtergrond en duidelijke kolomkoppen. */
.finance-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}
.finance-summary-table th,
.finance-summary-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
}
.finance-summary-table thead th {
  background-color: var(--border);
}
.finance-summary-table tbody tr:nth-child(odd) {
  background-color: var(--bg);
}
.finance-summary-table tbody tr:nth-child(even) {
  background-color: var(--surface);
}

/* Kleine knoppen voor edit/delete */
.edit-btn, .delete-btn {
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  color: #fff;
  margin-right: 0.3rem;
}

.edit-btn {
  background-color: #0d6efd;
}
.edit-btn:hover {
  background-color: #0b5ed7;
}
.delete-btn {
  background-color: #dc3545;
}
.delete-btn:hover {
  background-color: #bb2d3b;
}

/* Knoppen om combinaties omhoog/omlaag te verschuiven in de startlijst */
.move-btn {
  border: none;
  background-color: #6c757d;
  color: #fff;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  margin-right: 0.2rem;
}
.move-btn:hover {
  background-color: #5a6268;
}

/* Controls voor tijdwaarneming */
.time-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.time-controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.time-controls select,
.time-controls input {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 120px;
}

.time-controls button {
  background-color: #0dcaf0;
  color: #fff;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.time-controls button:hover {
  background-color: #0ba5c4;
}

/* Instellingen‑tandwielknop */
.settings-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  margin-left: 0.5rem;
}
.settings-btn:hover {
  color: #0d6efd;
}

/* Instellingen modal: bedekt het scherm met een halftransparante achtergrond */
.settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}
.settings-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.settings-content h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.settings-content label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}
.settings-content input,
.settings-content select {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}
.settings-content button {
  background-color: #0dcaf0;
  color: #fff;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.settings-content button:hover {
  background-color: #0ba5c4;
}

/* Weergave van de huidige combinatie in de tijdwaarneming */
/* Weergave van de geselecteerde combinatie in de tijdwaarneming */
.selected-combo-display {
  margin-bottom: 1rem;
}

.current-combo-rider {
  /* Maak de ruiterweergave extra groot zodat die duidelijker is dan de overige timers */
  font-size: 2.2rem;
  font-weight: bold;
  color: #212529;
}

.current-combo-horse {
  /* Plaats het paard onder de ruiter in een kleinere en grijze stijl */
  font-size: 1.3rem;
  color: #6c757d;
  margin-top: 0.2rem;
}

#serial-status {
  font-weight: bold;
  margin-left: 0.5rem;
}

/* Tijd informatie */
.timer-display {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  background-color: #fff;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.timer-display div {
  font-size: 0.9rem;
}

/* Maak de lopende tijd groter en duidelijker zichtbaar */
#display-running {
  font-size: 2.4rem;
  font-weight: bold;
  /* Gebruik de primaire tekstkleur zodat deze duidelijk is tegen de donkere achtergrond */
  color: var(--text-primary);
  display: block;
  text-align: left;
}

/* Puntenweergave duidelijk en groot */
#display-points {
  font-size: 2rem;
  font-weight: bold;
  /* Gebruik accentkleur voor puntenweergave zodat deze opvalt */
  color: var(--accent);
  display: block;
  text-align: left;
}

/* Afteltijd duidelijk tonen met iets grotere en rode kleur */
#display-countdown {
  font-size: 1.5rem;
  font-weight: bold;
  color: #d9534f; /* rood om aandacht te trekken */
}

/* Actieknoppen en status */
.time-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.time-actions button {
  background-color: #ffc107;
  color: #212529;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.time-actions button:hover {
  background-color: #e0a800;
}

.time-actions label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.time-actions select {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Straf‑inputs */
.penalty-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.penalty-inputs label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.penalty-inputs input {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 120px;
}

.penalty-inputs button {
  background-color: #198754;
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.penalty-inputs button:hover {
  background-color: #157347;
}

/* Lay‑out voor resultaten en startlijst */
.timing-lists {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.results-container,
.startlist-container {
  flex: 1 1 300px;
  min-width: 280px;
}

.results-container h3,
.startlist-container h3 {
  margin-top: 0;
  font-size: 1rem;
}

/* Overzichtstabel */
.results-controls {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.results-controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.results-controls select {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 150px;
}

.results-controls button {
  background-color: #0dcaf0;
  color: #fff;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.results-controls button:hover {
  background-color: #0ba5c4;
}

/* Export/print sectie in tijdwaarneming */
.export-controls {
  margin-top: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.export-controls h3 {
  margin: 0;
  margin-right: 1rem;
  font-size: 1rem;
}
.export-controls button {
  background-color: #6f42c1;
  color: #fff;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}
.export-controls button:hover {
  background-color: #5a32a3;
}

/*
 * Maak afgereden combinaties (reeds gefinished) in de startlijst lichtgrijs.
 * De class 'completed-start' wordt toegevoegd via JavaScript wanneer er een resultaat bestaat.
 */
.startlist-container table tbody tr.completed-start td {
  color: #6c757d;
}

/* ====================== Financiële modal ========================= */
.finance-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}
.finance-modal.show {
  display: flex;
}
.finance-modal-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  position: relative;
}
.finance-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 24px;
  cursor: pointer;
}
.finance-modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
}
.finance-modal-actions button {
  margin-right: 0.5rem;
}
.finance-modal-add {
  margin-top: 1rem;
}
.finance-modal-add input {
  width: 120px;
  margin-right: 0.5rem;
}
.finance-modal-summary, .finance-modal-transactions {
  margin-top: 1rem;
}

/* ====================== Resultaat modal ========================= */
/* Pop‑up venster om een resultaat te wijzigen. Vergelijkbaar met de
   financiële modal maar met eigen classes zodat stijlen gescheiden
   blijven. */
.result-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
  justify-content: center;
  align-items: center;
}
.result-modal.show {
  display: flex;
}
.result-modal-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  position: relative;
}
.result-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 24px;
  cursor: pointer;
}
.result-modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}
.result-modal-actions button {
  margin-left: 0.5rem;
}

/* ====================== Financiële rijkleuren ========================= */
/* Kleuring van afrekeningen: rood als ruiter nog moet betalen; groen als
   ruiter geld ontvangt van de organisatie. */
#finance-invoices table tbody tr.owe td {
  background-color: #ffe6e6;
}
#finance-invoices table tbody tr.credit td {
  background-color: #e6ffe6;
}

/* ====================== HC‑resultaten ========================= */
/* Voor Buiten wedstrijd (HC) resultaten willen we een lichtgrijze kleur en
   lichtere tekst tonen om te benadrukken dat ze buiten competitie vallen. */
#results-table tbody tr.hc td {
  background-color: #f2f2f2;
  color: #6c757d;
}

/* Geef ook HC-rijen in de live resultaten een lichtgrijze kleur. */
#live-results-table tbody tr.hc td {
  background-color: #f2f2f2;
  color: #6c757d;
}

/* ====================== Prijzengeld modal ========================= */
/* Deze modal lijkt qua stijl op de andere modals. Hij wordt gebruikt om
   prijzengeld te verdelen over de winnende combinaties. */
.prize-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 4000;
  justify-content: center;
  align-items: center;
}
.prize-modal.show {
  display: flex;
}
.prize-modal-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  position: relative;
}
.prize-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 24px;
  cursor: pointer;
}
.prize-modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}
.prize-modal-actions button {
  margin-left: 0.5rem;
  background-color: #198754;
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.prize-modal-actions button:hover {
  background-color: #157347;
}

/* ======= Prijzengeld actie modal ======= */
.prize-action-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 5000;
}
.prize-action-modal.show {
  display: flex;
}
.prize-action-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.prize-action-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 24px;
  cursor: pointer;
}
.prize-action-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.prize-action-buttons button {
  flex: 1;
  background-color: #198754;
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.prize-action-buttons button:hover {
  background-color: #157347;
}

/* Tweed kolommen in prize modal: geef inputs een vaste breedte zodat percentages en bedragen netjes uitlijnen */
#prize-modal-table input[type="number"] {
  width: 5rem;
  padding: 0.2rem;
}

/* Fieldsets in instellingen voor seriële kanalen en bel */
.serial-settings, .bell-settings {
  border: 1px solid #ddd;
  padding: 0.5rem;
  margin-top: 0.5rem;
}
.serial-settings legend, .bell-settings legend {
  font-weight: bold;
  margin-bottom: 0.3rem;
}

/* Handle kolom in de startlijsten tabel. Deze kolom bevat drie streepjes (hamburger) om
   een combinatie via drag‑and‑drop te verplaatsen. */
.handle-col {
  width: 1.5em;
  text-align: center;
  cursor: move;
  user-select: none;
  font-size: 1.2em;
  line-height: 1;
}

/* =============== Modal voor het plakken van startlijsten (Excel) ================= */
.paste-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2100;
  justify-content: center;
  align-items: center;
}
.paste-modal.show {
  display: flex;
}
.paste-modal-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  position: relative;
}
.paste-modal-close {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  font-size: 1.5rem;
  cursor: pointer;
}
.paste-modal-actions button {
  margin-left: 0.5rem;
}

/* Profile edit modal styles */
.profile-edit-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2200;
  justify-content: center;
  align-items: center;
}
.profile-edit-modal.show {
  display: flex;
}
.profile-modal-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 80%;
  overflow-y: auto;
  position: relative;
}
.profile-modal-close {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  font-size: 1.5rem;
  cursor: pointer;
}
.profile-modal-content form label {
  display: block;
  margin-bottom: 0.5rem;
}
.profile-modal-content input,
.profile-modal-content select {
  width: 100%;
  padding: 0.3rem;
  margin-top: 0.2rem;
  box-sizing: border-box;
}
.profile-modal-content button {
  margin-right: 0.5rem;
}