/* ═══════════════════════════════════════════════════════
   CALCULADORA D'ESTALVI ENERGÈTIC (OPTIMIZAT)
   ═══════════════════════════════════════════════════════ */

/* ── Base & Reset bàsic ── */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  font-size: 14px;
  background: #e9eae8;
  color: #666;
  margin: 0;
}

/* ── Header & Links ── */
.hero-header {
  position: relative;
  width: 100%;
  height: 375px;
  background: #333;
}

.hero-header .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 85%;
  opacity: 0.8;
}

.form-header {
  padding: 20px;
}

.back-link {
  text-decoration: none;
  color: #0a5c36;
  font-weight: 600;
}

/* ── Contenidor Principal de 2 Columnes ── */
.form-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 96px;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

.calc {
  flex: 1;
  max-width: 480px;
  background: #e9eae8;
  padding: 24px;
  border-radius: 10px;
}

.calc h2 {
  text-align: center;
  margin: 0 0 6px;
  font-size: 20px;
  color: #111;
}

.calc-subtitol {
  text-align: center;
  margin: 0 0 18px;
  font-size: 14px;
  color: #666;
}

/* ── Columna d'Instruccions ── */
.info-col {
  flex: 0 0 640px;
  background: #fff;
  padding: 48px;
  border-radius: 10px;
  border: 1px solid #d5d6d3;
}

.info-col h3 {
  white-space: pre-line;
  margin: 0 0 16px;
  font-size: 16px;
  color: #111;
  border-bottom: 2px solid #0077cc;
  padding-bottom: 6px;
}

.instruccions-llista {
  list-style: none;
  padding: 0;
  margin: 0;
}

.instruccions-llista li {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.pas-num {
  background: #0077cc;
  color: #fff;
  font-weight: bold;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

.instruccions-llista strong {
  display: block;
  font-size: 13px;
  color: #222;
}

.instruccions-llista p {
  margin: 3px 0 0;
  font-size: 14px;
  color: #666;
  line-height: 1.4;
}

.info-box-lateral {
  margin-top: 18px;
  padding: 12px;
  background: #f0f7fc;
  border-left: 3px solid #0077cc;
  border-radius: 5px;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}

/* ── Formularis & Inputs ── */
label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
  font-size: 13px;
  color: #333;
}

input[type="number"],
input[type="date"],
select {
  width: 100%;
  padding: 8px 10px;
  margin-top: 5px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #222;
}

input:focus,
select:focus {
  outline: none;
  border-color: #0077cc;
  box-shadow: 0 0 0 2px rgba(0, 119, 204, 0.15);
}

/* ── Botons ── */
button {
  width: 100%;
  padding: 11px;
  margin-top: 18px;
  background: #0077cc;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  font-weight: bold;
  font-family: inherit;
  transition: background .15s;
}

button:hover {
  background: #005fa3;
}

button:active {
  transform: scale(.98);
}

.toggle-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: normal;
  background: #fff;
  color: #555;
  border: 1px solid #ccc;
  margin-top: 0;
}

.toggle-btn:hover {
  background: #f0f4f8;
}

.toggle-btn.active {
  background: #0077cc;
  color: #fff;
  border-color: #0077cc;
  font-weight: bold;
}

/* ── Seccions & Graelles ── */
.seccio {
  margin: 18px 0 6px;
  font-size: 11px;
  font-weight: bold;
  color: #555;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #c8c9c7;
  padding-bottom: 4px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.grid6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.grid6 label,
.grid6 input {
  font-size: 11px;
  padding: 6px 4px;
}

/* ── Targetes de Segment ── */
.segment-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.segment-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 10px;
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 8px;
  color: #333;
  font-weight: bold;
  margin-top: 0;
}

.segment-card:hover {
  border-color: #0077cc;
  background: #f0f7fc;
}

.segment-card.active {
  border-color: #0077cc;
  background: #0077cc;
  color: #fff;
}

.segment-card-icon {
  font-size: 26px;
}

/* ── Caixes d'Avís & Resultat ── */
.info-box,
.error-box,
.cta-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 5px;
  font-size: 16px;
}

.info-box {
  background: #fff;
  border-left: 4px solid #0077cc;
  line-height: 1.5;
}

.error-box {
  background: #fdecea;
  border-left: 4px solid #cc0000;
  color: #cc0000;
}

.cta-box {
  background: #fff;
  border: 1px solid #ccc;
  text-align: center;
  margin-top: 18px;
}

#resultat {
  margin-top: 22px;
  padding: 18px 15px;
  background: #e8ffe8;
  border-left: 4px solid #2ecc71;
  border-radius: 5px;
  line-height: 1.7;
}

#resultat.condicions-bones {
  background: #fff;
  border-left-color: #0077cc;
}

#resultat .estalvi-pct {
  display: block;
  text-align: center;
  font-size: 52px;
  font-weight: bold;
  color: #1a7a1a;
  line-height: 1;
}

#resultat .estalvi-label {
  display: block;
  text-align: center;
  color: #27ae60;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── Utilitats & Passos ── */
.ocult {
  display: none;
}

.wizard-step {
  animation: fadeIn .25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-back {
  width: auto;
  background: none;
  color: #0077cc;
  border: none;
  padding: 0;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: bold;
}

.progress-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
}

.progress-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #d5d6d3;
}

.progress-step.active {
  background: #0077cc;
}

.progress-step.done {
  background: #2ecc71;
}

.camp-ajuda {
  margin-top: 6px;
  font-size: 11px;
  color: #777;
}

.checkbox-linia {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: bold;
  font-size: 13px;
}

/* ── Responsive Mòbil ── */
@media (max-width: 820px) {
  .form-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .info-col {
    width: 100%;
    max-width: 480px;
    flex: none;
    order: 2;
  }

  .calc {
    width: 100%;
    order: 1;
  }
}