/* ==========================================================================
   BUHA — Kostenrechner-UI (Designsystem 10) & mehrstufiges Angebotsformular
   (Designsystem 11.4). Zentrale Conversion-Elemente.
   ========================================================================== */

/* ==========================================================================
   Kostenrechner — Layout (Designsystem 10.1)
   ========================================================================== */
.calc {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .calc-grid {
    grid-template-columns: 58fr 42fr;
  }
}

/* --- Eingabe-Spalte ------------------------------------------------------- */
.calc-input {
  padding: var(--s-5);
}

@media (min-width: 1024px) {
  .calc-input {
    padding: var(--s-7);
  }
}

.calc-step {
  margin-bottom: var(--s-6);
}

.calc-step:last-child {
  margin-bottom: 0;
}

.calc-step-label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--c-navy-700);
  margin-bottom: var(--s-3);
}

.calc-step-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c-navy-100);
  color: var(--c-navy-700);
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* --- ① Leistungsbausteine: Karten-Checkboxen (Designsystem 10.2) --------- */
.calc-modules {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .calc-modules {
    grid-template-columns: repeat(2, 1fr);
  }
}

.calc-module {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--c-surface);
  border: 2px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 150ms ease-out, background-color 150ms ease-out;
}

.calc-module:hover {
  border-color: var(--c-navy-100);
}

.calc-module input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.calc-module .cm-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--c-navy-100);
  border-radius: var(--r-sm);
  color: var(--c-navy-700);
}

.calc-module .cm-icon .icon {
  width: 22px;
  height: 22px;
}

.calc-step-label .icon,
.calc-step-num + .icon {
  width: 1.125rem;
  height: 1.125rem;
}

.calc-module .cm-label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--c-navy-700);
  line-height: 1.3;
}

/* Häkchen-Badge oben rechts */
.calc-module .cm-check {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c-navy-700);
  color: #fff;
  display: none;
  place-items: center;
}

.calc-module .cm-check .icon {
  width: 14px;
  height: 14px;
}

/* ausgewählt */
.calc-module input:checked ~ .cm-check {
  display: grid;
}

.calc-module:has(input:checked) {
  border-color: var(--c-navy-700);
  background: var(--c-navy-050);
}

/* Tastatur-Fokus auf der Karte sichtbar machen */
.calc-module input:focus-visible ~ .cm-label,
.calc-module:focus-within {
  outline: 2px solid var(--c-navy-600);
  outline-offset: 2px;
  border-radius: var(--r-md);
}

/* --- ② Belegmenge: Segmented Control ------------------------------------ */
.seg-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2);
}

@media (min-width: 480px) {
  .seg-control {
    grid-template-columns: repeat(4, 1fr);
  }
}

.seg-option {
  position: relative;
}

.seg-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.seg-option label {
  display: block;
  text-align: center;
  padding: var(--s-3) var(--s-2);
  border: 2px solid var(--c-line);
  border-radius: var(--r-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-ink-700);
  cursor: pointer;
  transition: all 150ms ease-out;
}

.seg-option label:hover {
  border-color: var(--c-navy-100);
}

.seg-option input:checked + label {
  border-color: var(--c-navy-700);
  background: var(--c-navy-700);
  color: #fff;
}

.seg-option input:focus-visible + label {
  outline: 2px solid var(--c-navy-600);
  outline-offset: 2px;
}

/* --- ③ Stepper (Mitarbeitende) ------------------------------------------ */
.calc-step--conditional {
  transition: opacity 200ms ease-out, max-height 200ms ease-out;
}

.calc-step--conditional[hidden] {
  display: none;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.stepper button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--c-navy-050);
  color: var(--c-navy-700);
  font-size: 1.25rem;
  font-weight: 600;
}

.stepper button:hover {
  background: var(--c-navy-100);
}

.stepper button:disabled {
  color: var(--c-ink-300);
  cursor: not-allowed;
}

.stepper input {
  width: 64px;
  height: 48px;
  text-align: center;
  border: none;
  border-inline: 1px solid var(--c-line);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.0625rem;
  color: var(--c-navy-700);
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- ④ Radio-Gruppe (Buchführungsart) ----------------------------------- */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
}

/* --- Ergebnis-Spalte (Designsystem 10.3) -------------------------------- */
.calc-result {
  background: var(--c-navy-800);
  color: rgba(255, 255, 255, 0.85);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .calc-result {
    padding: var(--s-7);
  }
}

.calc-result-head {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: var(--s-4);
}

.calc-price {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: #fff;
}

@media (min-width: 1024px) {
  .calc-price {
    font-size: 3.25rem;
  }
}

.calc-price-unit {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.72);
  margin-top: var(--s-1);
}

/* Aufschlüsselung */
.calc-breakdown {
  margin-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: var(--s-4);
}

.calc-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  font-size: 0.9375rem;
}

.calc-breakdown-row .cb-label {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: rgba(255, 255, 255, 0.85);
}

.calc-breakdown-row .cb-label::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--c-amber-400);
  flex-shrink: 0;
}

.calc-breakdown-row .cb-value {
  font-family: var(--font-mono);
  color: #fff;
  white-space: nowrap;
}

/* Leerzustand */
.calc-empty {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
}

/* Disclaimer */
.calc-disclaimer {
  margin-top: var(--s-5);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
}

/* Ergebnis-Aktionen */
.calc-actions {
  margin-top: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Wert-Wechsel-Fade beim Update */
.calc-price.is-updating {
  animation: calc-fade 300ms ease-out;
}

@keyframes calc-fade {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .calc-price.is-updating {
    animation: none;
  }
}

/* Mobile Sticky-Ergebnisstreifen */
.calc-sticky {
  position: sticky;
  bottom: 64px;
  z-index: 5;
  background: var(--c-navy-800);
  color: #fff;
  padding: var(--s-3) var(--s-4);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  box-shadow: 0 -6px 20px rgba(11, 27, 51, 0.2);
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.calc-sticky .cs-price {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.25rem;
}

@media (max-width: 1023px) {
  .calc-sticky.is-active {
    display: flex;
  }
}

/* ==========================================================================
   Mehrstufiges Angebotsformular (Designsystem 11.4)
   ========================================================================== */
.form-steps {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5);
}

@media (min-width: 768px) {
  .form-steps {
    padding: var(--s-7);
  }
}

/* Stepper-Leiste */
.stepper-bar {
  display: flex;
  align-items: center;
  margin-bottom: var(--s-6);
}

.stepper-bar-item {
  display: flex;
  align-items: center;
  flex: 1;
}

.stepper-bar-item:last-child {
  flex: 0;
}

.stepper-dot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

.stepper-dot .sd-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c-navy-100);
  color: var(--c-navy-700);
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.stepper-dot .sd-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-ink-500);
  display: none;
}

@media (min-width: 600px) {
  .stepper-dot .sd-label {
    display: inline;
  }
}

.stepper-bar-line {
  flex: 1;
  height: 2px;
  background: var(--c-navy-100);
  margin-inline: var(--s-3);
}

/* aktueller Schritt */
.stepper-bar-item.is-current .sd-circle {
  background: var(--c-amber-500);
  color: var(--c-navy-900);
}

.stepper-bar-item.is-current .sd-label {
  color: var(--c-navy-700);
}

/* erledigter Schritt */
.stepper-bar-item.is-done .sd-circle {
  background: var(--c-navy-700);
  color: #fff;
}

.stepper-bar-item.is-done .stepper-bar-line {
  background: var(--c-navy-700);
}

/* mobile Fortschritts-Anzeige */
.step-progress-mobile {
  display: none;
  margin-bottom: var(--s-5);
}

@media (max-width: 599px) {
  .stepper-bar {
    display: none;
  }
  .step-progress-mobile {
    display: block;
  }
}

.step-progress-mobile .spm-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-navy-700);
  margin-bottom: var(--s-2);
}

.step-progress-mobile .spm-bar {
  height: 6px;
  background: var(--c-navy-100);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.step-progress-mobile .spm-fill {
  height: 100%;
  background: var(--c-amber-500);
  border-radius: var(--r-pill);
  transition: width 200ms ease-out;
}

/* Schritt-Panels */
.form-step-panel {
  display: none;
}

.form-step-panel.is-active {
  display: block;
}

.form-step-panel h3 {
  margin-bottom: var(--s-2);
}

.form-step-panel > p {
  margin-bottom: var(--s-5);
  color: var(--c-ink-700);
}

/* Navigations-Buttons */
.form-step-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-6);
}

.form-step-nav .btn-back {
  margin-right: auto;
}

@media (max-width: 599px) {
  .form-step-nav {
    flex-direction: column-reverse;
  }
  .form-step-nav .btn {
    width: 100%;
  }
}

/* Trust-Spalte (Sticky) */
.form-trust-aside {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

@media (min-width: 1024px) {
  .form-trust-aside {
    position: sticky;
    top: 104px;
  }
}

/* Vorbefüllt-Hinweis */
.prefill-note {
  display: none;
  background: var(--c-success-bg);
  border-left: 4px solid var(--c-success);
  border-radius: var(--r-md);
  padding: var(--s-4);
  margin-bottom: var(--s-5);
  font-size: 0.9375rem;
}

.prefill-note.is-visible {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
}

.prefill-note .icon {
  color: var(--c-success);
  flex-shrink: 0;
}
