/* Tagungskalkulator — customer-facing layout.
   Designed to render inside an iframe on hotel-park-soltau.de: no page chrome,
   transparent body, the form *is* the page.

   Why this shape (and not the legacy table-with-modals):
   - The legacy view stacked a dense ruleset table with modal popups for product
     copy. That works on desktop but suffers in an iframe on mobile (popup
     stacking, context loss, hidden info). Customers also never saw the price
     accumulate as they made choices — the running total was buried below the
     form, hurting conversion.
   - Replacement pattern: each Tagungsleistung is a **card** with name, always-
     visible short description, **per-day toggle chips**, and an inline
     "Mehr Infos" expander for items whose modal had real sales content
     (Tagungsraum AV equipment, beverage lists). No popup; same information,
     in place.
   - A **sticky price summary** lives in a right column on desktop and a
     bottom drawer on mobile. The total is always visible while the customer
     toggles services. Standard e-commerce conversion pattern. */

html, body { background: transparent; }
* { box-sizing: border-box; }

.calc-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1rem 8rem;
}
.calc-embed { padding-top: .25rem; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
/* Breakpoint deliberately low: the calculator is embedded as a full-width
   iframe and even on tablet there's room for the side-by-side layout. */
@media (min-width: 760px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
}
@media (min-width: 1100px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr) 360px; }
}

.calc-main > section { margin-bottom: 1.5rem; }
.calc-main h2 {
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--hps-muted);
  margin: 0 0 .85rem;
}
.calc-main h2 .step {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 1.6rem; height: 1.6rem;
  border-radius: 50%;
  background: var(--hps-green);
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  font-feature-settings: "tnum";
  margin-right: .6rem;
  vertical-align: middle;
  text-shadow: 0 1px 1px rgba(0,0,0,.15);
}

/* — Form controls — */
.calc label.field-label {
  display: block;
  font-size: .8rem;
  color: var(--hps-muted);
  margin-bottom: .2rem;
}
.calc input.form-control,
.calc select.form-select,
.calc textarea.form-control {
  border-radius: var(--hps-radius);
  border: 1px solid var(--hps-line);
  background: #fff;
  color: var(--hps-text);
}

/* row-tight: equal-width columns using flexbox (CSS grid's intrinsic-sizing
   default was collapsing tracks to min-content from the long German labels,
   leaving inputs ~60px wide). Flex with flex:1 + min-width:0 forces every
   cell to share parent width and lets contents wrap inside. */
.row-tight { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; width: 100%; }
.row-tight > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.row-tight.col-2 > div { flex-basis: calc(50% - .3rem); }
.row-tight.col-3 > div { flex-basis: calc(33.333% - .4rem); }
.row-tight.col-4 > div { flex-basis: calc(50% - .3rem); }
@media (min-width: 720px) { .row-tight.col-4 > div { flex-basis: calc(25% - .45rem); } }

.row-tight > div > label.field-label {
  flex: 1 0 auto;
  margin-bottom: .35rem;
  line-height: 1.25;
  display: flex;
  align-items: flex-end;
  font-size: .78rem;
}
.row-tight > div > input,
.row-tight > div > select,
.row-tight > div > textarea { width: 100%; }

/* — Bestuhlungsform image picker —
   Always uses 4 columns; on really wide layouts where the main column can
   accommodate it, 8 columns. This avoids tiny cropped images in the
   in-between width (650–950px), which is where the sidebar steals room. */
.bestuhlung {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
}
@media (min-width: 1200px) {
  .bestuhlung { grid-template-columns: repeat(8, 1fr); }
}
.bestuhlung label {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .65rem .25rem .5rem;
  border-radius: var(--hps-radius);
  border: 2px solid transparent;
  background: var(--hps-bg-soft);
  transition: background .14s, border-color .14s, transform .14s;
}
.bestuhlung label:hover { background: #eef2e3; }
.bestuhlung input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.bestuhlung img {
  width: 100%; height: auto;
  max-width: 64px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  filter: grayscale(1) opacity(.65);
  transition: filter .14s, transform .14s;
}
.bestuhlung .name {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--hps-muted);
  text-align: center;
}
.bestuhlung label:has(input:checked) {
  background: #fff;
  border-color: var(--hps-green);
  box-shadow: 0 2px 12px rgba(149,163,33,.18);
}
.bestuhlung label:has(input:checked) img { filter: none; transform: scale(1.06); }
.bestuhlung label:has(input:checked) .name { color: var(--hps-text); font-weight: 500; }

/* — Leistung cards — */
.leistung-card {
  background: #fff;
  border: 1px solid var(--hps-line);
  border-radius: var(--hps-radius);
  padding: .9rem 1rem;
  margin-bottom: .65rem;
  transition: border-color .14s, box-shadow .14s;
}
.leistung-card:hover { border-color: #b9c08c; }
.leistung-card.active { border-color: var(--hps-green); box-shadow: 0 2px 14px rgba(149,163,33,.12); }
.leistung-card.inactive-cfg { opacity: .55; }

.leistung-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.leistung-title { font-weight: 500; color: var(--hps-text); font-size: 1.02rem; line-height: 1.3; }
.leistung-sub {
  font-size: .82rem;
  color: var(--hps-muted);
  margin-top: .25rem;
}
.leistung-price {
  flex-shrink: 0;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--hps-text);
  text-align: right;
  font-size: .95rem;
  line-height: 1.3;
}
.leistung-price .per { font-size: .7rem; color: var(--hps-muted); display: block; }

/* day-chip row */
.day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .75rem;
}
.day-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: .3rem .7rem;
  border: 1px solid var(--hps-line);
  border-radius: 999px;
  font-size: .8rem;
  color: var(--hps-muted);
  cursor: pointer;
  user-select: none;
  background: #fff;
  transition: background .12s, border-color .12s, color .12s;
}
.day-chip:hover { border-color: var(--hps-green); color: var(--hps-text); }
.day-chip input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.day-chip.checked, .day-chip:has(input:checked) {
  background: var(--hps-green);
  border-color: var(--hps-green);
  color: #fff;
}
.day-chip.all { font-weight: 500; }

/* once / pauschal — single tappable toggle replacing chips */
.once-toggle {
  display: inline-flex;
  align-items: center;
  margin-top: .65rem;
  padding: .35rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--hps-line);
  cursor: pointer;
  font-size: .82rem;
  color: var(--hps-muted);
  background: #fff;
  transition: background .12s, border-color .12s, color .12s;
}
.once-toggle.checked { background: var(--hps-green); border-color: var(--hps-green); color: #fff; }
/* Coupled Leistung (config.dependsOn) — auto-applies on the dependency's days */
.leistung-info { margin-top: .55rem; font-size: .82rem; color: var(--hps-green); font-weight: 500; }

/* "Fest enthalten" — shown as a static Inklusive badge, not clickable */
.once-toggle.locked { cursor: default; }
.once-toggle.locked::before { content: "✓ "; }
.once-toggle input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }

/* inline expander */
.leistung-card details { margin-top: .55rem; }
.leistung-card details > summary {
  cursor: pointer;
  list-style: none;
  font-size: .8rem;
  color: var(--hps-green-dark);
  font-weight: 500;
}
.leistung-card details > summary::-webkit-details-marker { display: none; }
.leistung-card details > summary::after { content: " ▾"; font-size: .7em; opacity: .6; }
.leistung-card details[open] > summary::after { content: " ▴"; }
.leistung-card details .more {
  margin-top: .5rem;
  font-size: .85rem;
  color: var(--hps-text);
  line-height: 1.5;
}
.leistung-card details .more ul { padding-left: 1.2rem; margin: .3rem 0; }
.leistung-card details .more strong { color: var(--hps-text); }
.paket-leistungen { margin-top: .55rem; font-size: .85rem; color: var(--hps-text); line-height: 1.5; }
.paket-leistungen ul { padding-left: 1.2rem; margin: .3rem 0 0; }

/* — Collapsible advanced section — */
details.advanced {
  border: 1px solid var(--hps-line);
  border-radius: var(--hps-radius);
  padding: 0;
  background: #fff;
}
details.advanced > summary {
  cursor: pointer;
  padding: .75rem 1rem;
  list-style: none;
  font-weight: 500;
  color: var(--hps-text);
  font-size: .92rem;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::after { content: " ▾"; float: right; color: var(--hps-muted); }
details.advanced[open] > summary::after { content: " ▴"; }
details.advanced[open] > summary { border-bottom: 1px solid var(--hps-line); }
details.advanced .advanced-body { padding: 1rem; }

/* — Sticky price summary — */
.summary-card {
  background: var(--hps-green);
  color: #fff;
  border-radius: calc(var(--hps-radius) * 1.5);
  padding: 1rem 1.1rem;
  box-shadow: 0 6px 20px rgba(149,163,33,.25);
}
@media (min-width: 760px) {
  .summary-wrap { position: sticky; top: 1rem; }
}
.summary-card .label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .85;
  margin-bottom: .25rem;
}
.summary-card .meta { font-size: .8rem; opacity: .85; margin-bottom: .75rem; }
.summary-card table { width: 100%; }
.summary-card td {
  padding: .2rem 0;
  font-size: .88rem;
  vertical-align: top;
}
.summary-card td.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary-card .subtotal-row td {
  padding-top: .55rem;
  border-top: 1px solid rgba(255,255,255,.25);
  font-size: .82rem;
  opacity: .9;
}
.summary-card .total-row td {
  padding-top: .65rem;
  margin-top: .4rem;
  font-size: 1.15rem;
  font-weight: 500;
  border-top: 1px solid rgba(255,255,255,.4);
}
.summary-card .send-btn {
  width: 100%;
  margin-top: .9rem;
  border: 0;
  background: #fff;
  color: var(--hps-green-dark);
  padding: .65rem 1rem;
  border-radius: var(--hps-radius);
  font-weight: 500;
  cursor: pointer;
  font-size: .95rem;
  transition: background .12s;
}
.summary-card .send-btn:hover { background: #f4f7e7; }
.summary-card .send-btn[disabled] { opacity: .55; cursor: progress; }
.summary-card .empty {
  opacity: .85;
  font-size: .85rem;
  text-align: center;
  padding: .25rem 0;
}

/* — Inline send status (replaces alerts) — */
.send-status {
  margin-top: .5rem;
  font-size: .82rem;
  line-height: 1.35;
  border-radius: var(--hps-radius);
  padding: .45rem .6rem;
}
.send-status.pending { background: rgba(255, 255, 255, .15); color: #fff; }
.send-status.error   { background: #fdecec; color: #8a1f1f; border: 1px solid #f1b5b5; }

/* Mobile (< 760px, only narrow phones in practice): summary collapses to a
   sticky bottom block that scrolls with the page rather than overlaying it.
   Avoids covering content inside short iframe heights. */
@media (max-width: 759px) {
  .summary-wrap { position: sticky; bottom: 0; z-index: 50; padding: 0; margin-top: 1rem; }
  .summary-card {
    border-radius: var(--hps-radius);
    padding: .75rem 1rem;
  }
  .summary-wrap details { color: #fff; }
  .summary-wrap details > summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
  }
  .summary-wrap details > summary::-webkit-details-marker { display: none; }
  .summary-wrap details > summary::after { content: "▴"; }
  .summary-wrap details[open] > summary::after { content: "▾"; }
  .summary-wrap details:not([open]) .summary-card-detail { display: none; }
}

/* — Success state — */
.calc-success {
  background: var(--hps-bg-soft);
  border-left: 4px solid var(--hps-green);
  padding: 1.25rem 1.5rem;
  border-radius: var(--hps-radius);
  color: var(--hps-text);
  text-align: center;
}
.calc-success h3 { color: var(--hps-green-dark); margin-top: 0; }
