/*
 * == CS Landeseiten Form - Styles ==
 *
 * Description:   Core stylesheet for the CS Landeseiten Form Gravity Forms wrapper.
 * Includes variables, layout resets, input styling, and animation logic.
 * Author:        Landeseiten.de
 * Version:       2.0.0
 */

/* ================================= */
/* --- 1. Variable Definitions --- */
/* ================================= */
.gform_wrapper.cs-landeseiten-form {
  /* --- Colors --- */
  --landeseiten-form-accent-color: #0073aa;
  --landeseiten-form-accent-contrast: #ffffff;
  --landeseiten-form-text-color: #333333;
  --landeseiten-form-bg-color: #ffffff;
  --landeseiten-form-border-color: #cccccc;
  --landeseiten-form-border-color-light: #e9e9e9;
  --landeseiten-form-disabled-bg: #cccccc;
  --landeseiten-form-disabled-color: #666666;
  --landeseiten-form-progress-color: #00c853;

  /* --- Dimensions --- */
  --landeseiten-form-container-width: 800px;
  --landeseiten-form-mobile-width: 90vw;
  --landeseiten-form-vertical-margin: 40px;
  --landeseiten-form-field-vertical-padding: 30px;
  --landeseiten-form-reveal-padding: 60vh;

  /* --- Footer Spacing (ADDED) --- */
  --landeseiten-form-footer-gap: 15px;
  --landeseiten-form-footer-padding-top: 30px;
  --landeseiten-form-footer-margin-top: 20px;

  /* --- Typography --- */
  --landeseiten-form-label-font-size: 24px;
  --landeseiten-form-label-font-weight: 500;
  --landeseiten-form-label-margin-bottom: 10px;
  --landeseiten-form-input-font-size: 18px;
  --landeseiten-form-button-font-size: 16px;
  --landeseiten-form-button-font-weight: 600;

  /* --- Input Styles --- */
  --landeseiten-form-input-height: 50px;
  --landeseiten-form-input-border-width: 1px;
  --landeseiten-form-input-border-radius: 6px;
  --landeseiten-form-textarea-min-height: 120px;
  --landeseiten-form-textarea-padding: 15px;

  /* --- Choice Styles (Radio/Checkbox) --- */
  --landeseiten-form-choice-padding: 10px 20px;
  --landeseiten-form-choice-margin-bottom: 10px;
  --landeseiten-form-choice-border-radius: 50px;
  --landeseiten-form-choice-font-weight: 500;

  /* --- Buttons --- */
  --landeseiten-form-button-padding: 12px 28px;
  --landeseiten-form-button-border-radius: 6px;
  --landeseiten-form-previous-button-hover-bg: #f5f5f5;

  /* --- Animations --- */
  --landeseiten-form-transition-duration: 0.2s;
  --landeseiten-form-animation-duration: 0.5s;
  --landeseiten-form-hover-brightness: 1.1;
  --landeseiten-form-completed-step-opacity: 0.5;
}

/* ================================= */
/* --- 2. Base Layout & Reset --- */
/* ================================= */

.gform_wrapper.cs-landeseiten-form {
  display: block !important;
  position: relative;
  overflow: visible !important;
  width: min(
    var(--landeseiten-form-mobile-width),
    var(--landeseiten-form-container-width)
  );
  margin: var(--landeseiten-form-vertical-margin) auto;
}

.gform_wrapper.cs-landeseiten-form[data-mode="reveal"] {
  padding-bottom: var(--landeseiten-form-reveal-padding) !important;
}

.gform_wrapper.cs-landeseiten-form .gform_heading,
.gform_wrapper.cs-landeseiten-form .gform_title,
.gform_wrapper.cs-landeseiten-form .gform_description,
.gform_wrapper.cs-landeseiten-form .gform_validation_summary {
  display: none !important;
}

/* ================================= */
/* --- 3. Progress Bar --- */
/* ================================= */

.gform_wrapper.cs-landeseiten-form .lf-progress-container {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  height: 8px !important;
  background-color: #e0e0e0 !important;
  border-radius: 4px !important;
  margin-bottom: 30px !important;
  overflow: hidden !important;
  position: relative !important;
  z-index: 10 !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gform_wrapper.cs-landeseiten-form .lf-progress-bar {
  height: 100% !important;
  background-color: var(--landeseiten-form-progress-color, #00c853) !important;
  width: 0%;
  transition: width 0.4s ease-in-out !important;
  border-radius: 4px !important;
}

/* ==================================== */
/* --- 4. Field Visibility & States --- */
/* ==================================== */

.gform_wrapper.cs-landeseiten-form .gfield:not(.active) {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 0;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
  border: none;
  transition: none;
}

.gform_wrapper.cs-landeseiten-form .gfield.active {
  opacity: 1;
  visibility: visible;
  position: relative;
  height: auto;
  width: 100%;
  padding: var(--landeseiten-form-field-vertical-padding) 0;
}

.gform_wrapper.cs-landeseiten-form[data-mode="reveal"] .gfield.step-completed {
  padding: var(--landeseiten-form-field-vertical-padding) 0;
  opacity: var(--landeseiten-form-completed-step-opacity);
  transition: opacity calc(var(--landeseiten-form-animation-duration) * 0.8)
    ease-out;
}

body.elementor-editor-active .gform_wrapper.cs-landeseiten-form .gfield {
  opacity: 1 !important;
  visibility: visible !important;
  position: relative !important;
  height: auto !important;
  padding: 20px 0 !important;
  border-top: 1px dashed var(--landeseiten-form-border-color-light);
}

/* =============================== */
/* --- 5. Input Field Styling --- */
/* =============================== */

.gform_wrapper.cs-landeseiten-form .top_label .gfield_label {
  color: var(--landeseiten-form-text-color);
  font-size: var(--landeseiten-form-label-font-size) !important;
  font-weight: var(--landeseiten-form-label-font-weight);
  margin-bottom: var(--landeseiten-form-label-margin-bottom);
  text-align: left;
}

.gform_wrapper.cs-landeseiten-form .gfield_required {
  color: #d32f2f;
  font-size: 0.8em;
  margin-left: 4px;
  vertical-align: top;
  text-decoration: none;
}

.gform_wrapper.cs-landeseiten-form .ginput_container {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.gform_wrapper.cs-landeseiten-form
  .ginput_container
  input:not([type="radio"]):not([type="checkbox"]),
.gform_wrapper.cs-landeseiten-form .ginput_container select,
.gform_wrapper.cs-landeseiten-form .ginput_container textarea {
  background-color: var(--landeseiten-form-bg-color);
  border: var(--landeseiten-form-input-border-width) solid
    var(--landeseiten-form-border-color);
  border-radius: var(--landeseiten-form-input-border-radius);
  color: var(--landeseiten-form-text-color);
  font-size: var(--landeseiten-form-input-font-size);
  height: var(--landeseiten-form-input-height);
  width: 100%;
  text-align: center;
  box-sizing: border-box;
  transition: all var(--landeseiten-form-transition-duration) ease-in-out;
}

.gform_wrapper.cs-landeseiten-form .ginput_container input:focus,
.gform_wrapper.cs-landeseiten-form .ginput_container select:focus,
.gform_wrapper.cs-landeseiten-form .ginput_container textarea:focus {
  box-shadow: none !important;
  outline: none !important;
}

.gform_wrapper.cs-landeseiten-form .ginput_container textarea {
  height: auto !important;
  min-height: var(--landeseiten-form-textarea-min-height);
  padding: var(--landeseiten-form-textarea-padding);
  line-height: 1.5;
  text-align: left;
}

.gform_wrapper.cs-landeseiten-form
  input[type="number"]::-webkit-outer-spin-button,
.gform_wrapper.cs-landeseiten-form
  input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.gform_wrapper.cs-landeseiten-form input[type="number"] {
  -moz-appearance: textfield;
}

/* ================================= */
/* --- 6. Choice Fields (Radio/Check) --- */
/* ================================= */

.gform_wrapper.cs-landeseiten-form input[type="radio"],
.gform_wrapper.cs-landeseiten-form input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.gform_wrapper.cs-landeseiten-form .gfield_checkbox,
.gform_wrapper.cs-landeseiten-form .gfield_radio {
  width: 100%;
}
.gform_wrapper.cs-landeseiten-form .gfield_radio .gchoice,
.gform_wrapper.cs-landeseiten-form .gfield_checkbox .gchoice {
  display: flex !important;
}

.gform_wrapper.cs-landeseiten-form .gfield_radio .gchoice label,
.gform_wrapper.cs-landeseiten-form .gfield_checkbox .gchoice label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--landeseiten-form-choice-padding);
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  border: var(--landeseiten-form-input-border-width) solid
    var(--landeseiten-form-border-color);
  border-radius: var(--landeseiten-form-choice-border-radius);
  width: 100%;
  min-height: var(--landeseiten-form-input-height);
  background: var(--landeseiten-form-bg-color);
  color: var(--landeseiten-form-text-color) !important;
  font-size: var(--landeseiten-form-input-font-size) !important;
  font-weight: var(--landeseiten-form-choice-font-weight);
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
  transition: all var(--landeseiten-form-transition-duration) linear;
}

.gform_wrapper.cs-landeseiten-form .gfield_radio .gchoice input:checked + label,
.gform_wrapper.cs-landeseiten-form
  .gfield_checkbox
  .gchoice
  input:checked
  + label {
  background: var(--landeseiten-form-accent-color);
  border-color: var(--landeseiten-form-accent-color);
  color: var(--landeseiten-form-accent-contrast) !important;
}

/* ================================= */
/* --- 7. Consent Field (Privacy) --- */
/* ================================= */

.gform_wrapper.cs-landeseiten-form
  .gfield--type-consent
  .ginput_container_consent {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  margin-top: 15px;
}

.gform_wrapper.cs-landeseiten-form
  .gfield--type-consent
  .ginput_container_consent
  label {
  position: relative;
  padding-left: 35px;
  cursor: pointer;
  font-size: 16px;
  color: var(--landeseiten-form-text-color, #333);
  line-height: 1.5;
  text-align: left;
  user-select: none;
  margin: 0;
  width: auto;
  border: none;
  background: transparent;
}

.gform_wrapper.cs-landeseiten-form
  .gfield--type-consent
  .ginput_container_consent
  label::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--landeseiten-form-border-color, #ccc);
  border-radius: 4px;
  background-color: var(--landeseiten-form-bg-color, #fff);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.gform_wrapper.cs-landeseiten-form
  .gfield--type-consent
  .ginput_container_consent
  label:hover::before {
  border-color: var(--landeseiten-form-accent-color, #0073aa);
}

.gform_wrapper.cs-landeseiten-form
  .gfield--type-consent
  .ginput_container_consent
  input:checked
  + label::before {
  background-color: var(--landeseiten-form-accent-color, #0073aa);
  border-color: var(--landeseiten-form-accent-color, #0073aa);
}

.gform_wrapper.cs-landeseiten-form
  .gfield--type-consent
  .ginput_container_consent
  label::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 5px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gform_wrapper.cs-landeseiten-form
  .gfield--type-consent
  .ginput_container_consent
  input:checked
  + label::after {
  opacity: 1;
}

/* ================================= */
/* --- 8. Validation Errors --- */
/* ================================= */

.gform_wrapper.cs-landeseiten-form .gfield_error .validation_message {
  color: #b80000;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  width: 100%;
  margin-top: 10px;
  padding: 8px 15px;
  background-color: #fbefef;
  border: 1px solid #e5c3c3;
  border-radius: var(--landeseiten-form-input-border-radius);
  box-sizing: border-box;
}

/* ================================= */
/* --- 9. Footer & Navigation --- */
/* ================================= */

.gform_wrapper.cs-landeseiten-form .gform-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--landeseiten-form-footer-gap);
  padding-top: var(--landeseiten-form-footer-padding-top);
  margin-top: var(--landeseiten-form-footer-margin-top);
  border-top: 1px solid var(--landeseiten-form-border-color-light);
}

.gform_wrapper.cs-landeseiten-form .gform_button,
.gform_wrapper.cs-landeseiten-form input[type="submit"].gform_button {
  min-width: max-content !important;
  background: var(--landeseiten-form-accent-color) !important;
  border: 1px solid var(--landeseiten-form-accent-color) !important;
  border-radius: var(--landeseiten-form-button-border-radius) !important;
  padding: var(--landeseiten-form-button-padding) !important;
  color: var(--landeseiten-form-accent-contrast) !important;
  font-size: var(--landeseiten-form-button-font-size) !important;
  font-weight: var(--landeseiten-form-button-font-weight) !important;
  cursor: pointer;
  transition: all var(--landeseiten-form-transition-duration) ease;
  margin-bottom: 16px !important;
}

.gform_wrapper.cs-landeseiten-form .gform_button:hover,
.gform_wrapper.cs-landeseiten-form input[type="submit"].gform_button:hover {
  background-color: var(--landeseiten-form-accent-color);
  filter: brightness(var(--landeseiten-form-hover-brightness));
}

.gform_wrapper.cs-landeseiten-form .gform_button:disabled,
.gform_wrapper.cs-landeseiten-form input[type="submit"].gform_button:disabled {
  background: var(--landeseiten-form-disabled-bg) !important;
  border-color: var(--landeseiten-form-disabled-bg) !important;
  color: var(--landeseiten-form-disabled-color) !important;
  cursor: not-allowed;
  filter: none;
}

.gform_wrapper.cs-landeseiten-form .button-previous {
  background: transparent !important;
  color: var(--landeseiten-form-accent-color) !important;
  border-color: var(--landeseiten-form-border-color) !important;
}

.gform_wrapper.cs-landeseiten-form .button-previous:hover {
  background: var(--landeseiten-form-previous-button-hover-bg) !important;
  border-color: var(--landeseiten-form-border-color) !important;
  filter: none;
}

/* ================================= */
/* --- 10. Animations (Slide) --- */
/* ================================= */

@keyframes slideInFromRight {
  from {
    transform: translateX(50%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slideOutToLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-50%);
    opacity: 0;
  }
}
@keyframes slideInFromLeft {
  from {
    transform: translateX(-50%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slideOutToRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(50%);
    opacity: 0;
  }
}

.gform_wrapper.cs-landeseiten-form[data-mode="paged"] .gfield.active,
.gform_wrapper.cs-landeseiten-form[data-mode="paged"] .gfield.animating-out {
  animation-duration: var(--landeseiten-form-animation-duration);
  animation-fill-mode: forwards;
}

.gform_wrapper.cs-landeseiten-form[data-mode="paged"]:not(.is-reversing)
  .gfield.active {
  animation-name: slideInFromRight;
  animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
}
.gform_wrapper.cs-landeseiten-form[data-mode="paged"]:not(.is-reversing)
  .gfield.animating-out {
  animation-name: slideOutToLeft;
  animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0);
}
.gform_wrapper.cs-landeseiten-form[data-mode="paged"].is-reversing
  .gfield.active {
  animation-name: slideInFromLeft;
  animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
}
.gform_wrapper.cs-landeseiten-form[data-mode="paged"].is-reversing
  .gfield.animating-out {
  animation-name: slideOutToRight;
  animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0);
}

/* ================================= */
/* --- 11. Flatpickr (Calendar) --- */
/* ================================= */

body .ui-datepicker {
  z-index: 0 !important;
  display: none !important;
}
.flatpickr-calendar.open {
  z-index: 99999 !important;
}

.flatpickr-calendar {
  font-family: inherit !important;
  border-radius: var(--landeseiten-form-input-border-radius, 6px) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
  border: none !important;
}

.flatpickr-months {
  background: transparent !important;
  margin-bottom: 10px !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-weight: 600 !important;
  color: var(--landeseiten-form-text-color, #333) !important;
}
.flatpickr-weekday {
  color: var(--landeseiten-form-text-color, #333) !important;
  opacity: 0.6;
  font-weight: 600 !important;
}
.flatpickr-day {
  border-radius: 4px !important;
  color: var(--landeseiten-form-text-color, #333) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: var(--landeseiten-form-accent-color, #0073aa) !important;
  border-color: var(--landeseiten-form-accent-color, #0073aa) !important;
  color: var(--landeseiten-form-accent-contrast, #fff) !important;
}

.flatpickr-day.inRange {
  box-shadow: -5px 0 0 #f0f0f0, 5px 0 0 #f0f0f0 !important;
  background: #f0f0f0 !important;
  border-color: #f0f0f0 !important;
  color: var(--landeseiten-form-text-color, #333) !important;
}

.flatpickr-day.today {
  border-color: var(--landeseiten-form-accent-color, #0073aa) !important;
}
