/* ============================================================
   Energia Comparison Journey
   Namespace: .tp-energy-flow / .tpe-*
   Tokens inherited from .tp-comparison (--cmp-*)
   ============================================================ */

/* ── Root / page background ────────────────────────────── */
.tp-energy-flow {
  background: var(--cmp-bg, #f5f7fa);
  padding-bottom: 48px;
}

.tp-energy-flow [hidden] {
  display: none !important;
}

/* ── Bootstrap button overrides — TariffePazze red ─────── */
.tp-energy-flow .btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--cmp-primary, #d32f2f);
  --bs-btn-border-color: var(--cmp-primary, #d32f2f);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--cmp-primary-hover, #b71c1c);
  --bs-btn-hover-border-color: var(--cmp-primary-hover, #b71c1c);
  --bs-btn-focus-shadow-rgb: 211, 47, 47;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--cmp-primary-hover, #b71c1c);
  --bs-btn-active-border-color: var(--cmp-primary-hover, #b71c1c);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--cmp-primary, #d32f2f);
  --bs-btn-disabled-border-color: var(--cmp-primary, #d32f2f);
  border-radius: 10px;
  font-weight: 600;
}

.tp-energy-flow .tpe-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}

.tp-energy-flow .btn-outline-secondary {
  border-radius: 10px;
  min-height: 48px;
  font-weight: 600;
}

/* ── Compact header ────────────────────────────────────── */
.tpe-header {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px 8px;
  text-align: center;
}

.tpe-header__title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  margin-bottom: 4px;
  line-height: 1.25;
}

.tpe-header__sub {
  font-size: 0.95rem;
  color: var(--cmp-text-secondary, #6c757d);
  margin: 0;
}

/* ── ONE main card ─────────────────────────────────────── */
.tpe-card {
  max-width: 680px;
  margin: 0 auto 28px;
  background: var(--cmp-surface, #ffffff);
  border: 1px solid var(--cmp-border, #e9ecef);
  border-radius: var(--cmp-radius, 16px);
  padding: 28px 20px;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.06);
}

@media (min-width: 576px) {
  .tpe-card {
    padding: 28px 36px 30px;
  }
}

@media (max-width: 479px) {
  .tpe-header {
    padding: 14px 12px 4px;
  }
  .tpe-header__title {
    font-size: 1.3rem;
  }
  .tpe-card {
    margin: 0 12px 24px;
    padding: 20px 16px;
    border-radius: 12px;
  }
}

/* ── Error summary ─────────────────────────────────────── */
.tpe-error-summary {
  padding: 12px 16px;
  background: #fff5f5;
  border: 1px solid #f5c6cb;
  border-radius: 10px;
  color: #842029;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ── Progress — always horizontal ──────────────────────── */
.tpe-progress {
  list-style: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
  padding: 0;
  margin: 0 0 20px;
}

.tpe-progress__step {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cmp-text-muted, #adb5bd);
  white-space: nowrap;
}

.tpe-progress__step + .tpe-progress__step {
  margin-left: 6px;
}

.tpe-progress__step + .tpe-progress__step::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 2px;
  background: var(--cmp-border, #e9ecef);
  margin-right: 6px;
  flex-shrink: 0;
}

.tpe-progress__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  background: var(--cmp-bg, #f5f7fa);
  color: var(--cmp-text-muted, #adb5bd);
  flex-shrink: 0;
}

.tpe-progress__step.is-active {
  color: var(--cmp-primary, #d32f2f);
}
.tpe-progress__step.is-active .tpe-progress__num {
  background: var(--cmp-primary, #d32f2f);
  color: #fff;
}
.tpe-progress__step.is-done {
  color: var(--cmp-success, #198754);
}
.tpe-progress__step.is-done .tpe-progress__num {
  background: var(--cmp-success, #198754);
  color: #fff;
}

.tpe-progress__step.is-done + .tpe-progress__step::before {
  background: var(--cmp-success, #198754);
}

@media (max-width: 420px) {
  .tpe-progress__step {
    font-size: 0.72rem;
    gap: 4px;
  }
  .tpe-progress__step + .tpe-progress__step {
    margin-left: 3px;
  }
  .tpe-progress__step + .tpe-progress__step::before {
    width: 10px;
    margin-right: 3px;
  }
  .tpe-progress__num {
    width: 22px;
    height: 22px;
    font-size: 0.68rem;
  }
}

/* ── Mode selection ────────────────────────────────────── */
.tpe-mode__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  text-align: center;
  margin-bottom: 18px;
}

.tpe-mode__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .tpe-mode__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tpe-mode__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 22px 18px;
  background: var(--cmp-surface, #ffffff);
  border: 2px solid var(--cmp-border, #e9ecef);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tpe-mode__card:hover,
.tpe-mode__card:focus-visible {
  border-color: var(--cmp-primary, #d32f2f);
  box-shadow: 0 2px 10px rgba(211, 47, 47, 0.08);
  transform: translateY(-1px);
  outline: none;
}

.tpe-mode__badge {
  position: absolute;
  top: -10px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--cmp-primary, #d32f2f);
  color: #fff;
  white-space: nowrap;
}

.tpe-mode__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--cmp-primary-light, rgba(211, 47, 47, 0.08));
  color: var(--cmp-primary, #d32f2f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.tpe-mode__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  line-height: 1.2;
}

.tpe-mode__desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--cmp-text-secondary, #6c757d);
}

.tpe-mode__foot {
  font-size: 0.76rem;
  color: var(--cmp-text-muted, #adb5bd);
  margin-top: 4px;
}

/* ── Trust bar ──────────────────────────────────────────── */
.tpe-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--cmp-border, #e9ecef);
}

.tpe-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--cmp-text-secondary, #6c757d);
}

.tpe-trust i {
  color: var(--cmp-success, #198754);
  font-size: 0.9rem;
}

/* ── Upload ─────────────────────────────────────────────── */
.tpe-upload {
  text-align: center;
}

.tpe-upload__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  margin-bottom: 6px;
}

.tpe-upload__hint {
  font-size: 0.88rem;
  color: var(--cmp-text-secondary, #6c757d);
  margin-bottom: 18px;
}

.tpe-upload__zone {
  display: block;
  border: 2px dashed var(--cmp-border, #e9ecef);
  border-radius: 12px;
  background: #fafbfc;
  cursor: pointer;
  margin-bottom: 14px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.tpe-upload__zone:hover,
.tpe-upload__zone:focus-within {
  border-color: var(--cmp-primary, #d32f2f);
  background: var(--cmp-primary-light, rgba(211, 47, 47, 0.05));
}

.tpe-upload__zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tpe-upload__zone-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  min-height: 140px;
  justify-content: center;
}

.tpe-upload__zone-icon {
  font-size: 2rem;
  color: var(--cmp-primary, #d32f2f);
  margin-bottom: 4px;
}

.tpe-upload__zone-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cmp-text, #1a1d21);
}

.tpe-upload__zone-sub {
  font-size: 0.82rem;
  color: var(--cmp-text-secondary, #6c757d);
}

@media (min-width: 576px) {
  .tpe-upload__zone-body {
    min-height: 145px;
    padding: 32px 16px;
  }
}

@media (max-width: 479px) {
  .tpe-upload__zone-body {
    min-height: 125px;
    padding: 22px 12px;
  }
}

/* ── Bill result (after upload, no extraction) ─────────── */
.tpe-bill-result {
  text-align: center;
  padding: 8px 0 4px;
}

.tpe-bill-result__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(25, 135, 84, 0.12);
  color: var(--cmp-success, #198754);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.tpe-bill-result__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tpe-bill-result__text {
  font-size: 0.9rem;
  color: var(--cmp-text-secondary, #6c757d);
  margin-bottom: 18px;
  line-height: 1.6;
}

.tpe-bill-result__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 480px) {
  .tpe-bill-result__actions {
    flex-direction: row;
    justify-content: center;
  }
}

/* ── Wizard ─────────────────────────────────────────────── */
.tpe-wizard[hidden] {
  display: none !important;
}

.tpe-wizard__bill-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--cmp-success, #198754);
  background: rgba(25, 135, 84, 0.08);
  border: 1px solid rgba(25, 135, 84, 0.2);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 18px;
}

.tpe-wizard__step[hidden] {
  display: none !important;
}

.tpe-wizard__legend {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  margin-bottom: 14px;
  width: 100%;
  text-align: center;
  line-height: 1.3;
}

.tpe-wizard__helper {
  text-align: center;
  margin: -8px 0 16px;
}

.tpe-wizard__field {
  margin-bottom: 16px;
}

.tpe-wizard__field .form-label {
  font-weight: 600;
  color: var(--cmp-text, #1a1d21);
  font-size: 0.9rem;
}

.tpe-wizard__field .form-control-lg,
.tpe-wizard__field .form-select-lg {
  border-radius: 12px;
  min-height: 48px;
  font-size: 1rem;
}

/* Choice buttons (Sì/No) */
.tpe-wizard__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.tpe-wizard__choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.tpe-wizard__choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tpe-wizard__choice-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 16px;
  background: var(--cmp-surface, #fff);
  border: 2px solid var(--cmp-border, #e9ecef);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cmp-text, #1a1d21);
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.tpe-wizard__choice:hover .tpe-wizard__choice-body {
  border-color: var(--cmp-primary, #d32f2f);
}

.tpe-wizard__choice input:focus-visible + .tpe-wizard__choice-body {
  outline: 3px solid rgba(211, 47, 47, 0.35);
  outline-offset: 2px;
}

.tpe-wizard__choice input:checked + .tpe-wizard__choice-body {
  border-color: var(--cmp-primary, #d32f2f);
  background: var(--cmp-primary-light, rgba(211, 47, 47, 0.08));
  color: var(--cmp-primary, #d32f2f);
}

/* Check chips (elettrodomestici, utilizzo gas) */
.tpe-wizard__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tpe-wizard__chip {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.tpe-wizard__chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tpe-wizard__chip-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--cmp-surface, #fff);
  border: 1.5px solid var(--cmp-border, #e9ecef);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--cmp-text-secondary, #6c757d);
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.tpe-wizard__chip-label:hover {
  border-color: var(--cmp-primary, #d32f2f);
}

.tpe-wizard__chip input:checked + .tpe-wizard__chip-label {
  border-color: var(--cmp-primary, #d32f2f);
  background: var(--cmp-primary-light, rgba(211, 47, 47, 0.08));
  color: var(--cmp-primary, #d32f2f);
}

/* Privacy checkbox */
.tpe-wizard__privacy {
  margin-bottom: 14px;
}

.tpe-wizard__privacy .form-check-label {
  font-size: 0.85rem;
  color: var(--cmp-text-secondary, #6c757d);
}

/* Wizard actions */
.tpe-wizard__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 480px) {
  .tpe-wizard__actions {
    flex-direction: column-reverse;
  }
  .tpe-wizard__legend {
    text-align: left;
  }
}

/* Field error */
.field-error {
  color: #d32f2f;
  font-size: 0.82rem;
  margin-top: 4px;
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tpe-mode__card,
  .tpe-wizard__choice-body,
  .tpe-upload__zone,
  .tpe-wizard__chip-label {
    transition: none;
  }
}
