/* ============================================================
   Internet Comparison Journey — UI recovery
   Namespace: .tp-internet-flow / .tpf-*
   Tokens inherited from .tp-comparison (--cmp-*)
   ============================================================ */

/* ── Root / page background ────────────────────────────── */
.tp-internet-flow {
  background: var(--cmp-bg, #f5f7fa);
  padding-bottom: 48px;
}

/* Make [hidden] truly hidden (scoped) */
.tp-internet-flow [hidden] {
  display: none !important;
}

/* ── Bootstrap button overrides — TariffePazze red ─────── */
.tp-internet-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;
}

/* Primary action buttons — icon layout helper */
.tp-internet-flow .tpf-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}

.tp-internet-flow .btn-outline-secondary {
  border-radius: 10px;
  min-height: 48px;
  font-weight: 600;
}

/* ── Compact header ────────────────────────────────────── */
.tpf-header {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px 8px;
  text-align: center;
}

.tpf-header__title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  margin-bottom: 4px;
  line-height: 1.25;
}

.tpf-header__sub {
  font-size: 0.95rem;
  color: var(--cmp-text-secondary, #6c757d);
  margin: 0;
}

/* ── ONE main card ─────────────────────────────────────── */
.tpf-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) {
  .tpf-card {
    padding: 28px 36px 30px;
  }
}

@media (max-width: 479px) {
  .tpf-header {
    padding: 14px 12px 4px;
  }
  .tpf-header__title {
    font-size: 1.3rem;
  }
  .tpf-card {
    margin: 0 12px 24px;
    padding: 20px 16px;
    border-radius: 12px;
  }
}

/* ── Error summary ─────────────────────────────────────── */
.tpf-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 ──────────────────────── */
.tpf-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;
}

.tpf-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;
}

/* Connector between steps */
.tpf-progress__step + .tpf-progress__step {
  margin-left: 6px;
}

.tpf-progress__step + .tpf-progress__step::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 2px;
  background: var(--cmp-border, #e9ecef);
  margin-right: 6px;
  flex-shrink: 0;
}

/* Number circle */
.tpf-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;
}

/* States */
.tpf-progress__step.is-active {
  color: var(--cmp-primary, #d32f2f);
}
.tpf-progress__step.is-active .tpf-progress__num {
  background: var(--cmp-primary, #d32f2f);
  color: #fff;
}
.tpf-progress__step.is-done {
  color: var(--cmp-success, #198754);
}
.tpf-progress__step.is-done .tpf-progress__num {
  background: var(--cmp-success, #198754);
  color: #fff;
}

/* Completed connector */
.tpf-progress__step.is-done + .tpf-progress__step::before {
  background: var(--cmp-success, #198754);
}

/* Mobile — keep horizontal, shrink connector */
@media (max-width: 420px) {
  .tpf-progress__step {
    font-size: 0.72rem;
    gap: 4px;
  }
  .tpf-progress__step + .tpf-progress__step {
    margin-left: 3px;
  }
  .tpf-progress__step + .tpf-progress__step::before {
    width: 10px;
    margin-right: 3px;
  }
  .tpf-progress__num {
    width: 22px;
    height: 22px;
    font-size: 0.68rem;
  }
}

/* ── Mode selection ────────────────────────────────────── */
.tpf-mode__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  text-align: center;
  margin-bottom: 18px;
}

.tpf-mode__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .tpf-mode__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tpf-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;
}

.tpf-mode__card:hover,
.tpf-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;
}

.tpf-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;
}

.tpf-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;
}

.tpf-mode__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  line-height: 1.2;
}

.tpf-mode__desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--cmp-text-secondary, #6c757d);
}

.tpf-mode__foot {
  font-size: 0.76rem;
  color: var(--cmp-text-muted, #adb5bd);
  margin-top: 4px;
}

/* ── Trust bar ──────────────────────────────────────────── */
.tpf-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);
}

.tpf-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--cmp-text-secondary, #6c757d);
}

.tpf-trust i {
  color: var(--cmp-success, #198754);
  font-size: 0.9rem;
}

/* ── Bill panel ─────────────────────────────────────────── */

/* ── Upload ─────────────────────────────────────────────── */
.tpf-upload {
  text-align: center;
}

.tpf-upload__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--cmp-text, #1a1d21);
  margin-bottom: 6px;
}

.tpf-upload__hint {
  font-size: 0.88rem;
  color: var(--cmp-text-secondary, #6c757d);
  margin-bottom: 18px;
}

.tpf-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;
}

.tpf-upload__zone:hover,
.tpf-upload__zone:focus-within {
  border-color: var(--cmp-primary, #d32f2f);
  background: var(--cmp-primary-light, rgba(211, 47, 47, 0.05));
}

.tpf-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;
}

.tpf-upload__zone-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  min-height: 140px;
  justify-content: center;
}

.tpf-upload__zone-icon {
  font-size: 2rem;
  color: var(--cmp-primary, #d32f2f);
  margin-bottom: 4px;
}

.tpf-upload__zone-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cmp-text, #1a1d21);
}

.tpf-upload__zone-sub {
  font-size: 0.82rem;
  color: var(--cmp-text-secondary, #6c757d);
}

@media (min-width: 576px) {
  .tpf-upload__zone-body {
    min-height: 145px;
    padding: 32px 16px;
  }
}

@media (max-width: 479px) {
  .tpf-upload__zone-body {
    min-height: 125px;
    padding: 22px 12px;
  }
}

/* ── Bill done (upload success, no extraction) ─────────── */
.tpf-bill__done {
  text-align: center;
  padding: 8px 0 4px;
}

.tpf-bill__done-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;
}

.tpf-bill__done-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.tpf-bill__done-text {
  font-size: 0.9rem;
  color: var(--cmp-text-secondary, #6c757d);
  margin-bottom: 18px;
  line-height: 1.6;
}

.tpf-bill__done-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tpf-bill__done-replace {
  display: inline;
}

@media (min-width: 480px) {
  .tpf-bill__done-actions {
    flex-direction: row;
    justify-content: center;
  }
}

/* ── Review card ────────────────────────────────────────── */
.tpf-review {
  text-align: left;
}

.tpf-review__header {
  text-align: center;
  margin-bottom: 20px;
}

.tpf-review__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.tpf-review__sub {
  font-size: 0.85rem;
  color: var(--cmp-text-secondary, #6c757d);
  margin: 0;
}

.tpf-review__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 520px) {
  .tpf-review__grid {
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
  }
}

.tpf-review__field {
  padding: 14px 0;
  border-bottom: 1px solid var(--cmp-border, #e9ecef);
}

.tpf-review__field--secondary[hidden] {
  display: none !important;
}

.tpf-review__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cmp-text-muted, #adb5bd);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 4px;
}

.tpf-review__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  margin-bottom: 6px;
}

.tpf-review__badge::before {
  font-family: "bootstrap-icons";
  font-size: 0.8rem;
}

.tpf-review__badge--ok {
  background: rgba(25, 135, 84, 0.1);
  color: #198754;
}
.tpf-review__badge--ok::before {
  content: "\F26A";
}

.tpf-review__badge--warn {
  background: rgba(255, 193, 7, 0.12);
  color: #bb8400;
}
.tpf-review__badge--warn::before {
  content: "\F332";
}

.tpf-review__badge--confirmed {
  background: rgba(13, 110, 253, 0.1);
  color: #0b5ed7;
}
.tpf-review__badge--confirmed::before {
  content: "\F272";
}

.tpf-review__field .form-control,
.tpf-review__field .form-select {
  border-radius: 10px;
  min-height: 42px;
  font-size: 0.92rem;
}

/* Field error */
.field-error {
  color: #d32f2f;
  font-size: 0.82rem;
  margin-top: 4px;
}

/* Review toggle (secondary fields) */
.tpf-review__toggle {
  margin-top: 12px;
  padding: 0;
  text-decoration: none;
  font-size: 0.85rem;
}

.tpf-review__toggle[hidden] {
  display: none !important;
}

.tpf-review__toggle .bi-chevron-down {
  transition: transform 0.2s ease;
}

.tpf-review__toggle[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.tpf-review__actions {
  margin-top: 18px;
  text-align: center;
}

.tpf-review__alt {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--cmp-border, #e9ecef);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Wizard ─────────────────────────────────────────────── */
.tpf-wizard[hidden] {
  display: none !important;
}

.tpf-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;
}

.tpf-wizard__step[hidden] {
  display: none !important;
}

.tpf-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;
}

.tpf-wizard__helper {
  text-align: center;
  margin: -8px 0 16px;
}

.tpf-wizard__field {
  margin-bottom: 16px;
}

.tpf-wizard__field .form-label {
  font-weight: 600;
  color: var(--cmp-text, #1a1d21);
  font-size: 0.9rem;
}

.tpf-wizard__field .form-control-lg,
.tpf-wizard__field .form-select-lg {
  border-radius: 12px;
  min-height: 48px;
  font-size: 1rem;
}

/* Choice buttons (connection Sì/No) */
.tpf-wizard__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.tpf-wizard__choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.tpf-wizard__choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tpf-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;
}

.tpf-wizard__choice:hover .tpf-wizard__choice-body {
  border-color: var(--cmp-primary, #d32f2f);
}

.tpf-wizard__choice input:focus-visible + .tpf-wizard__choice-body {
  outline: 3px solid rgba(211, 47, 47, 0.35);
  outline-offset: 2px;
}

.tpf-wizard__choice input:checked + .tpf-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);
}

/* Provider select */
.tpf-wizard__step select.form-select-lg {
  border-radius: 12px;
}

/* Privacy checkbox */
.tpf-wizard__privacy {
  margin-bottom: 14px;
}

.tpf-wizard__privacy .form-check-label {
  font-size: 0.85rem;
  color: var(--cmp-text-secondary, #6c757d);
}

/* Wizard actions */
.tpf-wizard__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 480px) {
  .tpf-wizard__actions {
    flex-direction: column-reverse;
  }
  .tpf-wizard__legend {
    text-align: left;
  }
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tpf-mode__card,
  .tpf-wizard__choice-body,
  .tpf-upload__zone {
    transition: none;
  }
}
