*,
*::before,
*::after {
  box-sizing: border-box;
}

:root { --header-height: 160px; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(to right, #e6f0ff, #ffffff);
  margin: 0;
  padding: 0 20px 20px !important;
}

h2 {
  color: #003366;
  text-align: center;
  margin-bottom: 20px;
}

form {
  background-color: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-width: 900px;
  margin: auto;
}

fieldset {
  border: 1px solid #ccc;
  padding: 20px;
  margin-bottom: 25px;
  border-radius: 6px;
}

legend {
  font-weight: bold;
  color: #003366;
  padding: 0 10px;
}

label {
  display: block;
  margin-top: 15px;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="geburtstag"],
select,
textarea {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #aaa;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 14px;
  min-height: 44px;
}

textarea {
  resize: vertical;
}

input[type="submit"] {
  background-color: #003366;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: block;
  margin: 20px auto 0;
}

input[type="submit"]:hover {
  background-color: #0055a5;
}

input[type="checkbox"] {
  margin-right: 10px;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #ffffff; /* weißer Hintergrund */
  margin: 0;
  padding-top: 160px; /* Platz für den fixierten Header */
}

/* Fixierter Header oben */
.site-header {
  position: sticky;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  z-index: 10;
  margin-top: 0 !important;

  /* Verhindert, dass der Header Klicks abfängt */
  pointer-events: none;
}

/* Nicht volle Seitenbreite, kein Stretching */
.header-inner {
  max-width: 900px;
  width: 100%;
  height: 140px;            /* Desktop-Höhe */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 3px solid #003366;
  border-radius: 8px;
  overflow: hidden;
}

/* Überschrift */
h2 {
  color: #003366;
  text-align: center;
  margin-bottom: 20px;
}

/* Nur für Checkbox-Zeilen: nebeneinander anordnen */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.checkbox-row input[type="checkbox"] {
  margin: 0; /* Seitenausrichtung übernimmt gap */
}

.checkbox-row label {
  display: inline;       /* überschreibt die globale Block-Darstellung */
  margin: 0;
  font-weight: 500;      /* etwas leichter als Feld-Labels */
  line-height: 1.4;
}

/* === Modal/Popup === */
.popup {
  display: none;                 /* unsichtbar bis geöffnet */
  position: fixed;
  inset: 0;                      /* top/right/bottom/left: 0 */
  background-color: rgba(0,0,0,0.6);
  z-index: 2000;
}

.popup[aria-hidden="true"] {
  display: none !important;
}

.popup[aria-hidden="false"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.popup-content {
  background: #fff;
  margin: 6% auto;
  padding: 0;
  border-radius: 10px;
  max-width: 900px;              /* bündig mit Formularbreite */
  width: calc(100% - 40px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
}

.popup-frame {
  display: block;
  width: 100%;
  height: 70vh;                  /* angenehme Höhe */
  border: 0;
}

/* Schließen-Button */
.close {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 28px;
  line-height: 1;
  border: none;
  background: transparent;
  color: #003366;
  cursor: pointer;
  z-index: 1;
}

.close:hover { color: #0055a5; }

/* Links in den Checkbox-Labels */
.checkbox-row a {
  color: #003366;
  text-decoration: underline;
}
.checkbox-row a:hover {
  color: #0055a5;
}
.readonly-field {
  background-color: #f5f7fa;
  color: #333;
  border-color: #d0d6df;
}
.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
}

.copy-row input[type="checkbox"] {
  margin: 0; /* wir nutzen gap */
}

.copy-row label {
  display: inline;  /* überschreibt globales label { display:block } */
  margin: 0;
  font-weight: 500;
}

.recaptcha-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

@media (max-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
    height: auto;                  /* wird durch inneren Container bestimmt */
    pointer-events: auto;          /* darf wieder Events bekommen, schadet hier nicht */
  }
  .header-inner {
    /* zeigt das komplette Bild */
    background-size: contain;    /* statt cover */
    background-position: center top;
    background-repeat: no-repeat;

    /* Höhe automatisch aus Breite + Seitenverhältnis ableiten */
    aspect-ratio: 16 / 9;        /* ggf. auf das echte Verhältnis deiner head.jpg anpassen */
    height: auto;                /* mit aspect-ratio kontrolliert */
    min-height: 120px;           /* Falls Browser aspect-ratio nicht unterstützt */
  }
  .recaptcha-row {
    transform: scale(0.9);
    transform-origin: top center;
  }
  body {
    padding-top: 0;                /* kein extra Offset nötig bei sticky */
  }
}
#confirm-modal[aria-hidden="false"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

#confirm-modal .popup-content {
  background: #ffffff;
  padding: 25px 30px 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  text-align: left;
  position: relative;
  animation: fadeIn 0.25s ease-out;
}

#confirm-modal h3 {
  text-align: center;
  color: #003366;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

/* Liste übersichtlicher */
#summary-list {
  list-style: none;
  padding: 0;
  margin: 0 0 15px 0;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
}
#summary-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  font-size: 0.95rem;
  line-height: 1.4;
}
#summary-list li:last-child {
  border-bottom: none;
}

/* Button-Reihe mittig & gleichmäßig */
#confirm-modal .popup-content > div:last-of-type {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 25px;
}

#confirm-modal button {
  border: none;
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#confirm-cancel {
  background-color: #ccc;
  color: #222;
}
#confirm-cancel:hover {
  background-color: #bbb;
}

#final-submit {
  background-color: #003366;
  color: #fff;
}
#final-submit:disabled {
  background-color: #8da2c2;
  cursor: not-allowed;
}
#final-submit:hover:not(:disabled) {
  background-color: #0055a5;
}

/* dezente Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

#status-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background-color: #28a745; /* grün (Standard: Erfolg) */
  color: white;
  padding: 16px 28px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  z-index: 4000;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
  pointer-events: none; /* keine Interaktion blockieren */
}

#status-popup.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#status-popup.error {
  background-color: #dc3545; /* rot */
}