.container {
  max-width: 1200px;
  width: 100%;
  padding: 2rem;
  margin: 0 auto; /* <-- zentriert den gesamten Inhalt */
}

/* ============================================================
   Scrollfix nur für PEF-Formularseite
   ============================================================ */

body.pef-form {
  overflow: hidden !important;     /* Body selbst scrollt nicht */
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  margin: 0 !important;
  padding-left: 60px !important; /* Sidebar space */
}

/* ============================================================
   Scrollbereich korrekt über Footer enden lassen
   ============================================================ */
body.pef-form main {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  box-sizing: border-box;
  scroll-behavior: smooth;

  /* --- Wichtig --- */
  padding-bottom: 90px !important; /* genug Platz über Footer */
  scroll-padding-bottom: 90px;     /* bei Scroll to Bottom sichtbar */
}

/* Footer bleibt fix sichtbar */
body.pef-form footer {
  position: fixed !important;
  bottom: 0;
  width: 100%;
  height: 50px;
  line-height: 50px;
  background: var(--nav-bg);
  color: var(--fg);
  border-top: 1px solid #333;
  text-align: center;
  z-index: 100;
}

/* Scrollbar Styling */
body.pef-form main::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.pef-form main::-webkit-scrollbar-thumb {
  background-color: rgba(100, 100, 100, 0.4);
  border-radius: 5px;
}

body.pef-form main::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 100, 100, 0.6);
}

body.pef-form main::-webkit-scrollbar-track {
  background: transparent;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
}
section {
  background: var(--section-bg);
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
  margin-bottom: 1.5rem;
  padding: 1rem;
}

/* =======================================================
   Section-Header mit Hintergrund und Akzentlinie
   ======================================================= */
section h2 {
  background: rgba(0, 212, 170, 0.1);   /* dezenter türkisfarbener Hintergrund */
  border-bottom: 2px solid var(--accent);
  color: var(--fg);
  padding: 0.6rem 1rem;
  margin: -1rem -1rem 1rem -1rem;       /* über gesamte Boxbreite */
  border-radius: 8px 8px 0 0;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
}

/* bei hellen Themes etwas mehr Kontrast */
@media (prefers-color-scheme: light) {
  section h2 {
    background: rgba(0, 119, 182, 0.1);
    border-bottom-color: #0077b6;
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px,1fr));
  gap: 0.8rem;
}
label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
}
input, textarea {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.4rem;
  background: inherit;
  color: inherit;
}
.buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
}
button:hover {
  opacity: 0.9;
}

input[readonly] {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  cursor: not-allowed;
}

.toggle-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.toggle {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: #222;
  color: #ddd;
  transition: all 0.2s ease;
  font-weight: 500;
}

.toggle:hover {
  background: #333;
}

.toggle.yes.active {
  background-color: #00d4aa;
  color: #fff;
  border-color: #00d4aa;
}

.toggle.no.active {
  background-color: #444;
  color: #fff;
  border-color: #666;
}

.toggle-group button {
  user-select: none;
}

select {
  width: 100%;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  font-size: 1rem;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.slider-wrapper input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.slider-wrapper output {
  min-width: 2.5rem;
  text-align: right;
  font-weight: 600;
}

/* =======================================================
   Bemerkungsfeld – breiter & besser nutzbar
   ======================================================= */
section:last-of-type textarea {
  width: 100%;
  max-width: 1000px;          /* optional: maximale Breite begrenzen */
  min-height: 120px;          /* mehr Platz zum Schreiben */
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  resize: vertical;           /* Benutzer darf Höhe anpassen */
  box-sizing: border-box;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  margin: 0 auto;
  display: block;
}

/* optional: bei großen Bildschirmen noch breiter */
@media (min-width: 1400px) {
  section:last-of-type textarea {
    max-width: 1200px;
  }
}

section:last-of-type {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02); /* leicht transparent für Darkmode */
}

.error-message {
  color: #ff5555;
  font-size: 0.9em;
  margin-top: 3px;
}
.error-field {
  border: 1px solid #ff5555 !important;
  background-color: #fff6f6;
}

.success-message {
  background-color: #e6ffe6;
  color: #006600;
  border: 1px solid #00aa00;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.error-message {
  color: #ff5555;
  font-size: 0.9em;
  margin-top: 3px;
}
.error-field {
  border: 1px solid #ff5555 !important;
  background-color: #fff6f6;
}