/*
 * Online-Rezeption Product Forms
 *
 * Produkt-CSS fuer Fluent Forms und spaeter eigene Produktformulare.
 * Nichts greift ausserhalb eines Containers mit der Klasse .hh-form-shell.
 * Praxisdesign wird nur ueber CSS-Variablen angepasst.
 */

/* ================================================================
   1. PRODUCT SCOPE + FALLBACK TOKENS
   ================================================================ */

.hh-form-shell {
  --hh-ui-font: var(--hh-practice-font, inherit);
  --hh-ui-text: var(--hh-practice-text, #1d1d1f);
  --hh-ui-heading: var(--hh-practice-heading, #111827);
  --hh-ui-muted: var(--hh-practice-muted, #6e6e73);
  --hh-ui-primary: var(--hh-practice-primary, #0071e3);
  --hh-ui-primary-hover: var(--hh-practice-primary-hover, #0066cc);
  --hh-ui-primary-text: var(--hh-practice-primary-text, #ffffff);
  --hh-ui-button-dark: var(--hh-practice-button-dark, #0071e3);
  --hh-ui-button-dark-hover: var(--hh-practice-button-dark-hover, #0066cc);
  --hh-ui-button-dark-text: var(--hh-practice-button-dark-text, #ffffff);
  --hh-ui-button-light: var(--hh-practice-button-light, #e9f2ff);
  --hh-ui-button-light-hover: var(--hh-practice-button-light-hover, #d7eaff);
  --hh-ui-button-light-text: var(--hh-practice-button-light-text, #0057b8);
  --hh-ui-button-radius: var(--hh-practice-button-radius, 999px);
  --hh-ui-button-min-height: var(--hh-practice-button-min-height, 44px);
  --hh-ui-button-padding-block: var(--hh-practice-button-padding-block, 0.8em);
  --hh-ui-button-padding-inline: var(--hh-practice-button-padding-inline, 1.2em);
  --hh-ui-accent: var(--hh-practice-accent, #34c759);
  --hh-ui-accent-hover: var(--hh-practice-accent-hover, #2da44e);
  --hh-ui-accent-text: var(--hh-practice-accent-text, #ffffff);
  --hh-ui-surface: var(--hh-practice-surface, #ffffff);
  --hh-ui-surface-soft: var(--hh-practice-surface-soft, #fbfbfd);
  --hh-ui-border: var(--hh-practice-border, rgba(60, 60, 67, 0.18));
  --hh-ui-border-strong: var(--hh-practice-border-strong, rgba(60, 60, 67, 0.3));
  --hh-ui-danger: var(--hh-practice-danger, #be123c);
  --hh-ui-danger-soft: var(--hh-practice-danger-soft, #fff1f2);
  --hh-ui-danger-text: var(--hh-practice-danger-text, #5f1828);
  --hh-ui-radius: var(--hh-practice-radius, 16px);
  --hh-ui-card-radius: var(--hh-practice-card-radius, calc(var(--hh-ui-radius) + 2px));
  --hh-ui-radius-control: var(--hh-practice-radius-control, 14px);
  --hh-ui-control-height: var(--hh-practice-control-height, 48px);
  --hh-ui-control-padding-inline: var(--hh-practice-control-padding-inline, 14px);
  --hh-ui-choice-min-width: var(--hh-practice-choice-min-width, 80px);
  --hh-ui-focus-ring: var(--hh-practice-focus-ring, 0 0 0 4px rgba(0, 113, 227, 0.18));
  --hh-ui-transition: 160ms ease;

  color: var(--hh-ui-text);
  background: var(--hh-ui-surface);
  font-family: var(--hh-ui-font);
  font-size: var(--hh-practice-base-font-size, 16px);
}

.hh-form-shell,
.hh-form-shell *,
.hh-form-shell *::before,
.hh-form-shell *::after {
  box-sizing: border-box;
}

/* ================================================================
   2. TYPOGRAPHY + FORM RHYTHM
   ================================================================ */

.hh-form-shell .fluentform {
  color: var(--hh-ui-text);
  font-family: inherit;
}

.hh-form-shell .fluentform :where(h2, h3, h4) {
  margin-top: 0;
  color: var(--hh-ui-heading);
  font-family: inherit;
  letter-spacing: 0;
}

.hh-form-shell .fluentform .ff-el-group {
  margin-bottom: 18px;
}

.hh-form-shell .fluentform .ff-el-input--label {
  margin-bottom: 7px;
}

.hh-form-shell .fluentform .ff-el-input--label,
.hh-form-shell .fluentform .ff-el-input--label label {
  color: var(--hh-ui-heading);
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
}

.hh-form-shell .fluentform .ff-el-form-check-label,
.hh-form-shell .fluentform .ff-el-form-check-label span {
  color: var(--hh-ui-text);
  font: inherit;
  font-weight: 400;
}

/* ================================================================
   3. INPUTS, SELECTS, TEXTAREAS + FILES
   ================================================================ */

.hh-form-shell .fluentform .ff-el-form-control {
  width: 100%;
  min-height: var(--hh-ui-control-height);
  border: 1px solid var(--hh-ui-border);
  background: color-mix(in srgb, var(--hh-ui-surface) 96%, var(--hh-ui-surface-soft));
  color: var(--hh-ui-text);
  font: inherit;
  font-weight: 400;
  line-height: 1.35;
  transition:
    border-color var(--hh-ui-transition),
    box-shadow var(--hh-ui-transition),
    background-color var(--hh-ui-transition);
}

.hh-form-shell .fluentform :where(input, select).ff-el-form-control {
  height: var(--hh-ui-control-height) !important;
  min-height: var(--hh-ui-control-height) !important;
  padding: 0 var(--hh-ui-control-padding-inline) !important;
  border-radius: var(--hh-ui-radius-control);
}

.hh-form-shell .fluentform textarea.ff-el-form-control {
  min-height: 120px;
  padding: 13px 16px;
  resize: vertical;
  border-radius: var(--hh-ui-card-radius);
}

.hh-form-shell .fluentform .ff-el-form-control::placeholder {
  color: var(--hh-ui-muted);
  font-weight: 400;
  opacity: 0.78;
}

.hh-form-shell .fluentform .ff-el-form-control:hover {
  border-color: var(--hh-ui-border-strong);
}

.hh-form-shell .fluentform .ff-el-form-control:focus,
.hh-form-shell .fluentform .ff-el-form-control:focus-visible {
  outline: 0;
  border-color: var(--hh-ui-accent);
  box-shadow: var(--hh-ui-focus-ring);
}

.hh-form-shell .fluentform .ff-el-is-error .ff-el-form-control,
.hh-form-shell .fluentform .ff-el-form-control.error {
  border-color: var(--hh-ui-danger);
}

.hh-form-shell .fluentform :where(
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"]
).ff-el-form-control {
  min-height: var(--hh-ui-control-height);
  height: auto;
  padding-right: 44px;
  appearance: auto;
  -webkit-appearance: auto;
  color-scheme: light;
  pointer-events: auto;
}

.hh-form-shell .fluentform :where(
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"]
)::-webkit-calendar-picker-indicator {
  width: 32px;
  height: 32px;
  margin-right: -7px;
  opacity: 1;
  cursor: pointer;
  pointer-events: auto;
}

.hh-form-shell .fluentform input[type="file"].ff-el-form-control {
  min-height: var(--hh-ui-control-height);
  padding: 6px;
}

.hh-form-shell .fluentform input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 10px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--hh-ui-radius-control);
  background: var(--hh-ui-primary);
  color: var(--hh-ui-primary-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ================================================================
   4. RADIO + CHECKBOX PILLS
   Terms/consent fields keep their native checkbox layout.
   ================================================================ */

.hh-form-shell .fluentform .ff-el-form-check:not(.ff-el-tc) {
  position: relative;
  display: inline-flex;
  margin: 6px 8px 6px 0;
  vertical-align: top;
}

.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc)
  .ff-el-form-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc)
  .ff-el-form-check-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--hh-ui-choice-min-width);
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid var(--hh-ui-border-strong);
  border-radius: var(--hh-ui-radius-control);
  background: color-mix(in srgb, var(--hh-ui-surface) 86%, var(--hh-ui-surface-soft));
  color: var(--hh-ui-text);
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition:
    color var(--hh-ui-transition),
    border-color var(--hh-ui-transition),
    background-color var(--hh-ui-transition),
    transform var(--hh-ui-transition),
    box-shadow var(--hh-ui-transition);
}

.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc)
  .ff-el-form-check-label span {
  color: inherit;
  pointer-events: none;
}

.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc)
  .ff-el-form-check-label:hover {
  border-color: var(--hh-ui-button-dark);
  transform: translateY(-1px);
}

.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc).ff_item_selected
  .ff-el-form-check-label,
.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc):has(.ff-el-form-check-input:checked)
  .ff-el-form-check-label {
  border-color: var(--hh-ui-button-dark);
  background: var(--hh-ui-button-dark);
  color: var(--hh-ui-button-dark-text);
}

.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc):has(.ff-el-form-check-input:focus-visible)
  .ff-el-form-check-label {
  box-shadow: var(--hh-ui-focus-ring);
}

.hh-form-shell .fluentform
  .ff-el-form-check:not(.ff-el-tc)
  .ff-el-form-check-label:active {
  transform: scale(0.98);
}

.hh-form-shell .fluentform .ff-el-tc .ff-el-form-check-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.45;
}

.hh-form-shell .fluentform .ff-el-tc .ff-el-form-check-input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--hh-ui-accent);
}

/* ================================================================
   5. FORM BUTTONS
   ================================================================ */

.hh-form-shell .fluentform :where(.ff-btn, button.ff-btn, .ff-btn-submit) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  min-width: 0 !important;
  min-height: var(--hh-ui-button-min-height) !important;
  height: auto !important;
  padding: var(--hh-ui-button-padding-block) var(--hh-ui-button-padding-inline) !important;
  border: 1px solid transparent;
  border-radius: var(--hh-ui-button-radius) !important;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  transition:
    background-color var(--hh-ui-transition),
    color var(--hh-ui-transition),
    border-color var(--hh-ui-transition),
    transform var(--hh-ui-transition),
    box-shadow var(--hh-ui-transition);
}

.hh-form-shell .fluentform :where(
  .ff-btn-prev,
  .ff-btn-next,
  .ff-btn-secondary:not(.ff-btn-submit)
) {
  border-color: var(--hh-ui-button-dark) !important;
  background: var(--hh-ui-button-dark) !important;
  color: var(--hh-ui-button-dark-text) !important;
}

.hh-form-shell .fluentform :where(
  .ff-btn-prev,
  .ff-btn-next,
  .ff-btn-secondary:not(.ff-btn-submit)
):hover {
  border-color: var(--hh-ui-button-dark-hover) !important;
  background: var(--hh-ui-button-dark-hover) !important;
}

.hh-form-shell .fluentform .ff-btn-submit {
  border-color: var(--hh-ui-button-light) !important;
  background: var(--hh-ui-button-light) !important;
  color: var(--hh-ui-button-light-text) !important;
}

.hh-form-shell .fluentform .ff-btn-submit:hover {
  border-color: var(--hh-ui-button-light-hover) !important;
  background: var(--hh-ui-button-light-hover) !important;
}

.hh-form-shell .fluentform :where(.ff-btn, .ff-btn-submit):focus-visible {
  outline: 0;
  box-shadow: var(--hh-ui-focus-ring);
}

.hh-form-shell .fluentform :where(.ff-btn, .ff-btn-submit):active {
  transform: translateY(1px);
}

.hh-form-shell .fluentform :where(.ff-btn, .ff-btn-submit):disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ================================================================
   6. MULTI-STEP PROGRESS
   ================================================================ */

.hh-form-shell .fluentform .ff-step-progress-wrap {
  margin-bottom: 22px;
}

.hh-form-shell .fluentform .ff-el-progress {
  height: 8px;
  overflow: hidden;
  border-radius: var(--hh-ui-radius-control);
  background: var(--hh-ui-surface-soft);
}

.hh-form-shell .fluentform .ff-el-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--hh-ui-accent);
}

.hh-form-shell .fluentform .ff-el-progress-bar span {
  display: none;
}

.hh-form-shell .fluentform .ff-el-progress-status {
  margin-bottom: 7px;
  color: var(--hh-ui-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

/* ================================================================
   7. REPEATER
   ================================================================ */

.hh-form-shell .fluentform .ff_repeater_table {
  width: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hh-form-shell .fluentform .ff_repeater_table :where(tr, td) {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hh-form-shell .fluentform .ff_repeater_table :where(
  .ff-el-repeat-buttons-list,
  .js-repeat-buttons
) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.hh-form-shell .fluentform .ff_repeater_table :where(
  .repeat-plus,
  .repeat-minus
) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 50%;
  background: transparent !important;
  color: var(--hh-ui-text);
  line-height: 1;
  box-shadow: none !important;
  cursor: pointer;
}

.hh-form-shell .fluentform .ff_repeater_table :where(
  .repeat-plus,
  .repeat-minus
):focus-visible {
  outline: 0;
  box-shadow: var(--hh-ui-focus-ring);
}

.hh-form-shell .fluentform .ff_repeater_table :where(
  .repeat-plus,
  .repeat-minus
) svg {
  display: block;
}

/* ================================================================
   8. DYNAMIC NOTICES
   ================================================================ */

.hh-form-shell .hh-ff-notice {
  margin: 14px 0;
  padding: 13px 15px;
  border: 1px solid rgba(190, 18, 60, 0.18);
  border-left: 4px solid var(--hh-ui-danger);
  border-radius: var(--hh-ui-radius);
  background: var(--hh-ui-danger-soft);
  color: var(--hh-ui-danger-text);
  font-weight: 600;
  line-height: 1.45;
}

.hh-form-shell .hh-ff-notice span {
  color: var(--hh-ui-danger-text);
  font-weight: 700;
  white-space: nowrap;
}

/* ================================================================
   9. SUCCESS STATE
   ================================================================ */

.hh-form-shell.hh-form-is-success > :not(.popup-close):not(.hh-form-success) {
  display: none !important;
}

.hh-form-shell .hh-form-success {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 300px;
  padding: 44px 24px;
  color: var(--hh-ui-text);
  text-align: center;
  outline: 0;
}

.hh-form-shell .hh-form-success-icon {
  position: relative;
  display: block;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--hh-ui-button-light);
}

.hh-form-shell .hh-form-success-icon::after {
  position: absolute;
  top: 13px;
  left: 19px;
  width: 12px;
  height: 21px;
  border-right: 3px solid var(--hh-ui-button-light-text);
  border-bottom: 3px solid var(--hh-ui-button-light-text);
  content: "";
  transform: rotate(45deg);
}

.hh-form-shell .hh-form-success-title {
  max-width: 560px;
  margin: 0;
  color: var(--hh-ui-heading);
  font-size: 26px;
  line-height: 1.2;
}

.hh-form-shell .hh-form-success-message,
.hh-form-shell .hh-form-success-note {
  max-width: 580px;
  margin: 12px 0 0;
  color: var(--hh-ui-text);
  line-height: 1.5;
}

.hh-form-shell .hh-form-success-note {
  margin-top: 8px;
  color: var(--hh-ui-muted);
  font-size: 0.9em;
}

/* Hide Fluent's own confirmation while the product state is visible. */
.hh-form-shell.hh-form-is-success .ff-message-success {
  display: none !important;
}

/* ================================================================
   10. POPUP CONTROLS + SCROLLBARS
   ================================================================ */

.hh-form-shell.popup-close,
.hh-form-shell .popup-close,
.hh-form-shell.popup-close:hover,
.hh-form-shell .popup-close:hover,
.hh-form-shell.popup-close:focus,
.hh-form-shell .popup-close:focus,
.hh-form-shell.popup-close:focus-visible,
.hh-form-shell .popup-close:focus-visible,
.hh-form-shell.popup-close:active,
.hh-form-shell .popup-close:active {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.hh-form-shell .popup-close svg {
  display: block;
  border: 0 !important;
  outline: 0;
  box-shadow: none;
}

.hh-form-shell {
  scrollbar-width: thin;
  scrollbar-color: var(--hh-ui-primary) transparent;
}

.hh-form-shell::-webkit-scrollbar {
  width: 8px;
}

.hh-form-shell::-webkit-scrollbar-track {
  background: transparent;
}

.hh-form-shell::-webkit-scrollbar-thumb {
  border-radius: var(--hh-ui-radius-control);
  background: var(--hh-ui-primary);
}

/* ================================================================
   11. RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
  .hh-form-shell .hh-form-success {
    min-height: 240px;
    padding: 36px 16px;
  }

  .hh-form-shell .hh-form-success-title {
    font-size: 23px;
  }

  .hh-form-shell .fluentform .ff-el-group {
    margin-bottom: 16px;
  }

  .hh-form-shell .fluentform .ff-el-form-control {
    font-size: 16px;
  }

  .hh-form-shell .fluentform :where(.ff-btn, .ff-btn-submit) {
    min-height: var(--hh-ui-button-min-height) !important;
    padding: var(--hh-ui-button-padding-block) var(--hh-ui-button-padding-inline) !important;
  }

  .hh-form-shell .fluentform .ff_repeater_table :where(tr, td) {
    margin: 0;
    padding: 0;
  }

  .hh-form-shell .fluentform .ff_repeater_table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .hh-form-shell .fluentform .ff_repeater_table td.repeat_btn {
    margin: 0;
    padding: 0;
  }

  .hh-form-shell .fluentform .ff_repeater_table :where(
    .ff-el-repeat-buttons-list,
    .js-repeat-buttons
  ) {
    margin: 0;
    padding: 0;
    line-height: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hh-form-shell *,
  .hh-form-shell *::before,
  .hh-form-shell *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
