/* ==========================================================
   Esstisch-Konfigurator (esstisch-konfigurator.html)
   Baut auf dem Anfrage-Stepper aus styles.css auf:
   5 Schritte, breitere Karte, Auswahlkarten, Preisanimation.
   ========================================================== */
.stepper--wide { max-width: 980px; }

/* ---- Auswahlkarten (Radio) ------------------------------- */
.choices {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.choices--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choices--wood,
.choices--frame { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) {
  .choices--wood,
  .choices--frame { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 479px) {
  .choices--3 { grid-template-columns: 1fr; }
  .choice--talk { grid-column: 1 / -1; }
}

.choice { position: relative; display: flex; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 100%;
  padding: 1rem;
  background: var(--paper-0);
  border: 1px solid var(--st-field-border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-normal) var(--ease-standard),
              box-shadow var(--dur-normal) var(--ease-standard),
              transform var(--dur-fast) var(--ease-out);
}
.choice:active .choice__card { transform: scale(0.985); }
/* Häkchen oben rechts */
.choice__card::after {
  content: "";
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink-900) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c4a880' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px no-repeat;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 150ms ease, transform 200ms var(--ease-out);
}
.choice input:checked + .choice__card {
  border-color: var(--ink-900);
  box-shadow: inset 0 0 0 1px var(--ink-900), var(--shadow-sm);
}
.choice input:checked + .choice__card::after { opacity: 1; transform: none; }
.choice input:focus-visible + .choice__card { outline: 2px solid var(--ink-900); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .choice:hover input:not(:checked) + .choice__card { border-color: var(--ink-400); }
}
.choice__name { font-weight: 600; color: var(--ink-900); font-size: var(--text-md); }
.choice__meta { font-size: var(--text-sm); line-height: var(--lh-normal); color: var(--ink-600); }
.choice__meta > span { white-space: nowrap; }
.choice__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.15rem 0.5rem;
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--oak-700);
  background: var(--oak-100);
  border-radius: 999px;
}

/* Größe: Draufsicht mit Stühlen */
.choice__plan { display: block; width: 100%; height: auto; margin: 0.6rem 0 0.4rem; }
.plan__top {
  fill: var(--oak-100);
  stroke: var(--oak-500);
  stroke-width: 2;
  transition: fill var(--dur-normal) var(--ease-standard);
}
.plan__chairs rect { fill: var(--ink-200); transition: fill var(--dur-normal) var(--ease-standard); }
.plan__chairs--opt rect { fill: none; stroke: var(--ink-300); stroke-width: 1.5; stroke-dasharray: 3 3; }
.choice input:checked + .choice__card .plan__top { fill: var(--oak-300); }
/* Handy: Größen als kompakte Zeile, Grundriss links */
@media (max-width: 479px) {
  .choices--3 .choice__card {
    display: grid;
    grid-template-columns: 112px 1fr;
    grid-template-areas: "plan badge" "plan name" "plan meta";
    align-content: center;
    column-gap: 0.9rem;
    row-gap: 0.15rem;
    padding: 0.75rem 2.4rem 0.75rem 0.75rem;
  }
  .choices--3 .choice__plan { grid-area: plan; margin: 0; align-self: center; }
  .choices--3 .choice__badge { grid-area: badge; position: static; justify-self: start; margin-bottom: 0.2rem; }
  .choices--3 .choice__name { grid-area: name; }
  .choices--3 .choice__meta { grid-area: meta; }
}
.choice input:checked + .choice__card .plan__chairs:not(.plan__chairs--opt) rect { fill: var(--ink-700); }

/* Holz: Bild oben, randlos */
.choice__card--media { padding: 0 0 1rem; overflow: hidden; }
.choice__card--media > :not(.choice__img) { padding-inline: 0.9rem; }
.choice__img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: 0.55rem;
  transition: transform var(--dur-slow) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .choice:hover .choice__img { transform: scale(1.04); }
}
.choice__level { display: flex; gap: 4px; margin-top: auto; padding-top: 0.35rem; }
.choice__level i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-200); }
.choice__level i.is-on { background: var(--oak-500); }

/* "Persönlich besprechen" */
.choice__card--talk {
  justify-content: center;
  background: transparent;
  border-style: dashed;
}
.choice input:checked + .choice__card--talk { background: var(--paper-0); border-style: solid; }
.choice__talk-icon { width: 30px; height: 30px; color: var(--oak-500); margin-bottom: 0.3rem; }

/* Gestell: Seitenansicht, Farbe je Material */
[data-panel="2"] { --frame-color: var(--ink-900); }
[data-panel="2"][data-material="holz"] { --frame-color: var(--oak-500); }
.choice__frame { display: block; width: 100%; height: auto; margin: 0.4rem 0 0.5rem; }
.frame__top { fill: var(--oak-300); }
.frame__legs { fill: var(--frame-color); transition: fill var(--dur-slow) var(--ease-standard); }
.frame__floor { stroke: var(--ink-200); stroke-width: 1.5; }

/* Material-Umschalter */
.segmented {
  display: inline-flex;
  gap: 4px;
  margin-top: 1.4rem;
  padding: 4px;
  background: var(--paper-2);
  border: 1px solid var(--st-field-border);
  border-radius: 999px;
}
.segmented__item { position: relative; cursor: pointer; }
.segmented__item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented__item span {
  display: block;
  min-width: 96px;
  padding: 0.5rem 1.1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  color: var(--ink-600);
  border-radius: 999px;
  transition: background var(--dur-normal) var(--ease-standard), color var(--dur-normal) var(--ease-standard);
}
.segmented__item input:checked + span { background: var(--ink-900); color: var(--paper-1); }
.segmented__item input:focus-visible + span { outline: 2px solid var(--ink-900); outline-offset: 2px; }
[data-panel="2"].is-talk .segmented { opacity: 0.4; }

/* ---- Verlängerung --------------------------------------- */
.choice-group__title {
  margin-top: 1.75rem;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink-900);
}
.choice-group__title span { font-weight: 400; color: var(--ink-400); }
.options {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .options { grid-template-columns: repeat(3, 1fr); } }
.option { position: relative; display: flex; cursor: pointer; }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  background: var(--paper-0);
  border: 1px solid var(--st-field-border);
  border-radius: var(--radius-md);
  position: relative;
  transition: border-color var(--dur-normal) var(--ease-standard), box-shadow var(--dur-normal) var(--ease-standard);
}
/* Radiopunkt */
.option__body::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 0.95rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-300);
  background: var(--paper-0);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.option__body b { font-weight: 600; font-size: var(--text-sm); color: var(--ink-900); }
.option__body small { font-size: var(--text-sm); line-height: var(--lh-normal); color: var(--ink-600); }
.option input:checked + .option__body { border-color: var(--ink-900); box-shadow: inset 0 0 0 1px var(--ink-900); }
.option input:checked + .option__body::before { border-color: var(--ink-900); box-shadow: inset 0 0 0 4px var(--ink-900); }
.option input:focus-visible + .option__body { outline: 2px solid var(--ink-900); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .option:hover input:not(:checked) + .option__body { border-color: var(--ink-400); }
}

/* ---- Bemerkung (aufklappbar) ---------------------------- */
.note { margin-top: 1.5rem; }
.note summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  list-style: none;
}
.note summary::-webkit-details-marker { display: none; }
.note summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 1rem;
  line-height: 1;
  border: 1px solid var(--ink-300);
  border-radius: 50%;
  transition: transform var(--dur-normal) var(--ease-out);
}
.note[open] summary::before { transform: rotate(45deg); }
.note.has-text summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--oak-500);
}
@media (hover: hover) and (pointer: fine) {
  .note summary:hover { color: var(--ink-900); }
}
.note textarea { margin-top: 0.5rem; min-height: 5.5rem; }
.note[open] textarea { animation: stepper-in 200ms var(--ease-out) both; }

/* ---- Preisberechnung ------------------------------------ */
.calc { margin-top: 1.4rem; }
.calc__run { max-width: 460px; margin-inline: auto; padding-block: 0.5rem; }
.calc__plan { display: block; width: 100%; max-width: 340px; height: auto; margin-inline: auto; overflow: visible; }
.calc__outline {
  fill: var(--oak-100);
  fill-opacity: 0;
  stroke: var(--oak-500);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.calc__dim { stroke: var(--ink-400); stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 1; }
.calc__dim-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  fill: var(--ink-600);
  opacity: 0;
}
.calc.is-running .calc__outline {
  animation: calc-draw 1.6s var(--ease-standard) forwards, calc-fill 0.8s ease 1.4s forwards;
}
.calc.is-running .calc__dim { animation: calc-draw 0.9s var(--ease-standard) 0.9s forwards; }
.calc.is-running .calc__dim-label { animation: calc-show 0.4s ease 1.2s forwards; }
@keyframes calc-draw { to { stroke-dashoffset: 0; } }
@keyframes calc-show { to { opacity: 1; } }
@keyframes calc-fill { to { fill-opacity: 1; } }

.calc__bar {
  height: 3px;
  margin-top: 1.5rem;
  background: var(--ink-100);
  border-radius: 3px;
  overflow: hidden;
}
.calc__bar span {
  display: block;
  height: 100%;
  background: var(--oak-500);
  transform-origin: left center;
  transform: scaleX(0);
}
.calc__list { margin: 1.25rem 0 0; padding: 0; list-style: none; }
.calc__list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0;
  font-size: var(--text-sm);
  color: var(--ink-600);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 260ms ease, transform 260ms var(--ease-out), color 200ms ease;
}
.calc__list li.is-shown { opacity: 1; transform: none; }
.calc__list li.is-done { color: var(--ink-900); }
.calc__list li::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--oak-300);
  border-right-color: transparent;
  border-radius: 50%;
  animation: stepper-spin 700ms linear infinite;
}
.calc__list li.is-done::before {
  border: 0;
  animation: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a7850' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 16px no-repeat;
}

.calc__result { text-align: center; }
.calc__result:not([hidden]) { animation: calc-reveal 520ms var(--ease-out) both; }
@keyframes calc-reveal { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.calc__eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--oak-700);
}
.calc__price {
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.calc__fine {
  max-width: 52ch;
  margin: 0.8rem auto 0;
  font-size: var(--text-sm);
  line-height: var(--lh-normal);
  color: var(--ink-500);
}
.calc__notice {
  max-width: 52ch;
  margin: 1rem auto 0;
  padding: 0.7rem 1rem;
  font-size: var(--text-sm);
  line-height: var(--lh-normal);
  color: var(--oak-700);
  background: var(--oak-100);
  border-radius: var(--radius-md);
}

/* Zusammenfassung mit "Ändern" */
.summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0;
  max-width: 560px;
  margin: 1.75rem auto 0;
  text-align: left;
  border-top: 1px solid var(--st-border);
}
.summary > * {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--st-border);
  font-size: var(--text-sm);
}
.summary dt { padding-right: 1.25rem; font-weight: 600; color: var(--ink-500); }
.summary dd { margin: 0; color: var(--ink-900); }
.summary__edit {
  justify-self: end;
  padding-left: 1rem;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--st-border);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--oak-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .summary__edit:hover { color: var(--ink-900); }
}

/* ohne JS: Preis-Schritt ausblenden (rechnet nur mit JS) */
.no-js [data-panel="3"] .calc,
.no-js [data-panel="3"] .note { display: none; }

@media (max-width: 479px) {
  .stepper--wide { --st-bubble: 38px; }
  .stepper--wide .stepper__label { font-size: var(--text-2xs); letter-spacing: 0.04em; }
  .stepper--wide .stepper__bubble svg { width: 17px; height: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .calc.is-running .calc__outline,
  .calc.is-running .calc__dim { animation: none; stroke-dashoffset: 0; fill-opacity: 1; }
  .calc.is-running .calc__dim-label { animation: none; opacity: 1; }
  .calc__list li { transition: none; }
  .calc__list li::before { animation: none; }
  .calc__result:not([hidden]),
  .note[open] textarea { animation: stepper-fade 150ms ease both; }
  .choice__img { transition: none; }
}
