:root {
  --main-color: #5d5dff;
  --accent-color: #ffc80a;
  --green-soft: #66cc66;
  --red-soft: #cc4444;
  --dark-bg: #000000;
  --light-text: #ffffff;
}



body {
  margin: 0;
  font-family: sans-serif;
  background-color: var(--dark-bg);
  color: var(--light-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  overflow-y: auto;
  transition: background-color 0.3s ease;
}

body.light {
  background-color: white;
  color: black;
}

#logo {
  width: 200px;
  margin-top: 20px;
  cursor: pointer;
}

#connection-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: red;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 10px;
}

#feedbackOverlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 4rem;
  z-index: 9999;
  display: none;
}

#feedbackOverlay.success {
  display: flex;
  background-color: #4caf50;
}

#feedbackOverlay.error {
  display: flex;
  background-color: #d32f2f;
}

#restartButton {
  margin-top: 20px;
  font-size: 1.5rem;
}

.hidden {
  display: none;
}

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 1em;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.filter-bar .input-field {
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.hidden {
  display: none;
}

/* Responsive fallback: filterbar wordt automatisch kolom bij small screens */
@media (max-width: 500px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

#reader {
  width: 100%;
  max-width: 320px;
  margin: 10px 0;
}

.input-field {
  font-size: 1.5em;
  padding: 10px;
  border-radius: 10px;
  border: none;
  margin: 10px 0;
  text-align: center;
  width: 220px;
  background: #222;
  color: white;
}

.input-field.small {
  font-size: 1em;
  width: 120px;
  padding: 6px;
}

.button {
  padding: 10px 20px;
  background-color: var(--main-color);
  color: white;
  font-size: 1.2em;
  border: none;
  border-radius: 10px;
  margin: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.button:hover {
  background-color: var(--accent-color);
  color: black;
}

#feedbackIcon {
  font-size: 6rem;
}

#feedbackMsg {
  font-size: 1.5rem;
  text-align: center;
  margin-top: 10px;
}


#feedback {
  font-size: 2em;
  margin: 20px;
  text-align: center;
  min-height: 60px;
}

#stats {
  font-size: 1.2em;
  margin: 10px;
}

.toggle-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  font-size: 14px;
}

input:checked + .slider {
  background-color: var(--green-soft);
}

.slider {
  background-color: #666;
}

.smallBtn {
  background-color: #ffcc00;
  border: none;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  color: black;
  border-radius: 4px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 20px;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: var(--main-color); /* 👈 nieuwe huisstijl */
}

input:checked + .slider:before {
  transform: translateX(20px);
}


table {
  width: 100%;
  max-width: 1000px;
  border-collapse: collapse;
  margin-top: 1em;
  table-layout: auto;
  font-size: 1.1em;
}

td, th {
  padding: 10px;
  text-align: left;
  word-break: break-word;
  border-bottom: 1px solid #444;
}

tr.scanned {
  background-color: var(--green-soft);
  color: black;
}

tr.not-scanned {
  background-color: var(--red-soft);
  color: white;
}

.html5qrcode-logo, .html5qrcode-canvas {
  position: relative;
}
.html5qrcode-video {
  object-fit: cover; /* zodat alles netjes schaalt */
}

input[type="checkbox"]:disabled + .slider {
  background-color: #888;
  cursor: not-allowed;
}

@keyframes flashGreen {
  0% { background-color: var(--green-soft); }
  100% { background-color: var(--dark-bg); }
}

@keyframes flashRed {
  0% { background-color: var(--red-soft); }
  100% { background-color: var(--dark-bg); }
}

body.success-flash {
  animation: flashGreen 0.7s ease-in-out;
}

body.error-flash {
  animation: flashRed 0.7s ease-in-out;
}

#reader-container {
  width: 300px;
  height: 300px;
  margin: 20px auto;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
}


#reader video {
  width: 300px !important;
  height: 300px !important;
  object-fit: cover;
  border-radius: 12px;
}

#reader {
  display: block;
  width: 300px;
  height: 300px;
  background-color: #111;
  position: relative;
}

#markerOverlay {
  position: absolute;
  top: 50%; left: 50%;
  width: 250px; height: 250px;
  transform: translate(-50%,-50%);
  border: 2px solid rgba(255,255,255,0.5);
  box-sizing: border-box;
  pointer-events: none;
}

.scan-count {
  margin: 10px 0;
  font-weight: bold;
  font-size: 16px;
}

body.error-scan {
  background-color: #400000 !important;
  transition: background-color 0.3s ease;
}

@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
    gap: 8px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
  }

  td, th {
    font-size: 14px;
    padding: 6px 8px;
  }

  .button.small {
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* ===========================================================
   ADMIN TABELLEN – NIEUW IN STYLES30
   =========================================================== */
.admin-table-wrapper {
  max-width: 1000px;
  margin: 0 auto 40px;
  padding: 0 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  table-layout: auto;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #444;
  word-break: break-word;
}

.admin-table th {
  background: #111;
  font-weight: 600;
}

.admin-table--center th,
.admin-table--center td {
  text-align: center;
}

.admin-table--center td:first-child {
  text-align: left;
  white-space: nowrap;
}

/* Scanners-lijst */
.scanner-list-table td:nth-child(1) { width: 70px; }
.scanner-list-table td:nth-child(3) { width: 120px; text-align: center; }

/* ===========================================================
   STATS PAGINA – NIEUW
   =========================================================== */
.stats-page {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 40px;
  padding: 0 16px;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.stats-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-container {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 20px auto;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

@media (max-width: 768px) {
  .stats-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-header-controls {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ===========================================================
   SCANNER EVENTS MATRIX – NIEUW
   =========================================================== */

.scanner-events-table {
  position: relative;
}

/* Sticky header */
.scanner-events-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #111;
}

/* Sticky eerste kolom */
.scanner-events-table th:first-child,
.scanner-events-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #000;
}

/* Datum/tijd onder titel */
.scanner-events-table th small {
  display: block;
  font-size: 11px;
  opacity: 0.7;
}

/* Hover highlight */
.scanner-events-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Kleinere checkboxes */
.scanner-events-table input[type="checkbox"] {
  transform: scale(1.1);
  margin: 4px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .scanner-events-table th,
  .scanner-events-table td {
    padding: 4px;
    font-size: 12px;
  }
}

/* ===========================================================
   FORM FIELD STYLE – NIEUW (ADMIN)
   =========================================================== */

.admin-table-wrapper select,
.admin-table-wrapper input[type="text"],
.admin-table-wrapper input[type="number"],
.admin-table-wrapper input[type="date"],
.admin-table-wrapper input[type="time"] {
  background: #222;
  color: white;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 1em;
  margin-left: 6px;
  min-width: 180px;
  outline: none;
  appearance: none;
}

.admin-table-wrapper select:focus,
.admin-table-wrapper input:focus {
  border-color: var(--main-color);
  box-shadow: 0 0 0 2px rgba(93,93,255,0.3);
}

.admin-table-wrapper select {
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='16' viewBox='0 0 20 20' width='16' xmlns='http://www.w3.org/2000/svg'><polygon points='0,0 20,0 10,12'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 35px;
}

.admin-table-wrapper input[type="checkbox"] {
  transform: scale(1.2);
  cursor: pointer;
}

.admin-table-wrapper label {
  color: white;
  font-size: 0.95rem;
}

.scanner-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 15px;
}

/* ===========================================================
   EXTRA TOGGLE SWITCH (NIEUW)
   =========================================================== */

.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #666;
  transition: .4s;
  border-radius: 34px;
}

.toggle .slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.toggle input:checked + .slider {
  background-color: var(--main-color);
}

.toggle input:checked + .slider:before {
  transform: translateX(22px);
}

.toggle:hover .slider {
  filter: brightness(1.15);
}
