/* Step 2: date + section (after department selection) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-date,
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-section-date {
  display: none;
}
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-2-active .rwo-field-date,
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-2-active .rwo-field-section-date {
  display: block;
}

/* Step 3: time slots (after date selection) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots {
  display: none;
}
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-slots-active .rwo-field-slots {
  display: block;
}

/* Step 4: contact fields + submit (after slot selection) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-section-contact,
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-name,
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-phone,
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-email,
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-notes,
body .gform_wrapper.terminbuchung-form_wrapper:not(.rwo-step-4-active) .gform_footer {
  display: none;
}
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-4-active .rwo-field-section-contact,
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-4-active .rwo-field-name,
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-4-active .rwo-field-phone,
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-4-active .rwo-field-email,
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-4-active .rwo-field-notes {
  display: block;
}
body .gform_wrapper.terminbuchung-form_wrapper.rwo-step-4-active .gform_footer {
  display: flex;
}

/* Column gap override (GF default: 2rem) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gfield_checkbox {
  column-gap: 8px;
}

/* Choice container */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin: 0 0 8px 0;
  position: relative;
}

/* GF reserves 32px for checkbox; not needed since checkbox is hidden */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gfield-choice-input + label {
  max-width: 100%;
}

/* Slot card (Kernzeit default) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice label {
  display: block;
  padding: 10px 8px;
  border-radius: 8px;
  border: 1.5px solid #7a7a7a;
  background: #f3f3f3;
  text-align: center;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #3f3f3f;
  transition: all 0.15s ease;
  line-height: 1.3;
}

/* Hide native checkbox */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Hover (Kernzeit) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice label:hover {
  border-color: #5f5f5f;
  background: #e8e8e8;
}

/* Checked state (both types) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice input:checked + label {
  border-color: #6AB023;
  background: #6AB023;
  color: #fff;
}

/* Randzeit (highlighted) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.gf-randzeit label {
  background: #D7ECC6;
  border-color: #6AB023;
  color: #3E6615;
}
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.gf-randzeit label:hover {
  background: #c5e3ad;
  border-color: #5a9a1e;
}
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.gf-randzeit input:checked + label {
  background: #6AB023;
  border-color: #5a9a1e;
  color: #fff;
}

/* Live availability states */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.rwo-slot-partial label {
  border-color: #d48a8a;
}
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.rwo-slot-unavailable label,
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.rwo-slot-unavailable input:checked + label {
  background: #faeeee;
  border-color: #d48a8a;
  border-width: 1.5px;
  color: #8a3a3a;
  cursor: not-allowed;
  opacity: 1;
  box-shadow: none;
}
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.rwo-slot-unavailable label:hover {
  background: #faeeee;
  border-color: #d48a8a;
}
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.rwo-slot-unavailable input[type="checkbox"] {
  pointer-events: none;
}

/* Hidden slots (Saturday filter) */
body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gchoice.gf-slot-hidden {
  display: none;
}

/* Legend (inserted by JS) */
body .gform_wrapper.terminbuchung-form_wrapper .gf-termin-legende {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
body .gform_wrapper.terminbuchung-form_wrapper .gf-termin-legende span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
}
body .gform_wrapper.terminbuchung-form_wrapper .gf-termin-legende .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
body .gform_wrapper.terminbuchung-form_wrapper .gf-termin-legende .dot-rand {
  background: #D7ECC6;
  border: 1px solid #6AB023;
}
body .gform_wrapper.terminbuchung-form_wrapper .gf-termin-legende .dot-kern {
  background: #f3f3f3;
  border: 1px solid #7a7a7a;
}

/* Sunday notice */
body .gform_wrapper.terminbuchung-form_wrapper .gf-sonntag-hinweis {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 13px;
  color: #856404;
  margin-bottom: 12px;
}

/* Responsive: GF provides column-count:5 above 641px */
@media only screen and (max-width: 640px) {
  body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gfield_checkbox {
    column-count: 3;
  }
}
@media only screen and (max-width: 480px) {
  body .gform_wrapper.terminbuchung-form_wrapper .rwo-field-slots .gfield_checkbox {
    column-count: 2;
  }
}
