/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 16px;
  min-height: 100vh;
  background-color: #f0f2f5;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: #222;
  font-size: 15px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 24px 0;
  color: #1a1a2e;
}

h2 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #999;
  margin: 0 0 14px 0;
}

a {
  color: #4d8f5a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 20px 0;
}

/* === Card === */
#content {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  padding: 32px 36px 36px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 20px rgba(0,0,0,0.07);
}

/* === Inputs === */
input[type="time"],
input[type="number"],
input[type="text"] {
  border: 1.5px solid #dde0e6;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #222;
  background: #fff;
  transition: border-color 0.15s;
}

input[type="time"]:focus,
input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #6aaa74;
}

input[type="time"]   { width: 130px; }
input[type="number"] { width: 64px; }
input[type="text"]   { width: 200px; }

/* === Startzeit-Zeile === */
.start-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: #555;
}

#btn-jetzt {
  background: #eef6ef;
  color: #4d8f5a;
  border: 1.5px solid #c6e0cb;
  border-radius: 7px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

#btn-jetzt:hover {
  background: #6aaa74;
  color: #fff;
  border-color: #6aaa74;
}

/* === Prüfungsteil-Blöcke (Konfigurationsseite) === */
#teile-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.teil-block {
  background: #f8f9fb;
  border: 1.5px solid #e4e7ed;
  border-radius: 10px;
  padding: 14px 16px 12px;
}

.teil-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.teil-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #999;
}

.teil-fields {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  color: #555;
  font-size: 0.95rem;
}

.teil-fields label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-remove-teil {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 0.9rem;
  padding: 3px 7px;
  border-radius: 5px;
  transition: color 0.15s, background-color 0.15s;
  line-height: 1;
}

.btn-remove-teil:hover {
  color: #fff;
  background-color: #e05050;
}

#btn-add-teil {
  width: 100%;
  background: #fff;
  color: #888;
  border: 1.5px dashed #d0d4da;
  border-radius: 10px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
  margin-top: 4px;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

#btn-add-teil:hover {
  border-color: #6aaa74;
  color: #4d8f5a;
  background: #f5fbf6;
}

/* === Version === */
#version {
  text-align: right;
  font-size: 0.75rem;
  color: #bbb;
  margin: 0 0 6px 0;
  padding: 0;
}

/* === Einstellungen === */
#Einstellungen {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #eee;
}

.setting-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

/* === Footer-Link === */
.footer-link {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #eee;
  font-size: 0.875rem;
  color: #aaa;
  line-height: 1.6;
}

/* === Start-Button === */
#start {
  display: block;
  width: 100%;
  margin-top: 28px;
  padding: 13px;
  background: #6aaa74;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 0.15s;
}

#start:hover {
  background: #559960;
}

/* === Overlay === */
.overlay {
  position: fixed;
  display: none;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.78);
  z-index: 2;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2em;
}

.overlay[style*="display: block"] {
  display: flex !important;
}

.text {
  font-size: 5vw;
  font-weight: 600;
  color: #fff;
  text-align: center;
  margin: 0;
}

.x {
  font-size: 1.2vw;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  white-space: nowrap;
  margin: 0;
}

/* === Timer-Seite (pruefungszeiten.html) === */
body.timer-page {
  padding: 0;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

body.timer-page #content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  /* transform (translate + scale) wird per JS gesetzt */
  width: max-content;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  padding: 20px 32px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 20px rgba(0,0,0,0.07);
  text-align: center;
}

.act-time-label {
  font-size: 1rem;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3em;
}

.act-time {
  font-size: 3.5rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: #222;
  line-height: 1;
  margin-bottom: 0;
}

body.timer-page hr {
  margin: 14px 0;
}

#teile-display {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

#teile-display > div {
  background: #f8f9fb;
  border: 1.5px solid #e4e7ed;
  border-radius: 10px;
  padding: 10px 16px;
}

#teile-display table {
  width: auto;
  min-width: 280px;
  border-collapse: collapse;
}

#teile-display td {
  padding: 3px 0;
  vertical-align: middle;
}

#teile-display td:first-child {
  color: #888;
  padding-right: 24px;
  font-size: 0.9rem;
}

#teile-display td:last-child {
  font-weight: 500;
  font-size: 1rem;
}

#teile-display p {
  margin: 0;
  color: #aaa;
  font-style: italic;
  font-size: 0.9rem;
}

input[type="checkbox"].toggle {
  opacity: 0;
  position: absolute;
  left: -9000px;
  top: -9000px;
}

input[type="checkbox"].toggle + label {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: #555;
}

input[type="checkbox"].toggle + label::before {
  content: "";
  width: 2em;
  height: 1em;
  background-color: rgba(180, 180, 180, 0.3);
  border-radius: 1em;
  margin-right: 0.5em;
  transition: background-color 200ms ease-in-out;
}

input[type="checkbox"].toggle + label::after {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  content: "\2715";
  font-size: 0.5em;
  left: 0.2em;
  width: 1.8em;
  height: 1.8em;
  background-color: rgba(180, 180, 180, 0.9);
  color: white;
  border-radius: 1em;
  transition: background-color 200ms ease-in-out, transform 200ms ease-in-out;
}

input[type="checkbox"].toggle:focus + label::before {
  outline: 1px solid #6aaa74;
}

input[type="checkbox"].toggle:checked + label::before {
  background-color: rgba(106, 170, 116, 0.25);
}

input[type="checkbox"].toggle:checked + label::after {
  content: "\2713";
  transform: translateX(100%);
  background-color: rgba(106, 170, 116, 1);
}

input[type="checkbox"].toggle:disabled + label {
  color: #bbb;
  cursor: default;
}

input[type="checkbox"].toggle:disabled + label::before {
  background-color: #eee;
}

input[type="checkbox"].toggle:disabled + label::after {
  background-color: #ccc;
}

/* === Neue Aufsicht Button (Timer-Seite) === */
#btn-neue-aufsicht {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.85);
  color: #4d8f5a;
  border: 1.5px solid #c6e0cb;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  z-index: 1;
}

#btn-neue-aufsicht:hover {
  background: #6aaa74;
  color: #fff;
  border-color: #6aaa74;
}

/* === QR-Code Dialog === */
#qr-modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  background: transparent;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
}

#qr-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.qr-card {
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  min-width: 260px;
}

.qr-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #bbb;
  cursor: pointer;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 6px;
  transition: color 0.15s, background-color 0.15s;
}

.qr-close:hover {
  color: #fff;
  background-color: #e05050;
}

.qr-title {
  font-size: 1rem;
  font-weight: 700;
  color: #222;
  margin: 0;
}

.qr-hint {
  font-size: 0.8rem;
  color: #aaa;
  margin: 0;
  text-align: center;
}

/* === Beitreten-Bereich (Startseite) === */
#join-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

#join-section h2 {
  margin-bottom: 12px;
}

.join-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.join-row button {
  background: #eef6ef;
  color: #4d8f5a;
  border: 1.5px solid #c6e0cb;
  border-radius: 7px;
  padding: 6px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.join-row button:hover {
  background: #6aaa74;
  color: #fff;
  border-color: #6aaa74;
}

#btn-scan-qr {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* === QR-Scanner Viewport === */
.scanner-viewport {
  position: relative;
  width: 260px;
  height: 260px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.scanner-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Suchrahmen-Overlay */
.scanner-frame {
  position: absolute;
  inset: 30px;
  border: 2.5px solid rgba(106, 170, 116, 0.9);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
