/* ===========================================================
   Basisfarben und Variablen
   =========================================================== */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #222;
  --muted: #555;
  --line: #ddd;
  --radius: 14px;
}

/* ===========================================================
   Grundlayout
   =========================================================== */
html, body { height: 100%; }

body {
  margin: 0;
  padding: 40px 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ===========================================================
   Formularrahmen (zentriert mit Schatten)
   =========================================================== */
.form-frame {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
  border-radius: 30px;
  border: thin solid #DDF721;
  box-shadow:
    -10px 0px 13px -7px #000000,
     10px 0px 13px -7px #000000,
      5px 5px 15px 5px rgba(0,0,0,0.1);
  background: #f9fbff;
  box-sizing: border-box;
}

/* ===========================================================
   Header (Titel links, Logo rechts)
   =========================================================== */
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Titel links, Logo rechts */
  margin-bottom: 18px;
}

.form-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.logo {
  width: 80px;
  height: auto;
  object-fit: contain;
}

/* ===========================================================
   Überschriften
   =========================================================== */
h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 20px 0 12px;
}
h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--muted);
}

/* ===========================================================
   Grid-Strukturen
   =========================================================== */
.kid-grid, .parents-grid, .work-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 720px) {
  .kid-grid, .parents-grid, .work-grid {
    grid-template-columns: 1fr;
  }
}

/* ===========================================================
   Eingabefelder
   =========================================================== */
.field {
  position: relative;
  margin-top: 14px;
}

.field input,
.field textarea {
  width: 100%;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #f7f7f7;
  color: #222;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.field input {
  height: 40px;
  padding: 14px 12px 6px;
}

.field textarea {
  min-height: 120px;
  padding: 24px 12px 10px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: #888;
  outline: none;
}

/* Label "auf dem Rahmen" */
.label {
  position: absolute;
  top: -8px;
  left: 14px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #000;
  background: var(--card);
  line-height: 1;
  pointer-events: none;
}

/* Pflichtfeld-Kennzeichnung automatisch */
.field:has(input[required]) .label::after,
.field:has(textarea[required]) .label::after {
  content: " *";
  color: #c00;
  font-weight: 700;
}

/* ===========================================================
   Fehlermeldungen & Invalid-Styles (SCREEN)
   =========================================================== */

/* Inline-Fehler unter den Feldern */
.error{
  display:none;
  margin:6px 2px 0;
  font-size:13px;
  color:#b00020;
  font-weight:600;
}

/* rot umranden, wenn ungültig (Browser-Validity) */
.field input:invalid,
.field textarea:invalid,
.field select:invalid{
  border-color:#b00020;
}

/* ===========================================================
   Gewünschter Eintrittstermin (1 Spalte)
   =========================================================== */
.entry-section .entry-grid {
  display: block;
  width: 100%;
}

/* ===========================================================
   Gewünschter Aufenthalt
   =========================================================== */
.stay-section h2 { margin-top: 28px; }

.stay-cols {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  align-items: end;
  column-gap: 12px;
  padding: 6px 10px 8px;
}

.stay-colhead {
  font-weight: 700;
  font-size: 14px;
}

.stay-colhead span {
  font-weight: 500;
  font-size: 12px;
  margin-left: 6px;
  color: #555;
  white-space: nowrap;
}

.stay-rows {
  border: 1px solid #ccc;
  border-radius: 12px;
  overflow: hidden;
}

.stay-row {
  display: grid;
  grid-template-columns: minmax(120px,1.2fr) repeat(3, minmax(72px,1fr));
  column-gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid #ddd;
}
.stay-row:first-child { border-top: none; }
.stay-day { font-weight: 600; }
.stay-box { display: flex; justify-content: center; align-items: center; }
.stay-box input { width: 18px; height: 18px; cursor: pointer; }

@media (max-width: 600px) {
  .stay-cols { column-gap: 8px; padding: 6px 8px 6px; }
  .stay-colhead { font-size: 13px; }
  .stay-colhead span { font-size: 11px; }
  .stay-row {
    grid-template-columns: minmax(110px,1.2fr) repeat(3, minmax(64px,1fr));
    column-gap: 8px;
    padding: 6px 8px;
  }
  .stay-box input { width: 16px; height: 16px; }
}

@media (max-width: 480px) {
  .stay-rows { overflow: auto; -webkit-overflow-scrolling: touch; }
  .stay-row { min-width: 420px; }
}

/* ===========================================================
   Elterliche Sorge
   =========================================================== */
.sorgerecht-section h2 { margin-top: 28px; }

.sorgerecht-grid {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  flex-wrap: wrap;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #f7f7f7;
}

.sorge-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #000;
  cursor: pointer;
}

.sorge-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: #333;
  cursor: pointer;
}

/* ===========================================================
   Depot & Einverständnis
   =========================================================== */
.depot-section h2 { margin-top: 28px; }

.depot-text {
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #f7faff;
  padding: 12px 14px;
  line-height: 1.45;
  margin-bottom: 12px;
  color: #333;
}

.consent-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #f7f7f7;
  padding: 10px 12px;
  margin: 12px 0;
  font-weight: 600;
  color: #000;
}

.consent-box input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
  cursor: pointer;
}

.consent-box a {
  text-decoration: underline;
  color: inherit;
}

/* ===========================================================
   Hinweistext & Buttons
   =========================================================== */
.hint-text {
  font-size: 14px;
  color: #444;
  margin: 20px 0 6px;
  font-style: italic;
}

/* Wenn das Formular Fehler hat → Hinweis hervorheben */
#anmeldung-form.has-errors .hint-text{
  color:#b00020;
  font-weight:700;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  appearance: none;
  border: 1px solid #ccc;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: #f7f7f7;
  color: #222;
  transition: all .15s ease;
}

.btn:hover { border-color: #888; }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: #1f2937;
  color: #fff;
  border-color: #1f2937;
}
.btn.primary:hover {
  background: #111827;
}

.btn.ghost {
  background: transparent;
  border-color: #bbb;
}

/* ===========================================================
   Druckversion
   =========================================================== */
@media print {
  @page { size: A4 portrait; margin: 12mm; }

  body {
    background: #fff !important;
    display: block;
    padding: 0;
    margin: 0;
  }

  .form-frame {
    max-width: none;
    width: auto;
    margin: 0;
    padding: 20px !important;
    border: 1px solid #000 !important;
    border-radius: 12px;
    background: #fff !important;
    box-shadow: none !important;
  }

  /* Logo kleiner im Druck */
  .logo { width: 60px; }

  .actions, .hint-text { display: none !important; }

  .field input, .field textarea {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
    border-radius: 10px !important;
    box-shadow: none !important;
  }

  .label {
    background: #fff !important;
    color: #000 !important;
  }

  .stay-rows, .sorgerecht-grid, .consent-box, .depot-text {
    border: 1px solid #000 !important;
    background: #fff !important;
  }

  section, .field, .kid-grid, .parents-grid, .work-grid {
    page-break-inside: avoid;
  }

  /* Grids im Druck explizit zweispaltig lassen */
  .kid-grid, .parents-grid, .work-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }

  /* Fehlermeldungen im Druck ausblenden */
  .error{ display:none !important; }
}
