@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap");

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

:root {
  --brand: #0f172a;
  --accent: #0f172a;
  --akzent: #3b82f6;
  --text: #0f172a;
  --muted: #64748b;
  --bg: #fff;
  --surface: #ffffff;
  --border: #e2e8f0;
  --r: 8px;
  --r-sm: 6px;
}

.widget {
  width: 900px;
  height: 800px;
  max-width: 100%;
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
  display: grid;
  grid-template-rows: auto 1fr 64px;
  overflow: hidden;
  font-family: "Manrope", ui-sans-serif, -apple-system, Segoe UI, Inter, Roboto,
    Arial, sans-serif;
}

.head {
  padding: 8px 12px 6px;
  border-bottom: 1px solid #eceff1;
  background: linear-gradient(180deg, #fff, #fbfbfb);
}
.title {
  font-weight: 800;
  font-size: 18px;
  line-height: 1.1;
}
.subtitle {
  font-size: 12px;
  color: var(--muted);
}

/* Zusammenfassung */
.summary-bar {
  background: var(--brand);
  color: white;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

/* Sticky Header auf mobilen Geräten */
@media (max-width: 768px) {
  .widget {
    overflow: visible; /* Sticky funktioniert nur ohne overflow: hidden */
    position: relative; /* Für sticky positioning */
  }

  .summary-bar {
    position: fixed; /* Fixed statt sticky für bessere Kompatibilität */
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 0; /* Keine abgerundeten Ecken bei fixed */
    box-sizing: border-box; /* Padding in die Breite einbeziehen */
  }

  /* Body Padding für fixed Header */
  body {
    padding-top: 50px; /* Platz für fixed Header */
  }

  /* Widget Padding anpassen */
  .widget {
    margin-top: 0;
  }
}
.summary-text {
  line-height: 1.3;
}
.summary-edit {
  background: rgba(255, 255, 255, 0.2);
  border: 0;
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
}

.body {
  background: var(--bg);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.left-column {
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  min-height: 0;
}

.left-column.heimberatung {
  grid-template-rows: auto 1fr;
}

.right-column {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
  min-height: 0;
}

.right-column.heimberatung {
  grid-template-rows: auto;
}

.right-column.videoberatung {
  grid-template-rows: auto auto;
  gap: 10px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: hidden;
}
.section-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step-number {
  background: var(--brand);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.step-status {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-left: auto;
  font-style: italic;
}

.card.completed .step-number {
  background: var(--accent);
}

.card.completed .step-status {
  color: var(--accent);
  font-weight: 600;
}

.card.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(44, 42, 226, 0.1);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 2px rgba(44, 42, 226, 0.1);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(44, 42, 226, 0.2);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(44, 42, 226, 0.1);
  }
}
.accent {
  color: var(--accent);
  font-weight: 700;
}
.change-btn {
  margin-left: auto;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

/* Standort */
/* Beratungsarten-Auswahl */
.beratungsarten {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border: none;
  padding: 0;
  margin: 0;
}

.beratungsart {
  position: relative;
}

.beratungsart input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.beratungsart label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 500;
  min-height: 85px;
  text-align: center;
}

.beratungsart label:hover {
  border-color: var(--akzent);
  background: #f8fafc;
}

.beratungsart input[type="radio"]:checked + label {
  background: var(--akzent);
  color: white;
  border-color: var(--akzent);
}

.beratungsart-icon {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.beratungsart-title {
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
}

.locations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  align-content: start;
  max-height: 100%;
  overflow: visible;
  border: none;
  margin: 0;
  padding: 2px;
}

/* Abteilungen */
.departments {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-content: start;
  max-height: 100%;
  overflow: visible;
  border: none;
  margin: 0;
  padding: 2px;
}
.loc {
  position: relative;
}
.loc input {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.loc label {
  display: grid;
  place-items: center;
  min-height: 32px;
  text-align: center;
  border: none;
  border-radius: var(--r-sm);
  background: #fff;
  font-weight: 400;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 4px 8px;
}
.loc input:checked + label {
  color: #fff;
  background: var(--brand);
  border-color: transparent;
}

/* Abteilungs-Styles */
.dept {
  position: relative;
}

.dept input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.dept label {
  display: grid;
  place-items: center;
  min-height: 40px;
  text-align: center;
  border: none;
  border-radius: var(--r-sm);
  background: #fff;
  font-weight: 400;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 8px 12px;
  line-height: 1.2;
  gap: 2px;
}

.dept label strong {
  display: block;
  margin-bottom: 2px;
}

.dept label small {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

.dept input:checked + label {
  color: #fff;
  background: var(--brand);
  border-color: transparent;
}

/* Nicht verfügbare Abteilungen */
.dept.unavailable {
  opacity: 0.4;
  cursor: not-allowed;
}

.dept.unavailable label {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.dept.unavailable input {
  cursor: not-allowed;
}

/* Kalender */
.month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 8px;
}
.month-nav {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--brand);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
}
.month-nav:hover {
  background-color: rgba(44, 42, 226, 0.1);
}
.month-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--brand);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-head {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}
.cal-day {
  border: none;
  border-radius: 6px;
  background: #fff;
  min-height: 32px;
  display: grid;
  place-items: center;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.cal-day.today {
  outline: 2px solid rgba(45, 191, 127, 0.25);
}
.cal-day.selected {
  background: #0f2e2a;
  color: #fff;
  border-color: #0f2e2a;
}

/* Sonntage und Feiertage */
.cal-day.sonntag {
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
}

.cal-day.feiertag {
  background: #fef3c7;
  color: #d97706;
  font-weight: 600;
}

.cal-day.sonntag::after {
  content: "☀️";
  font-size: 10px;
  margin-left: 2px;
}

.cal-day.feiertag::after {
  content: "🎉";
  font-size: 10px;
  margin-left: 2px;
}

/* Slots 3-spaltig für kompaktere Darstellung */
.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  align-content: start;
  border: none;
  margin: 0;
  padding: 0;
}
.slot {
  position: relative;
}
.slot input {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.slot label {
  display: grid;
  place-items: center;
  padding: 8px 6px;
  border: none;
  background: #fff;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.slot input:checked + label {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Formular */
.form {
  display: grid;
  gap: 6px;
}

/* Kompakteres Formular bei Videoberatung (keine Adressfelder) */
.videoberatung .form {
  gap: 4px;
}

.videoberatung .input {
  margin-bottom: 2px;
}

/* Kompakte Formular-Card bei Videoberatung */
.videoberatung #contact-card {
  min-height: auto;
  height: fit-content;
}

/* Info-Card für Videoberatung */
.videoberatung-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.videoberatung-info h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
}

.videoberatung-info ul {
  margin: 0;
  padding-left: 16px;
}

.videoberatung-info li {
  margin-bottom: 4px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: start;
}

/* Vollbreite für einzelne Felder */
.row.full-width {
  grid-template-columns: 1fr;
}

/* Mobile: Eingabefelder untereinander */
@media (max-width: 768px) {
  .widget {
    width: 100%;
    max-width: 450px;
    height: auto;
    min-height: 600px;
  }

  .body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 8px;
  }

  .left-column {
    display: contents; /* Elemente direkt in body einordnen */
  }

  .right-column {
    display: contents; /* Elemente direkt in body einordnen */
  }

  /* Cards für mobile optimieren */
  .card {
    padding: 12px;
    margin-bottom: 8px;
  }

  /* Beratungsarten: Dreispaltig auch auf mobile */
  .beratungsarten {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .beratungsart label {
    min-height: 80px;
    padding: 12px 8px;
  }

  .beratungsart-icon {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .beratungsart-title {
    font-size: 11px;
  }

  /* Standort-Auswahl: 2x2 Grid auf mobile */
  .locations {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .loc label {
    min-height: 36px;
    font-size: 13px;
    padding: 6px 4px;
  }

  /* Abteilungen: Einspaltig auf mobile */
  .departments {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dept label {
    min-height: 44px;
    font-size: 13px;
    padding: 10px 8px;
    text-align: left;
    line-height: 1.2;
    gap: 2px;
  }

  /* Kalender: Kompakter auf mobile */
  .cal-day {
    min-height: 28px;
    font-size: 12px;
  }

  .month-title {
    font-size: 13px;
  }

  /* Zeitslots: 2-spaltig auf mobile */
  .slots {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .slot label {
    padding: 10px 6px;
    font-size: 13px;
  }

  /* Formular: Einspaltig auf mobile */
  .row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .input input,
  .input textarea {
    height: 44px;
    font-size: 16px; /* Verhindert Zoom auf iOS */
  }

  .input textarea {
    height: auto !important;
    min-height: 80px;
  }

  .country-select {
    height: 44px;
    font-size: 14px;
  }

  /* Tooltips: Größer auf mobile */
  .tooltip {
    font-size: 12px;
    padding: 8px 10px;
    max-width: 200px;
    line-height: 1.4;
  }

  /* Button: Größer auf mobile */
  .btn {
    padding: 12px 16px;
    font-size: 15px;
    min-height: 48px;
  }

  /* Summary: Kompakter auf mobile */
  .summary-bar {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 40px;
  }

  .summary-edit {
    padding: 6px 10px;
    font-size: 12px;
    margin-left: -8px; /* Weiter nach links */
  }

  /* Horizontales Scrollen unterdrücken */
  body {
    overflow-x: hidden;
  }

  .widget {
    overflow-x: hidden;
  }

  /* Section-Titel: Kompakter auf mobile */
  .section-title {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .step-number {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .step-status {
    font-size: 10px;
  }
}

/* Sehr kleine Bildschirme (iPhone SE, etc.) */
@media (max-width: 375px) {
  .widget {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    height: 100vh;
    min-height: 100vh;
  }

  .body {
    padding: 6px;
    gap: 8px;
  }

  .card {
    padding: 8px;
    margin-bottom: 6px;
  }

  /* Beratungsarten: Dreispaltig auch auf sehr kleinen Bildschirmen */
  .beratungsarten {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .beratungsart label {
    min-height: 50px;
    padding: 8px 4px;
  }

  .beratungsart-icon {
    font-size: 18px;
    margin-bottom: 4px;
  }

  .beratungsart-title {
    font-size: 10px;
  }

  /* Standorte: Einspaltig auf sehr kleinen Bildschirmen */
  .locations {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .loc label {
    min-height: 32px;
    font-size: 12px;
  }

  /* Zeitslots: Einspaltig auf sehr kleinen Bildschirmen */
  .slots {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .slot label {
    padding: 8px 4px;
    font-size: 12px;
  }

  /* Kalender: Noch kompakter */
  .cal-day {
    min-height: 24px;
    font-size: 11px;
  }

  .month-title {
    font-size: 12px;
  }

  /* Formular: Kompakter */
  .input input,
  .input textarea {
    height: 40px;
    font-size: 16px;
  }

  .input textarea {
    min-height: 70px;
  }

  .country-select {
    height: 40px;
    font-size: 13px;
  }

  /* Button: Kompakter */
  .btn {
    padding: 10px 12px;
    font-size: 14px;
    min-height: 44px;
  }

  /* Summary: Kompakter */
  .summary-bar {
    padding: 6px 8px;
    font-size: 11px;
    min-height: 36px;
  }

  .summary-edit {
    padding: 4px 8px;
    font-size: 11px;
    margin-left: -6px; /* Weiter nach links auf sehr kleinen Bildschirmen */
  }

  /* Section-Titel: Noch kompakter */
  .section-title {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .step-number {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .step-status {
    font-size: 9px;
  }
}

.input {
  display: grid;
  gap: 3px;
  position: relative;
}
.input label {
  font-size: 12px;
  color: var(--muted);
}
.input input,
.input textarea {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 8px;
  font: inherit;
  font-size: 13px;
  transition: border-color 0.2s;
  /* Zoom auf Mobile verhindern */
  font-size: 16px;
  /* Höchster z-index für Input-Felder */
  position: relative;
  z-index: 99999;
  resize: vertical;
  min-height: 20px;
  height: 48px; /* Einheitliche Höhe für alle Input-Felder */
  box-sizing: border-box;
}

/* Textarea spezielle Höhe */
.input textarea {
  height: auto !important;
  min-height: 80px;
}

.input input:focus,
.input textarea:focus {
  outline: none;
  border-color: var(--brand);
}

/* Telefon-Container */
.phone-container {
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

.country-select {
  flex: 0 0 auto;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  min-width: 80px;
  height: 48px; /* Gleiche Höhe wie Input-Felder */
  box-sizing: border-box;
}

.country-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.phone-container input {
  flex: 1;
  margin: 0;
  height: 48px; /* Gleiche Höhe wie andere Input-Felder */
  box-sizing: border-box;
}

.input input.error {
  border-color: #dc2626;
  background-color: #fef2f2;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.1);
}

.input input.valid {
  border-color: #059669;
  background-color: #f0fdf4;
  box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.1);
}

.tooltip {
  position: absolute;
  background: #dc2626;
  color: white;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: normal;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  top: -50px;
  left: 0;
  width: 180px;
}

.tooltip::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #dc2626;
}

/* Mobile Tooltip Anpassungen */
@media (max-width: 480px) {
  .tooltip {
    font-size: 12px;
    padding: 8px 10px;
    max-width: 180px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
  }
}

.tooltip.show {
  opacity: 1;
  visibility: visible;
}

/* Tooltip Positionierung über den Eingabefeldern */
.tooltip.show {
  position: absolute !important;
  z-index: 999999 !important;
}

/* Footer */
.foot {
  border-top: 1px solid #eceff1;
  background: #fff;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}
.btn {
  border: 0;
  border-radius: var(--r);
  padding: 10px 14px;
  font-weight: 600;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.copyright {
  text-align: center;
  margin-top: 12px;
  font-size: 11px;
  color: #888;
  opacity: 0.7;
  grid-column: 1 / -1; /* Spannt über alle Spalten */
}
