/* =============================================================
 * REHAU Energiesparrechner — Widget-Styles
 *
 * Eigenständig (kein SCSS-Compile nötig). Nutzt CSS-Variablen
 * für einfaches Theming. Rehau-Designtokens werden als
 * Fallback direkt gesetzt; falls die Site global-Variablen
 * wie --rehau-primary-1 definiert, überschreiben die.
 *
 * Farben: nur Werte aus colors.scss (Primärfarbe 1/3, Schwarz,
 * Weiß, heller, hell, mittel, dunkler). Keine eigenen Töne.
 *
 * Aufbau: Schritt 1 Angaben | Schritt 2 Ergebnis + Schritt 3
 * Nächster Schritt, darunter Grafiken, Akkordeon, Hinweis.
 *
 * Die Site färbt in hellen Sektionen jedes div um
 * (.isLightBackground div:not(.keepColor)). Alle divs des Rechners
 * tragen deshalb die Klasse keepColor.
 *
 * Namespace: .ec-*  (Energy Calculator)
 * ============================================================= */

.ec-calc {
  --ec-primary-1: var(--rehau-primary-1, #37a58c);  /* Primärfarbe 1 */
  --ec-primary-2: var(--rehau-primary-2, #dd0060);  /* Primärfarbe 2 */
  --ec-primary-3: var(--rehau-primary-3, #70dbc3);  /* Primärfarbe 3 */
  --ec-ink: #000;            /* schwarz */
  --ec-ink-soft: #4e4e4e;    /* dunkler */
  --ec-line: #000;
  --ec-line-soft: #d9d9d9;   /* hell */
  --ec-bg: #fff;
  --ec-bg-soft: #f0f0f0;     /* heller */
  --ec-bg-accent: #f0f0f0;
  --ec-bar-old: #b0b0b0;     /* mittel */
  --ec-on-primary: #fff;     /* Schrift auf Primärfarbe 1 */

  box-sizing: border-box;
  font-family: inherit;
  color: var(--ec-ink);
  line-height: 1.4;
  margin: 2rem 0;
}
.ec-calc *, .ec-calc *::before, .ec-calc *::after { box-sizing: border-box; }
.ec-calc p { margin: 0; padding: 0; }

/* ---------- Layout-Grid ---------- */
.ec-calc__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 1100px) {
  .ec-calc__grid {
    grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
    gap: 2.5rem;
  }
}

/* ---------- Schritte 1 · 2 · 3 ---------- */
.ec-panel--form {
  padding: 1.75rem;
  background: var(--ec-bg);
  border: 1px solid var(--ec-line-soft);
}
.ec-panel--result { padding: 1.75rem 0 0; }
@media (max-width: 599px) {
  .ec-panel--form { padding: 1.25rem; }
}

.ec-step {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin: 0 0 1.5rem;
}
.ec-step__no {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  background: var(--ec-primary-1);
  color: var(--ec-on-primary);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}
.ec-step__body { min-width: 0; }
.ec-calc h3.ec-step__title {
  margin: 0;
  padding: 0;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 2.1rem;      /* Höhe des Nummernfelds, Titel sitzt auf dessen Mitte */
  color: var(--ec-ink);
  text-transform: none;
}
.ec-calc .ec-step__text {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ec-ink-soft);
}

/* ---------- Form ---------- */
.ec-calc__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.75rem 2rem;
}
@media (min-width: 720px) {
  .ec-calc__form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.ec-formCol {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-width: 0;
}
.ec-calc .ec-formCol__title {
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--ec-line);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ec-ink);
}
.ec-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.ec-field label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ec-ink);
}
.ec-field small {
  display: block;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--ec-ink-soft);
}
.ec-field select,
.ec-input {
  width: 100%;
  height: initial;               /* überschreibt globales input { height: ... } */
  padding: 0.7rem 0.8rem;
  background: var(--ec-bg);
  border: 1px solid var(--ec-line);
  border-radius: 0;
  font-size: 0.95rem;
  line-height: 1.4;              /* überschreibt globales input { line-height: 2rem } */
  color: var(--ec-ink);
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  box-sizing: border-box;
}
.ec-field select { text-overflow: ellipsis; }
.ec-field select:focus,
.ec-input:focus {
  outline: 2px solid var(--ec-primary-1);
  outline-offset: -2px;
  border-color: var(--ec-primary-1);
}
/* Select wird in .ec-selectWrap umschlossen, damit ein quadratisches
   schwarzes Pfeil-Feld via ::after rechts sauber positioniert werden kann. */
.ec-selectWrap {
  position: relative;
  display: block;
}
.ec-selectWrap select {
  padding-right: 52px; /* Platz für die schwarze Box rechts */
}
.ec-selectWrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  aspect-ratio: 1 / 1;
  background-color: #000;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 10px;
  pointer-events: none;
}
.ec-selectWrap:focus-within::after {
  background-color: var(--ec-primary-1);
}
.ec-input[type="number"] {
  -moz-appearance: textfield;
}
.ec-input[type="number"]::-webkit-outer-spin-button,
.ec-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Area-Mode: Toggle + Panes ---------- */
.ec-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 0.5rem;
  border: 1px solid var(--ec-line);
}
.ec-toggle__btn {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: var(--ec-bg);
  border: 0;
  border-right: 1px solid var(--ec-line);
  border-radius: 0;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--ec-ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ec-toggle__btn:last-child { border-right: 0; }
/* Die Site gibt jedem button 0.3rem Außenabstand rechts; dadurch füllte das schwarze Feld
   seine Hälfte nicht (weißer Spalt links und rechts von „Fenster zählen“). */
.ec-calc .ec-toggle .ec-toggle__btn { margin: 0; }
.ec-toggle__btn:focus-visible {
  outline: 2px solid var(--ec-primary-1);
  outline-offset: -2px;
}
.ec-toggle__btn:hover { background: var(--ec-bg-soft); }
.ec-toggle__btn.is-active {
  background: #000;
  color: #fff;
  font-weight: 700;
}
.ec-areaPanel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ec-areaPanel.is-hidden { display: none; }
.ec-countRow {
  display: grid;
  grid-template-columns: 1fr 80px;
  align-items: center;
  gap: 0.5rem;
}
.ec-countRow label {
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.25;
}
.ec-countRow label span {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--ec-ink-soft);
}
.ec-countRow .ec-input {
  text-align: right;
  padding: 0.55rem 0.6rem;
}
/* Schieberegler unter jeder Fensterzahl (0 bis 20). Das Zahlenfeld zeigt den Wert
   und bleibt für größere Zahlen tippbar. Griff eckig wie der Pfeil der Auswahlfelder. */
.ec-countRow { row-gap: 0.4rem; }
.ec-calc input.ec-range {
  --ec-range-fill: 0%;
  grid-column: 1 / -1;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.6rem;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.ec-calc input.ec-range::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right,
    var(--ec-primary-1) var(--ec-range-fill), var(--ec-line-soft) var(--ec-range-fill));
}
.ec-calc input.ec-range::-moz-range-track { height: 4px; background: var(--ec-line-soft); }
.ec-calc input.ec-range::-moz-range-progress { height: 4px; background: var(--ec-primary-1); }
.ec-calc input.ec-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.3rem;
  height: 1.3rem;
  margin-top: calc((4px - 1.3rem) / 2);
  background: var(--ec-ink);
  border: 0;
  border-radius: 0;
}
.ec-calc input.ec-range::-moz-range-thumb {
  width: 1.3rem;
  height: 1.3rem;
  background: var(--ec-ink);
  border: 0;
  border-radius: 0;
}
.ec-calc input.ec-range:hover::-webkit-slider-thumb,
.ec-calc input.ec-range:focus-visible::-webkit-slider-thumb { background: var(--ec-primary-1); }
.ec-calc input.ec-range:hover::-moz-range-thumb,
.ec-calc input.ec-range:focus-visible::-moz-range-thumb { background: var(--ec-primary-1); }
.ec-calc input.ec-range:focus { outline: none; }
.ec-calc input.ec-range:focus-visible {
  outline: 2px solid var(--ec-primary-1);
  outline-offset: 2px;
}
.ec-countSum {
  margin-top: 0.25rem;
  padding: 0.6rem 0.75rem;
  background: var(--ec-bg-accent);
  border-left: 3px solid var(--ec-primary-1);
  font-size: 0.9rem;
  color: var(--ec-ink);
}
.ec-countSum strong {
  color: var(--ec-primary-1);
  font-weight: 700;
}

/* ---------- Schritt 2: Ergebnis ---------- */
.ec-calc__results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  align-content: start;
}
.ec-calc .ec-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--ec-ink-soft);
  font-style: italic;
}
.ec-stat {
  padding: 1.35rem 1.5rem;
  background: var(--ec-bg);
  border: 1px solid var(--ec-line-soft);
}
.ec-calc .ec-stat__label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ec-ink);
}
.ec-calc .ec-stat__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ec-ink);
  font-variant-numeric: tabular-nums;
}
.ec-calc .ec-stat__sub {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ec-ink-soft);
}
/* Ersparnis pro Jahr: Zahl in der Grundgröße (2rem) */
.ec-stat--hero {
  border-left: 4px solid var(--ec-primary-1);
}
.ec-calc .ec-stat--hero .ec-stat__value {
  color: var(--ec-primary-1);
}
/* Ersparnis in 20 Jahren: die große Zahl steht groß (Peter 23.11.2026: Größen getauscht) */
.ec-stat.ec-stat--accent {
  background: #000;
  border-color: #000;
  color: #fff;
}
.ec-calc .ec-stat--accent .ec-stat__label { color: #fff; }
.ec-calc .ec-stat--accent .ec-stat__value {
  font-size: 3rem;
  color: var(--ec-primary-3);
}
.ec-calc .ec-stat--accent .ec-stat__sub { color: rgba(255, 255, 255, 0.7); }

/* Klein darunter: Verbrauch und CO₂ */
.ec-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}
.ec-calc .ec-fact {
  padding: 0.75rem 1rem;
  background: var(--ec-bg);
  border: 1px solid var(--ec-line-soft);
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--ec-ink-soft);
}
.ec-calc .ec-fact strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ec-ink);
  font-variant-numeric: tabular-nums;
}

.ec-error {
  padding: 1rem;
  background: var(--ec-bg);
  border: 1px solid var(--ec-primary-2);
  color: var(--ec-primary-2);
}

/* ---------- Schritt 3: Nächster Schritt ---------- */
.ec-cta {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--ec-line);
}
.ec-cta .ec-step { margin-bottom: 1.15rem; }
.ec-cta__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
/* Die Schaltflächen sind die der Site (elementLink 10 und 50), unverändert im Aussehen.
   Hier nur Abstand, volle Breite und mehr Höhe (Peter 23.11.2026: „so wie vorher,
   nur die Höhe größer“): Polster oben/unten 0.6rem statt 0.25rem, das sind 51 px statt 38 px. */
.ec-calc .ec-cta__buttons .elementLink {
  margin: 0;
  flex: 1 1 12rem;
}
.ec-calc .ec-cta__buttons .elementLink > a {
  display: block;
  width: 100%;
  margin: 0;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

/* ---------- Grafiken ---------- */
.ec-calc__charts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 3rem;
}
@media (min-width: 800px) {
  .ec-calc__charts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ec-chartCard--wide { grid-column: 1 / -1; }
}
.ec-chartCard {
  min-width: 0;
  padding: 1.5rem 1.75rem 1.6rem;
  background: var(--ec-bg);
  border: 1px solid var(--ec-line-soft);
}
@media (max-width: 599px) {
  .ec-chartCard { padding: 1.15rem 1.25rem 1.25rem; }
}
.ec-calc h3.ec-chart__title {
  margin: 0;
  padding: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ec-ink);
  text-transform: none;
}
.ec-calc .ec-chart__sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ec-ink-soft);
}
.ec-calc .ec-chart__note {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  color: var(--ec-ink-soft);
}

/* Verlauf über 20 Jahre: Fläche als gestrecktes SVG, Schrift als HTML */
.ec-growth {
  position: relative;
  height: 12rem;
  margin: 3.25rem 0.4rem 0;       /* oben Platz für den Betrag über dem letzten Punkt */
  border-bottom: 1px solid var(--ec-line);
}
.ec-growth__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ec-growth__area { fill: var(--ec-primary-1); fill-opacity: 0.15; }
.ec-growth__line { fill: none; stroke: var(--ec-primary-1); stroke-width: 2.5; }
.ec-growth__drop { fill: none; stroke: var(--ec-line-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.ec-growth__pt {
  position: absolute;
  width: 0.6rem;
  height: 0.6rem;
  margin: 0 0 -0.3rem -0.3rem;
  background: var(--ec-primary-1);
  outline: 2px solid var(--ec-bg);
}
/* Betrag links über dem Punkt: Die Linie steigt nach rechts, so kreuzt sie die Zahl
   auch auf schmalen Bildschirmen nicht. */
.ec-growth__val {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ec-ink);
  font-variant-numeric: tabular-nums;
}
.ec-growth__pt--end .ec-growth__val {
  right: -0.3rem;
  font-size: 1.3rem;
  color: var(--ec-primary-1);
}
.ec-growth__axis {
  position: relative;
  height: 1.4rem;
  margin: 0.5rem 0.4rem 0;
}
.ec-growth__tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--ec-ink-soft);
}
.ec-growth__tick--start { transform: none; }
.ec-growth__tick--end { transform: translateX(-100%); }

/* Vergleich alte / neue Fenster: zwei liegende Balken */
.ec-bars {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.ec-bars__row {
  display: grid;
  grid-template-columns: 6.4rem minmax(0, 1fr) 4.6rem;
  align-items: center;
  gap: 0.75rem;
}
.ec-bars__label {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--ec-ink);
}
.ec-bars__track { display: block; height: 1.6rem; }
.ec-bars__bar { display: block; height: 100%; min-width: 3px; transition: width 0.25s; }
.ec-bars__bar--old { background: var(--ec-bar-old); }
.ec-bars__bar--new { background: var(--ec-primary-1); }
.ec-bars__val {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  color: var(--ec-ink);
  font-variant-numeric: tabular-nums;
}
/* Schmal: Bezeichnung über dem Balken, damit der Balken die Breite bekommt */
@media (max-width: 599px) {
  .ec-bars { gap: 0.75rem; }
  .ec-bars__row {
    grid-template-columns: minmax(0, 1fr) 4.6rem;
    gap: 0.2rem 0.75rem;
  }
  .ec-bars__label { grid-column: 1 / -1; }
}

/* ---------- Akkordeon: Annahmen und Rechenweg ---------- */
.ec-acc {
  margin-top: 1.5rem;
  background: var(--ec-bg);
  border: 1px solid var(--ec-line-soft);
}
.ec-acc__summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.9rem;
  padding: 1rem 1.75rem;
  cursor: pointer;
  list-style: none;
  color: var(--ec-ink);
}
.ec-acc__summary::-webkit-details-marker { display: none; }
.ec-acc__summary::marker { content: ""; }
.ec-acc__title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}
.ec-acc__hint {
  font-size: 0.8rem;
  color: var(--ec-ink-soft);
}
.ec-acc__icon {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  margin-left: auto;
  transition: transform 0.2s;
}
.ec-acc[open] .ec-acc__icon { transform: rotate(180deg); }
.ec-acc__summary:hover .ec-acc__title,
.ec-acc__summary:hover .ec-acc__icon { color: var(--ec-primary-1); }
.ec-acc__summary:focus-visible {
  outline: 2px solid var(--ec-primary-1);
  outline-offset: -2px;
}
.ec-acc__body {
  padding: 1.25rem 1.75rem 1.5rem;
  border-top: 1px solid var(--ec-line-soft);
}
@media (max-width: 599px) {
  .ec-acc__summary { padding: 0.9rem 1.25rem; }
  .ec-acc__body { padding: 1rem 1.25rem 1.25rem; }
}

.ec-notes:empty { display: none; }
ol.ec-notes__list {
  margin: 0;
  padding: 0 0 0 1.25rem;
  list-style: decimal outside;
  columns: 2 26rem;              /* ab ca. 900 px zweispaltig, darunter einspaltig */
  column-gap: 2.5rem;
  font-size: 0.8rem;
  line-height: 1.5;
}
ol.ec-notes__list > li {
  margin: 0 0 0.6rem;
  padding: 0;
  break-inside: avoid;
  color: var(--ec-ink-soft);
}
ol.ec-notes__list > li::before { content: none; }
ol.ec-notes__list > li strong {
  font-weight: 700;
  color: var(--ec-ink);
}
/* Rechenweg mit den aktuellen Eingaben */
.ec-notes__calc {
  display: block;
  margin-top: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: var(--ec-bg-soft);
  border-left: 3px solid var(--ec-primary-1);
  color: var(--ec-ink);
  font-variant-numeric: tabular-nums;
}
.ec-notes__calc > span {
  display: block;
  padding: 0.1rem 0;
}

/* ---------- Hinweis ---------- */
.ec-calc .ec-calc__disclaimer {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ec-ink-soft);
}

/* ---------- V4-Skin (Sektion 40927, dunkler Grund) ----------
   Die Sektion definiert die --ec-Variablen um (elementSectionBase.scss).
   Hier nur, was sich daraus nicht ergibt. */
.elementSection_var40927 .ec-calc {
  --ec-on-primary: #000;         /* Primärfarbe 1 ist dort hell */
  --ec-bar-old: rgba(255, 255, 255, 0.3);
}
.elementSection_var40927 .ec-stat.ec-stat--accent { border-color: var(--ec-line-soft); }
/* V4 färbt span in dunklen Sektionen weiß; die Nummer steht dort auf hellem Feld */
.elementSection_var40927 .ec-calc span.ec-step__no { color: var(--ec-on-primary) !important; }
