/* SurveyJS theme – Haus des Stiftens */

:root {
  --hds-primary: #7d9b38;
  --hds-primary-dark: #6d8731;
  --hds-primary-light: rgba(125, 155, 56, 0.12);
  --hds-text: #333333;
  --hds-text-muted: #555555;
  --hds-border: #e0e0e0;
  --hds-bg: #f5f7fa;
  --hds-bg-end: #e8ecf1;
  --hds-surface: #ffffff;
  --hds-error: #e50a3e;
  --radius: 6px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --font: "Public Sans", system-ui, -apple-system, sans-serif;
  --sjs-base-unit: 4px;
}

#surveyContainer {
  --sjs-base-unit: 4px;
  --sjs-corner-radius: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--hds-text);
  background: linear-gradient(135deg, var(--hds-bg) 0%, var(--hds-bg-end) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.top-banner {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 5%;
  background: linear-gradient(
    135deg,
    var(--hds-primary) 0%,
    color-mix(in srgb, var(--hds-primary) 88%, #000) 100%
  );
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo-main {
  height: 44px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.container {
  max-width: 900px;
  margin: 1rem auto 2rem;
  padding: 1.25rem 1.75rem;
  background: var(--hds-surface);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

#result {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.8125rem;
  overflow: auto;
  white-space: pre-wrap;
}

#result:empty {
  display: none;
}

/* SurveyJS – general */

#surveyContainer .sd-root-modern,
#surveyContainer .sd-container-modern {
  background: transparent;
}

#surveyContainer .sd-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--hds-primary);
  margin: 0 0 0.25rem;
  padding: 0;
}

#surveyContainer .sd-description {
  color: var(--hds-text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

#surveyContainer .sd-page__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

#surveyContainer .sd-element {
  padding-bottom: 0.5rem;
}

#surveyContainer .sd-panel {
  margin-bottom: 0.25rem;
}

#surveyContainer .sd-panel {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

#surveyContainer .sd-panel.sd-element--with-frame {
  border: none;
  box-shadow: none;
  background: transparent;
}

#surveyContainer .sd-panel__header {
  display: none;
}

#surveyContainer .sd-panel > .sd-element__content,
#surveyContainer .sd-panel__content {
  padding: 0;
  display: block;
}

#surveyContainer .sd-panel .sd-row--multiple {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 0.25rem;
}

#surveyContainer .sd-panel:has([data-name="stiftungsname"]) .sd-row--multiple {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

#surveyContainer .sd-panel .sd-row--multiple > div {
  width: 100% !important;
  max-width: none !important;
  flex: none !important;
}

#surveyContainer .sd-panel > .sd-element__content > .sd-row,
#surveyContainer .sd-panel__content > .sd-row {
  min-width: 0;
  margin: 0;
}

#surveyContainer .sd-row {
  gap: 0.75rem;
}

@media (max-width: 768px) {
  #surveyContainer .sd-panel .sd-row--multiple {
    grid-template-columns: 1fr;
  }
}

#surveyContainer .sd-question__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--hds-text);
  margin-bottom: 0.25rem;
}

#surveyContainer .sd-question__header {
  margin-bottom: 0.125rem;
}

#surveyContainer .sd-question__required-text {
  color: var(--hds-error);
}

/* Text inputs & textareas */

#surveyContainer .sd-input:not(.sd-dropdown),
#surveyContainer .sd-comment {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.4375rem 0.75rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--hds-text);
  background: var(--hds-surface);
  border: 1.5px solid var(--hds-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#surveyContainer .sd-comment {
  min-height: 3.5rem;
  resize: vertical;
}

#surveyContainer .sd-input:not(.sd-dropdown):hover,
#surveyContainer .sd-comment:hover {
  border-color: #b0b0b0;
}

#surveyContainer .sd-input:not(.sd-dropdown):focus,
#surveyContainer .sd-comment:focus {
  outline: none;
  border-color: var(--hds-primary);
  box-shadow: 0 0 0 3px var(--hds-primary-light);
}

#surveyContainer .sd-input::placeholder,
#surveyContainer .sd-comment::placeholder {
  color: #999999;
}

/* Dropdowns – do not style like plain inputs */

#surveyContainer .sd-dropdown,
#surveyContainer .sd-input.sd-dropdown {
  width: 100%;
  min-height: 2.25rem;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--hds-surface);
  border: 1.5px solid var(--hds-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#surveyContainer .sd-dropdown::after {
  content: "";
  position: absolute;
  right: 0.875rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid #555;
  border-bottom: 2px solid #555;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

#surveyContainer .sd-dropdown:hover,
#surveyContainer .sd-input.sd-dropdown:hover {
  border-color: #b0b0b0;
}

#surveyContainer .sd-dropdown:focus-within,
#surveyContainer .sd-input.sd-dropdown:focus-within {
  outline: none;
  border-color: var(--hds-primary);
  box-shadow: 0 0 0 3px var(--hds-primary-light);
}

#surveyContainer .sd-dropdown__value {
  flex: 1;
  min-width: 0;
  padding-right: 1.75rem;
  color: var(--hds-text);
}

#surveyContainer .sd-dropdown__filter-string-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--hds-text);
  padding: 0;
  outline: none;
  box-shadow: none;
  min-height: auto;
}

#surveyContainer .sd-dropdown__filter-string-input::placeholder {
  color: #999999;
}

#surveyContainer .sd-dropdown_clean-button {
  display: none !important;
}

#surveyContainer .sd-dropdown_chevron-button,
#surveyContainer .sd-dropdown__arrow {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#surveyContainer .sd-dropdown_chevron-button svg,
#surveyContainer .sd-dropdown__arrow svg {
  width: 0.875rem;
  height: 0.875rem;
  display: block;
}

#surveyContainer .sd-dropdown_chevron-button svg path,
#surveyContainer .sd-dropdown__arrow svg path {
  fill: #333333;
}

#surveyContainer .sv-popup__container {
  background: var(--hds-surface);
  border: 1px solid var(--hds-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

#surveyContainer .sd-list__item:hover,
#surveyContainer .sd-list__item--focused {
  background: #f4f6f8;
  color: var(--hds-primary);
}

#surveyContainer .sd-list__item--selected {
  background: var(--hds-primary);
  color: #ffffff;
}

/* Radio & checkbox */

#surveyContainer .sd-selectbase__item {
  margin-bottom: 0.25rem;
}

#surveyContainer .sd-item__decorator {
  border: 2px solid #d0d0d0;
  background: var(--hds-surface);
}

#surveyContainer .sd-item--checked .sd-item__decorator {
  background: var(--hds-primary);
  border-color: var(--hds-primary);
}

#surveyContainer .sd-item__control-label {
  font-size: 0.9375rem;
}

/* Submit */

#surveyContainer .sd-navigation__complete-btn {
  margin-top: 0.25rem;
  padding: 0.625rem 1.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--hds-primary) 0%,
    color-mix(in srgb, var(--hds-primary) 92%, #000) 100%
  );
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#surveyContainer .sd-navigation__complete-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

#surveyContainer .sd-navigation__complete-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

#surveyContainer .sd-completedpage h3 {
  color: var(--hds-primary);
  margin-top: 0;
}

/* Validation */

#surveyContainer .sd-question--error .sd-input,
#surveyContainer .sd-question--error .sd-comment,
#surveyContainer .sd-question--error .sd-dropdown {
  border-color: var(--hds-error);
}

#surveyContainer .sd-question__erbox {
  color: var(--hds-error);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Responsive */

@media (max-width: 768px) {
  .top-banner {
    height: 72px;
    padding: 0 1rem;
  }

  .logo-main {
    height: 40px;
  }

  .container {
    margin: 0.75rem;
    padding: 1.25rem 1rem;
    border-radius: 8px;
  }

  #surveyContainer .sd-input:not(.sd-dropdown),
  #surveyContainer .sd-comment,
  #surveyContainer .sd-dropdown {
    font-size: 16px;
  }

  #surveyContainer .sd-navigation__complete-btn {
    width: 100%;
  }
}
