/* Cyberdeck-Stil: Terminal-Grün auf fast Schwarz, Monospace, CRT-Effekt.
   Keine Webfonts, keine externen Ressourcen (CSP: style-src 'self'). */

:root {
  --bg: #050a05;
  --bg-deep: #020402;
  --bg-top: #071107;
  --fg: #00ff66;
  --fg-hover: #00cc55;
  --fg-muted: rgba(0, 255, 102, 0.7);
  --fg-line: rgba(0, 255, 102, 0.2);
  --panel: rgba(0, 255, 102, 0.03);
  --glow: 0 0 8px rgba(0, 255, 102, 0.4);
  --danger: #ff3b3b;
  --danger-panel: rgba(255, 59, 59, 0.08);
  --danger-soft: rgba(255, 59, 59, 0.2);
  --danger-line: rgba(255, 59, 59, 0.6);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font: 1.0625rem/1.6 monospace;
  color: var(--fg);
  background: var(--bg);
  background-image: radial-gradient(circle at center, #000 0%, var(--bg-deep) 100%);
  overflow-wrap: anywhere;
}

::selection {
  background: var(--fg);
  color: #000;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* CRT: Scanlines und Vignette liegen über dem Inhalt, fangen aber keine Klicks ab. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.25) 3px
  );
  mix-blend-mode: multiply;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.7) 100%);
}

/* KOPFZEILE */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-top);
  border-bottom: 1px solid var(--fg);
  text-transform: uppercase;
  letter-spacing: 4px;
}

.site-title {
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  text-shadow: var(--glow);
}

.topbar-right {
  color: var(--fg-muted);
  white-space: nowrap;
}

main.container {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

/* ÜBERSCHRIFTEN UND LABELS */
h1,
h2 {
  text-shadow: var(--glow);
  text-transform: uppercase;
}

h1 {
  font-size: 1.6rem;
  letter-spacing: 4px;
  margin: 1.25rem 0 0.75rem;
}

h2 {
  font-size: 1.2rem;
  letter-spacing: 3px;
  margin: 2rem 0 0.5rem;
}

/* Große Titelzeile für Startseite und Login-Seiten */
.terminal-title {
  font-size: 2.625rem;
  line-height: 1.15;
  letter-spacing: 6px;
  margin: 1.5rem 0 1.25rem;
}

label:not(.check-item):not(.checkbox) {
  text-transform: uppercase;
  letter-spacing: 2px;
}

th,
legend {
  text-transform: uppercase;
  letter-spacing: 2px;
}

a {
  color: var(--fg);
}

a:not(.button):hover {
  color: var(--fg-hover);
}

/* PANELS: Abschnitte und Code-Karten */
section,
.code-card {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--fg);
  background: var(--panel);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.2);
  animation: terminalFlicker 6s infinite;
}

section h2 {
  margin-top: 0;
}

/* BUTTONS */
button,
input,
select,
textarea {
  font: inherit;
}

.button {
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--fg);
  border-radius: 0;
  background: var(--fg);
  color: #000;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.button:hover {
  background: var(--fg-hover);
  color: #000;
}

.button-secondary {
  background: transparent;
  color: var(--fg);
}

.button-secondary:hover {
  background: rgba(0, 255, 102, 0.15);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.4);
  color: var(--fg);
}

.button-danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}

.button-danger:hover {
  background: rgba(255, 59, 59, 0.15);
  box-shadow: 0 0 10px rgba(255, 59, 59, 0.4);
  color: var(--danger);
}

.button-small {
  padding: 0.3rem 0.8rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

/* EINGABEFELDER */
input[type="password"],
input[type="number"],
input[type="text"],
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--fg);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  caret-color: var(--fg);
}

input[type="password"]:focus,
input[type="number"]:focus,
input[type="text"]:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.4);
}

input[type="checkbox"] {
  accent-color: var(--fg);
}

.code-input {
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  min-height: 3rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
}

/* ZUGANGSTERMINAL (LOGIN-SEITEN): Wrapper zentriert in der Höhe unter der Kopfzeile.
   Kopfzeile (ca. 3rem) plus Außenabstand von main.container (1.5rem oben, 2rem unten) ergeben 6.5rem. */
.login-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 6.5rem);
  min-height: calc(100svh - 6.5rem);
  background: radial-gradient(circle at center, #061106 0%, #020402 100%);
}

.login-wrapper .terminal-title {
  margin: 0 0 1.5rem;
  text-align: center;
  max-width: 100%;
}

.login-box {
  width: 100%;
  max-width: 420px;
  padding: 25px;
  border: 1px solid var(--fg);
  background: rgba(0, 255, 102, 0.04);
  box-shadow: 0 0 25px rgba(0, 255, 102, 0.25);
  animation: terminalFlicker 6s infinite;
}

.login-box input {
  width: 100%;
}

.login-box .button {
  width: 100%;
}

.login-box .alert {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* MELDUNGEN */
.notice {
  padding: 0.75rem 1rem;
  border: 1px solid var(--fg);
  background: rgba(0, 255, 102, 0.04);
}

.alert {
  padding: 0.75rem 1rem;
  border: 1px solid var(--danger);
  background: var(--danger-panel);
  color: var(--danger);
  box-shadow: 0 0 10px rgba(255, 59, 59, 0.35);
}

/* AUSWAHLLISTEN (Kandidaten, Ausschlüsse) */
.check-list {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--fg-line);
  background: rgba(0, 0, 0, 0.35);
}

.check-list legend {
  padding: 0 0.3rem;
  color: var(--fg-muted);
}

.check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.25rem;
  cursor: pointer;
}

.check-item input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
}

.check-confirm {
  font-weight: 600;
}

.inline-form {
  display: inline;
  margin: 0;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* TABELLEN UND STATUS */
table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

th,
td {
  padding: 0.5rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--fg-line);
  overflow-wrap: break-word;
}

th {
  color: var(--fg);
  font-weight: 700;
}

.status {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  margin: 0;
  padding: 0.25rem 1rem;
  background: var(--panel);
  border: 1px solid var(--fg);
}

.status dt,
.status dd {
  margin: 0;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--fg-line);
}

.status dt {
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-right: 1rem;
}

.status dd {
  font-weight: 700;
}

/* CODE-KARTEN (Druckansicht) */
.code-card {
  margin: 1rem 0;
}

.code {
  margin: 0.5rem 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: var(--glow);
  overflow-wrap: anywhere;
}

.code-hint {
  margin: 0;
  color: var(--fg-muted);
}

/* SCROLLBARS */
::-webkit-scrollbar-track {
  background: #061006;
}

::-webkit-scrollbar-thumb {
  background: var(--fg);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-hover);
}

/* Standard: unsichtbar, beim Hover auf die Seite sichtbar */
::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

body:hover ::-webkit-scrollbar {
  width: 10px;
}

/* FLACKERN UND BEWEGUNG */
@keyframes terminalFlicker {
  0%,
  96%,
  100% {
    opacity: 1;
  }
  97% {
    opacity: 0.93;
  }
  98% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* SCHMALE DISPLAYS (Handy) */
@media (max-width: 30rem) {
  .topbar {
    letter-spacing: 2px;
  }

  .topbar-right {
    display: none;
  }

  .terminal-title {
    font-size: 1.75rem;
    letter-spacing: 3px;
  }

  .login-wrapper .terminal-title {
    font-size: 1.5rem;
    letter-spacing: 2px;
  }

  .code {
    font-size: 1.5rem;
  }

  .status {
    grid-template-columns: 1fr;
  }

  .status dt {
    padding-bottom: 0;
    border-bottom: none;
  }
}

/* DRUCK: Codes schwarz auf weiß, ohne Effekte */
@media print {
  *,
  *::before,
  *::after {
    color: #000 !important;
    text-shadow: none !important;
    box-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  body {
    background: #fff;
    background-image: none;
  }

  body::before,
  body::after {
    display: none;
  }

  .topbar,
  .no-print {
    display: none !important;
  }

  main.container {
    max-width: none;
    padding: 0;
  }

  section,
  .code-card {
    margin: 0 0 1rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid #000;
  }

  .code-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .status,
  .status dt,
  .status dd,
  th,
  td {
    border-color: #000;
  }
}
