/* ============================================================
   CX-UI — Typ-Modul: TOOL (Rechner, Generatoren, Finder)
   Sites: studierenguru, aktienrenterechner, renditerechner24,
   quittungsgenerator24, immobilienrechner24, steuernsparen,
   fixflip.one, hausratversicherung, spekulationsfristrechner24,
   finanzierungrechner24, immobiliewertrechner24, wallbox,
   cannavergleich, stress-abbauen-tipps, influencerfee
   ============================================================ */

/* Zweispaltiges Rechner-Layout: Eingabe links, Ergebnis rechts (sticky) */
.cx-tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  gap: var(--cx-s6);
  align-items: start;
}
.cx-tool--wide-result { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); }
.cx-tool--single { grid-template-columns: minmax(0, 1fr); }

.cx-tool__form,
.cx-tool__result {
  background: var(--cx-white);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-r-lg);
  padding: var(--cx-s6);
}
.cx-tool__result { position: sticky; top: calc(var(--cx-header-h) + var(--cx-s4)); }
.cx-tool__result--accent { background: var(--cx-accent-light); border-color: transparent; }

/* --- Formularfelder --- */

.cx-field { margin-bottom: var(--cx-s5); }
.cx-field:last-child { margin-bottom: 0; }

.cx-label {
  display: block;
  margin-bottom: var(--cx-s2);
  font-size: var(--cx-fs-base);
  font-weight: 600;
  color: var(--cx-text);
}
.cx-hint { display: block; margin-top: var(--cx-s1); font-size: var(--cx-fs-xs); color: var(--cx-text-light); }

.cx-input, .cx-select, .cx-textarea {
  width: 100%;
  padding: 10px var(--cx-s3);
  font-size: var(--cx-fs-md);
  color: var(--cx-text);
  background: var(--cx-white);
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-r);
  transition: border-color var(--cx-t), box-shadow var(--cx-t);
  appearance: none;
}
.cx-input:focus, .cx-select:focus, .cx-textarea:focus {
  outline: none;
  border-color: var(--cx-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cx-accent) 15%, transparent);
}
.cx-textarea { min-height: 120px; resize: vertical; }
.cx-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--cx-s3) center;
  padding-right: var(--cx-s7);
}

/* Feld mit Einheit (EUR, %, m2) */
.cx-input-group { display: flex; align-items: stretch; }
.cx-input-group .cx-input { border-radius: var(--cx-r) 0 0 var(--cx-r); }
.cx-input-group__unit {
  display: grid; place-items: center;
  padding-inline: var(--cx-s3);
  background: var(--cx-bg-alt);
  border: 1px solid var(--cx-border);
  border-left: 0;
  border-radius: 0 var(--cx-r) var(--cx-r) 0;
  font-size: var(--cx-fs-base);
  color: var(--cx-text-light);
  white-space: nowrap;
}

/* Slider */
.cx-range { width: 100%; accent-color: var(--cx-accent); margin: var(--cx-s2) 0; }
.cx-range-row { display: flex; justify-content: space-between; font-size: var(--cx-fs-xs); color: var(--cx-text-light); }

/* Radio/Checkbox als Kacheln */
.cx-choices { display: grid; gap: var(--cx-s2); grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.cx-choice { position: relative; }
.cx-choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.cx-choice span {
  display: block; padding: var(--cx-s3); text-align: center;
  font-size: var(--cx-fs-base); font-weight: 500;
  border: 1px solid var(--cx-border); border-radius: var(--cx-r);
  cursor: pointer; transition: all var(--cx-t);
}
.cx-choice input:checked + span { border-color: var(--cx-accent); background: var(--cx-accent-light); color: var(--cx-accent); }
.cx-choice input:focus-visible + span { outline: 2px solid var(--cx-accent); outline-offset: 2px; }

/* --- Ergebnis --- */

.cx-result__main {
  text-align: center;
  padding-bottom: var(--cx-s5);
  margin-bottom: var(--cx-s5);
  border-bottom: 1px solid var(--cx-border);
}
.cx-result__num {
  display: block;
  font-size: var(--cx-fs-4xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: var(--cx-accent);
  font-variant-numeric: tabular-nums;
}
.cx-result__label { font-size: var(--cx-fs-sm); color: var(--cx-text-light); }

.cx-result__rows { display: flex; flex-direction: column; gap: var(--cx-s3); }
.cx-result__row {
  display: flex; justify-content: space-between; gap: var(--cx-s4);
  font-size: var(--cx-fs-base);
}
.cx-result__row dt { color: var(--cx-text-light); }
.cx-result__row dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-result__row--total {
  padding-top: var(--cx-s3);
  border-top: 1px solid var(--cx-border);
  font-size: var(--cx-fs-md);
}
.cx-result__row--total dd { color: var(--cx-accent); }

@media (max-width: 1024px) {
  .cx-tool, .cx-tool--wide-result { grid-template-columns: minmax(0, 1fr); }
  .cx-tool__result { position: static; }
}
@media (max-width: 480px) {
  .cx-tool__form, .cx-tool__result { padding: var(--cx-s4); }
  .cx-result__num { font-size: var(--cx-fs-3xl); }
}
