/*--------------------------------------------------------------
# Kalkulačka úspor (komponenta components/heatCalculator.latte)
# Všechny selektory jsou omezené na .heat-calc – styly neovlivňují zbytek webu.
# Písma a neutrální barvy se berou z proměnných šablony (main.css),
# akcent je oranžová ECHOZ (RGB 242/170/0) dle přání klienta.
--------------------------------------------------------------*/

.heat-calc {
  /* oranžová dle klienta; na oranžovém podkladu je bílý text nečitelný, proto tmavé --hc-contrast */
  --hc-accent: #f2aa00;
  /* tmavší odstín akcentu pro ikony na bílém podkladu (čistá oranžová by na bílé zanikla) */
  --hc-accent-strong: color-mix(in srgb, var(--hc-accent), #000000 28%);
  --hc-heading: var(--heading-color, #102a49);
  --hc-text: var(--default-color, #333333);
  --hc-surface: var(--surface-color, #ffffff);
  /* text na oranžových plochách (akcent, panel výsledků) */
  --hc-contrast: var(--heading-color, #102a49);
  --hc-muted: color-mix(in srgb, var(--hc-text), transparent 40%);
  --hc-border: color-mix(in srgb, var(--hc-heading), transparent 85%);
  --hc-track: color-mix(in srgb, var(--hc-heading), transparent 88%);
  --hc-accent-soft: color-mix(in srgb, var(--hc-accent), transparent 92%);
  --hc-danger: #c62828;
  /* „voda“ na oranžovém panelu výsledků – tmavě modrá ECHOZ */
  --hc-water: #0f3876;
  --hc-radius: 16px;
  --hc-shadow: 0 10px 30px rgba(16, 42, 73, 0.08);
  /* odsazení přilepeného panelu výsledků pod sticky hlavičkou webu */
  --hc-sticky-top: 130px;

  color: var(--hc-text);
}

.heat-calc *,
.heat-calc *::before,
.heat-calc *::after {
  box-sizing: border-box;
}

.heat-calc__noscript {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--hc-accent-soft);
}

.heat-calc__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Rozvržení: formulář + výsledky -------------------------------------- */

.heat-calc__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 992px) {
  .heat-calc__layout {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 32px;
    align-items: start;
  }

  .heat-calc__results {
    position: sticky;
    top: var(--hc-sticky-top);
  }
}

.heat-calc__form {
  display: grid;
  gap: 24px;
  min-width: 0;
  margin: 0;
}

/* --- Kroky ---------------------------------------------------------------- */

.heat-calc__step {
  min-width: 0;
  margin: 0;
  padding: 28px;
  border: 1px solid var(--hc-border);
  border-radius: var(--hc-radius);
  background: var(--hc-surface);
  box-shadow: var(--hc-shadow);
}

.heat-calc__legend {
  display: flex;
  align-items: center;
  gap: 12px;
  /* float + plná šířka = nadpis uvnitř rámečku, ne „na lince“ fieldsetu */
  float: left;
  width: 100%;
  margin: 0 0 20px;
  padding: 0;
  color: var(--hc-heading);
  font-family: var(--heading-font, inherit);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.heat-calc__legend + * {
  clear: left;
}

.heat-calc__step-number {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--hc-accent);
  color: var(--hc-contrast);
  font-size: 16px;
}

/* --- Krok 1: karty typu ohřevu -------------------------------------------- */

.heat-calc__types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.heat-calc__type {
  position: relative;
  display: block;
  margin: 0;
  cursor: pointer;
}

/* radio zůstává v dokumentu (klávesnice, čtečky), jen není vidět */
.heat-calc__type-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.heat-calc__type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 22px 12px 18px;
  border: 2px solid var(--hc-border);
  border-radius: 14px;
  background: var(--hc-surface);
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.heat-calc__type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--hc-accent-soft);
  color: var(--hc-accent-strong);
  font-size: 26px;
  transition: background-color 0.2s, color 0.2s;
}

.heat-calc__type-title {
  color: var(--hc-heading);
  font-family: var(--heading-font, inherit);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.heat-calc__type-note {
  color: var(--hc-muted);
  font-size: 13px;
}

.heat-calc__type-check {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--hc-accent-strong);
  font-size: 18px;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s;
}

.heat-calc__type:hover .heat-calc__type-card {
  border-color: color-mix(in srgb, var(--hc-accent), transparent 50%);
  transform: translateY(-2px);
}

.heat-calc__type-input:checked + .heat-calc__type-card {
  border-color: var(--hc-accent);
  background: var(--hc-accent-soft);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--hc-accent), transparent 82%);
}

.heat-calc__type-input:checked + .heat-calc__type-card .heat-calc__type-icon {
  background: var(--hc-accent);
  color: var(--hc-contrast);
}

.heat-calc__type-input:checked + .heat-calc__type-card .heat-calc__type-check {
  opacity: 1;
  transform: scale(1);
}

.heat-calc__type-input:focus-visible + .heat-calc__type-card {
  outline: 3px solid color-mix(in srgb, var(--hc-accent), transparent 55%);
  outline-offset: 2px;
}

/* --- Krok 2: posuvníky ---------------------------------------------------- */

.heat-calc__fields {
  display: grid;
  gap: 22px;
}

.heat-calc__field {
  min-width: 0;
}

.heat-calc__field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.heat-calc__label {
  margin: 0;
  color: var(--hc-heading);
  font-weight: 600;
  line-height: 1.3;
}

.heat-calc__number {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--hc-border);
  border-radius: 10px;
  background: var(--hc-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.heat-calc__number:focus-within {
  border-color: var(--hc-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hc-accent), transparent 82%);
}

.heat-calc__number-input {
  width: 4.5em;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--hc-heading);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}

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

.heat-calc__unit {
  color: var(--hc-muted);
  font-size: 14px;
  white-space: nowrap;
}

.heat-calc__hint {
  display: block;
  color: var(--hc-muted);
  font-size: 12px;
}

.heat-calc__field.is-invalid .heat-calc__number {
  border-color: var(--hc-danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hc-danger), transparent 85%);
}

.heat-calc__field.is-invalid .heat-calc__hint {
  color: var(--hc-danger);
  font-weight: 600;
}

/* Posuvník – vybarvenou část dráhy řídí proměnná --heat-calc-fill (nastavuje JS). */
.heat-calc__range {
  --heat-calc-fill: 50%;

  display: block;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.heat-calc__range:focus {
  outline: 0;
}

.heat-calc__range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--hc-accent) var(--heat-calc-fill),
    var(--hc-track) var(--heat-calc-fill)
  );
}

.heat-calc__range::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border: 3px solid var(--hc-accent);
  border-radius: 50%;
  background: var(--hc-surface);
  box-shadow: 0 2px 6px rgba(16, 42, 73, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.heat-calc__range::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--hc-track);
}

.heat-calc__range::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--hc-accent);
}

.heat-calc__range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid var(--hc-accent);
  border-radius: 50%;
  background: var(--hc-surface);
  box-shadow: 0 2px 6px rgba(16, 42, 73, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}

.heat-calc__range:hover::-webkit-slider-thumb,
.heat-calc__range:active::-webkit-slider-thumb {
  transform: scale(1.1);
}

.heat-calc__range:hover::-moz-range-thumb,
.heat-calc__range:active::-moz-range-thumb {
  transform: scale(1.1);
}

.heat-calc__range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--hc-accent), transparent 70%);
}

.heat-calc__range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--hc-accent), transparent 70%);
}

/* --- Výsledky ------------------------------------------------------------- */

.heat-calc__results {
  min-width: 0;
  padding: 28px;
  border-radius: var(--hc-radius);
  background: linear-gradient(160deg, color-mix(in srgb, var(--hc-accent), #ffffff 18%), var(--hc-accent));
  color: var(--hc-contrast);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--hc-accent), transparent 60%);
}

.heat-calc__results-title {
  margin: 0 0 18px;
  color: color-mix(in srgb, var(--hc-contrast), transparent 15%);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.heat-calc__total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--hc-surface);
  color: var(--hc-heading);
  box-shadow: 0 10px 24px rgba(16, 42, 73, 0.12);
}

.heat-calc__total-label {
  font-size: 15px;
  font-weight: 600;
}

.heat-calc__total-value {
  font-family: var(--heading-font, inherit);
  font-size: clamp(34px, 9vw, 44px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.heat-calc__total-unit {
  font-size: 0.5em;
  font-weight: 600;
}

.heat-calc__water {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 16px 20px;
  border: 1px solid color-mix(in srgb, var(--hc-contrast), transparent 82%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--hc-contrast), transparent 93%);
}

.heat-calc__water-icon {
  flex: 0 0 auto;
  color: var(--hc-water);
  font-size: 34px;
  line-height: 1;
}

.heat-calc__water-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.heat-calc__water-label {
  font-size: 14px;
  font-weight: 600;
}

.heat-calc__water-value {
  font-family: var(--heading-font, inherit);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.heat-calc__water-note {
  color: color-mix(in srgb, var(--hc-contrast), transparent 15%);
  font-size: 12px;
}

/* poměr úspory: ohřev vody (tmavě modrá) : kompresory (tmavá poloprůhledná) */
.heat-calc__split {
  height: 8px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hc-contrast), transparent 75%);
}

.heat-calc__split-water {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px 0 0 999px;
  background: var(--hc-water);
  transition: width 0.4s ease;
}

.heat-calc__breakdown {
  margin: 14px 0 0;
}

.heat-calc__breakdown-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hc-contrast), transparent 85%);
}

.heat-calc__breakdown-row:last-child {
  border-bottom: 0;
}

.heat-calc__breakdown dt {
  color: color-mix(in srgb, var(--hc-contrast), transparent 20%);
  font-size: 14px;
  font-weight: 400;
}

.heat-calc__breakdown dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.heat-calc__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
}

.heat-calc__dot--water {
  background: var(--hc-water);
}

.heat-calc__dot--compressor {
  background: color-mix(in srgb, var(--hc-contrast), transparent 75%);
}

.heat-calc__disclaimer {
  margin: 16px 0 0;
  color: color-mix(in srgb, var(--hc-contrast), transparent 15%);
  font-size: 12px;
  line-height: 1.5;
}

/* --- Poslat výsledek na e-mail (světlá karta uvnitř panelu výsledků) ------- */

.heat-calc__email {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--hc-surface);
  color: var(--hc-text);
}

.heat-calc__email-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--hc-heading);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.heat-calc__email-title .bi {
  color: var(--hc-accent-strong);
}

.heat-calc__email-form {
  display: grid;
  gap: 12px;
  margin: 0;
}

.heat-calc__email-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--hc-border);
  border-radius: 10px;
  outline: 0;
  background: var(--hc-surface);
  color: var(--hc-heading);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.heat-calc__email-input::placeholder {
  color: var(--hc-muted);
}

.heat-calc__email-input:focus {
  border-color: var(--hc-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hc-accent), transparent 82%);
}

.heat-calc__consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}

.heat-calc__consent-input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--hc-accent);
  cursor: pointer;
}

.heat-calc__email-errors {
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--hc-danger), transparent 90%);
  color: var(--hc-danger);
  font-size: 14px;
}

.heat-calc__email-errors p {
  margin: 0;
}

.heat-calc__email-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--hc-accent);
  color: var(--hc-contrast);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.heat-calc__email-submit:hover {
  background: color-mix(in srgb, var(--hc-accent), #000000 12%);
}

.heat-calc__email-submit:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--hc-accent), transparent 55%);
  outline-offset: 2px;
}

.heat-calc__email-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* poznámka o zpracování údajů (@gdprNote.latte) – v úzkém panelu menším písmem a bez horního odsazení */
.heat-calc__email-form > .small {
  margin-top: 0 !important;
  font-size: 12px;
  line-height: 1.5;
}

/* --- Mobil ---------------------------------------------------------------- */

@media (max-width: 575px) {
  .heat-calc__step,
  .heat-calc__results {
    padding: 20px 16px;
  }

  .heat-calc__legend {
    font-size: 18px;
  }

  /* karty pod sebou, ikona vlevo, text vpravo */
  .heat-calc__types {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .heat-calc__type-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 14px;
    align-items: center;
    padding: 12px 40px 12px 14px;
    text-align: left;
  }

  .heat-calc__type-icon {
    grid-row: span 2;
    width: 46px;
    height: 46px;
    margin-bottom: 0;
    font-size: 22px;
  }

  .heat-calc__type-check {
    top: 50%;
    margin-top: -9px;
    line-height: 1;
  }

  .heat-calc__field-head {
    align-items: flex-end;
  }

  .heat-calc__label {
    font-size: 15px;
  }
}

/* --- Omezení animací ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .heat-calc *,
  .heat-calc *::before,
  .heat-calc *::after {
    transition: none !important;
  }

  .heat-calc__type:hover .heat-calc__type-card {
    transform: none;
  }
}
