/* ============================================================================
   Gemeinsames CSS für Geburtsvorbereitung und Rückbildungsgymnastik
   ----------------------------------------------------------------------------
   Struktur:
     1. Variablen
     2. Reset & Base
     3. Schriften
     4. Layout (Page, Card)
     5. Header (in der Card)
     6. Close-Button
     7. Form-Sektionen, Felder, Inputs
     8. Termindetails, Hilfetexte, Checkboxen
     9. Buttons
    10. Dynamische Felder (Animationen)
   10b. Sendebestätigung & Fehlerhinweis
    11. Footer
    12. Utilities (Honeypot, Collapsible, Loading, sr-only)
    13. Responsive (konsolidiert)
   ============================================================================ */


/* ===== 1. VARIABLEN ===== */
:root {
  --brand:        #992618;   /* einheitliches Bordeaux der Website */
  --brand-dark:   #7A1E13;
  --brand-soft:   rgba(153, 38, 24, 0.1);

  --bg-page:      #f5f5f5;   /* helles white */
  --bg-section:   #fafafa;
  --bg-card:      #ffffff;

  --text-dark:    #2a2a2a;
  --text-body:    #333;
  --text-muted:   #666;
  --text-faint:   #999;

  --border:       #e0e0e0;
  --border-light: #ccc;
  --border-card:  rgba(153, 38, 24, 0.4);   /* feine Linie um das Formular; grau: #ccc */

  --error:        #d32f2f;
  --success:      #4caf50;
}


/* ===== 2. RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: var(--bg-page);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Spezifischer Hintergrund für Rückbildung – bleibt als Hook erhalten,
   aktuell identisch mit Standard */
body[data-formular-typ="rueckbildung"] {
  background: var(--bg-page);
}


/* ===== 3. SCHRIFTEN ===== */
@font-face {
  font-family: 'Ysabeau';
  src: url('../fonts/Ysabeau-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Ysabeau';
  src: url('../fonts/Ysabeau-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Ysabeau';
  src: url('../fonts/Ysabeau-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}


/* ===== 4. LAYOUT ===== */

/* --- Page & Card --- */
.page {
  display: flex;
  justify-content: center;
  padding: 2.5rem 15px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  max-width: 1100px;
  width: 100%;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 2;
}


/* ===== 5. HEADER (in der Card) ===== */
/* Schlanker Header: nur Titel links und Schließen-Button rechts,
   ohne Box, Rand und Bild */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 2.75rem;
  /* Titel bündig mit den Überschriften in den Kästen:
     Innenabstand der Kästen + 5px (Rahmen und Legenden-Einzug) */
  padding-left: calc(1.5rem + 5px);
}

.header-left {
  order: 1;
  flex: 1;
  min-width: 0;
}

.header .close-btn {
  order: 2;
  position: static;
  flex-shrink: 0;
}

.header-text {
  text-align: left;
}

/* Bild und Untertitel werden nicht mehr angezeigt
   (können auch aus dem HTML entfernt werden) */
.header-image,
.subtitle {
  display: none;
}

h1.title {
  font-family: 'Ysabeau', sans-serif;
  font-weight: 600;
  font-size: 2rem;
  color: var(--brand);
  margin: 0;
  line-height: 1.1;
  letter-spacing: 1px;
  /* Zeilen ausgewogen umbrechen; getrennt wird nur, wenn es nicht anders passt */
  text-wrap: balance;
  overflow-wrap: break-word;
}


/* ===== 6. CLOSE-BUTTON ===== */
.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background: #f8f9fa;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
  line-height: 1;
  z-index: 10;
}

.close-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  transform: rotate(90deg);
}


/* ===== 7. FORM-SEKTIONEN, FELDER, INPUTS ===== */
.form-section {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  background-color: var(--bg-section);
}

.form-section .fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.form-section .fields-grid .field.full {
  grid-column: 1 / -1;
}

.section-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--brand);
  margin-bottom: 1rem;
}

.field {
  margin-bottom: 1.5rem;
}

.field-label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
  padding-left: 3px;
  color: var(--brand);
}

.field-label.required::after {
  content: "*";
  color: var(--brand);
  margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 6px;
  border: 2px solid var(--border);
  font-size: 1rem;
  display: block;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  background-color: #fff;
}

input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  line-height: 1.5;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background-color: #fefefe;
}

input:hover:not(:focus),
select:hover:not(:focus) {
  border-color: #bbb;
}

/* --- Validierung (nur beim Absenden / explizitem Fehler) --- */
input.submitted:invalid,
select.submitted:invalid {
  border-color: var(--error);
}

input:required:focus:invalid,
select:required:focus:invalid {
  border-color: var(--error);
  box-shadow: 0 0 5px rgba(211, 47, 47, 0.3);
}

input.validated:valid,
select.validated:valid {
  border-color: var(--success);
}

/* --- Placeholder --- */
input::placeholder {
  color: var(--text-faint);
  opacity: 1;
}

input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  color: var(--text-faint);
}

input[type="date"]:focus::-webkit-datetime-edit-text,
input[type="date"]:focus::-webkit-datetime-edit-month-field,
input[type="date"]:focus::-webkit-datetime-edit-day-field,
input[type="date"]:focus::-webkit-datetime-edit-year-field {
  color: var(--text-body);
}


/* ===== 8. TERMINDETAILS, HILFETEXTE, CHECKBOXEN ===== */
.termin-liste {
  background-color: #f8f9fa;
  border-left: 4px solid var(--border-light);   /* Grau wie die Rahmen der Kästen */
  padding: 15px;
  border-radius: 4px;
  margin-top: 10px;
}

.termin-liste ul {
  margin: 0;
  padding-left: 20px;
}

.termin-liste li {
  margin: 5px 0;
  color: var(--text-body);
}

.termin-info {
  line-height: 1.6;
}

.termin-info p {
  margin: 0.5rem 0;
}

.termin-item {
  padding: 0.3rem 0;
}

.termin-anzahl {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.termin-hinweis {
  font-style: italic;
  color: var(--text-faint);
}

.help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  padding-left: 3px;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.checkbox input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0.1rem 0 0 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--brand);   /* Haken in Bordeaux */
}

.checkbox span {
  display: block;
  font-size: 0.95rem;
  color: var(--text-body);
}

.checkbox a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.3s ease;
}

.checkbox a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}


/* ===== 9. BUTTONS ===== */
.btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  font-weight: 600;
}

.btn-primary {
  background-color: var(--brand);
  color: #fff;
  font-size: 1.1rem;
  padding: 0.85rem 2rem;
  letter-spacing: 0.5px;
  text-align: center;
  margin-left: 0.5rem;
  box-shadow: 0 4px 6px rgba(153, 38, 24, 0.2);
}

.btn-primary:hover {
  background-color: var(--brand-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(153, 38, 24, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(153, 38, 24, 0.2);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.actions {
  margin-bottom: 2rem;
}


/* ===== 10. DYNAMISCHE FELDER (Animationen) ===== */
#kursZeitraumContainer,
.insurance-fields {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.5s ease;
}

#kursZeitraumContainer.visible,
.insurance-fields.visible {
  max-height: 200px;
  opacity: 1;
}

.insurance-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}


/* ===== 10b. SENDEBESTÄTIGUNG & FEHLERHINWEIS ===== */
.status-box {
  text-align: center;
  padding: 2.5rem 1.5rem 2.75rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-section);
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 8px var(--brand-soft);
  margin-bottom: 1.25rem;
}

.status-titel {
  font-family: 'Ysabeau', sans-serif;
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: 0.5px;
  color: var(--brand);
  margin: 0 0 1rem;
}

.status-box p {
  max-width: 34rem;
  margin: 0 auto 0.6rem;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-body);
}

.status-box .status-klein {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-mail {
  overflow-wrap: anywhere;   /* lange Adressen umbrechen statt überlaufen */
}

.status-button {
  display: inline-block;
  margin: 1.5rem 0 0;
  text-decoration: none;
}

/* Fehlerhinweis über dem Formular */
.status-fehler {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--error);
  border-radius: 6px;
  background: #fff5f5;
  color: var(--text-body);
  line-height: 1.6;
}

.status-fehler p {
  margin: 0 0 0.4rem;
}

.status-fehler p:last-child {
  margin-bottom: 0;
}

.status-fehler-titel {
  font-weight: bold;
  color: var(--error);
}

.status-fehler a {
  color: var(--brand);
}


/* ===== 11. FOOTER ===== */
.footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--brand);
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-section a:hover {
  color: var(--brand);
}

.footer-section p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.5rem 0;
}

.footer-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.footer-icon[aria-hidden="true"] {
  display: inline-block;
  margin-right: 0.5rem;
}

/* --- Social Media --- */
.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #f5f5f5;
  border-radius: 50%;
  color: var(--text-muted);
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-2px);
}

/* --- Footer Bottom --- */
.footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-bottom p {
  color: var(--text-faint);
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.footer-bottom a {
  color: var(--brand);
  text-decoration: none;
}

.footer-bottom a:hover {
  text-decoration: underline;
}

/* --- Alte .contact-Klasse (für Kompatibilität) --- */
.contact {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.contact a {
  color: var(--brand);
  text-decoration: none;
  transition: text-decoration 0.3s ease;
}

.contact a:hover {
  text-decoration: underline;
}


/* ===== 12. UTILITIES ===== */

/* Honeypot-Feld (unsichtbar, Spam-Bot-Schutz) */
.honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Collapsible: versteckt */
.collapsible-hidden {
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  transition: max-height 0.3s ease, opacity 0.3s ease !important;
}

/* Collapsible: sichtbar (per JS gesetzt) */
.collapsible-visible {
  max-height: 2000px !important;
  opacity: 1 !important;
  overflow: visible !important;
  transition: max-height 0.3s ease, opacity 0.3s ease !important;
}

/* Loading Message */
.loading-message {
  display: none;
  margin-top: 1rem;
  color: var(--brand);
  font-weight: bold;
  text-align: center;
}

.loading-message.active {
  display: block;
}

/* Button Loading State */
.btn-loading {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Screen Reader Only (Barrierefreiheit) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* ============================================================================
   13. RESPONSIVE (von größerem zu kleinerem Breakpoint)
   ============================================================================ */

@media (min-width: 769px) {
  .card        { padding: 3rem; }
  .form-section { padding: 1.5rem 2rem; }
  .header      { padding-left: calc(2rem + 5px); }
}

@media (max-width: 768px) {
  .form-section .fields-grid,
  .insurance-fields {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 600px) {
  .card {
    width: 100%;
    max-width: none;
    padding: 1rem;
  }
  .page {
    padding: 1rem;
  }

  .header     { margin: 0.25rem 0 2rem; padding-left: calc(1rem + 5px); }
  h1.title    { font-size: 1.2rem; line-height: 1.25; }

  .close-btn {
    width: 35px;
    height: 35px;
    font-size: 24px;
  }

  .checkbox {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .checkbox input[type="checkbox"] {
    margin-top: 0;
  }
  .checkbox span {
    font-size: 0.85rem;
  }

  .btn-primary {
    margin-left: 0;
    width: 100%;
  }

  .status-box   { padding: 2rem 1rem 2.25rem; }
  .status-titel { font-size: 1.4rem; }
  .status-box p { font-size: 1rem; }

  .form-section   { padding: 0.75rem 1rem; }
  .section-title  { font-size: 1rem; }
  .field-label    { font-size: 0.95rem; }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
  }
}

@media (max-width: 400px) {
  .card        { padding: 0.75rem; }
  .page        { padding: 0.5rem; }
  .close-btn   { font-size: 30px; }
}
