/* ---------------------------------------------------------------------------
   ENERGISA — forms and shop
   Colours come from tokens.css. No hex values below.
   --------------------------------------------------------------------------- */

/* --- Two-column form page ------------------------------------------------
   The form on the left, reassurance on the right. On a phone the reassurance
   moves ABOVE the form: someone deciding whether to fill in eleven fields
   wants to know why before they start, not after. */

.pagina-formulario {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: start;
}

.formulario-painel {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
}

.coluna-apoio { position: sticky; top: 110px; display: grid; gap: var(--s-4); }

@media (max-width: 920px) {
  .pagina-formulario { grid-template-columns: 1fr; gap: var(--s-5); }
  .coluna-apoio { position: static; order: -1; }
  .formulario-painel { padding: var(--s-5) var(--s-4); }
}

/* --- Field groups --------------------------------------------------------
   Eleven fields in one run reads as a tax return. Three named groups of three
   or four read as a short conversation, and the count never changes. */

.grupo-campos { border: 0; margin: 0 0 var(--s-6); padding: 0; }
.grupo-campos:last-of-type { margin-bottom: var(--s-5); }

.grupo-campos__legenda {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 0 0 var(--s-2);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.grupo-campos__numero {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--teal-050);
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 700;
  flex: none;
}

/* Side-by-side fields where the pair is naturally read together. */
.par-campos { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 560px) { .par-campos { grid-template-columns: 1fr; gap: 0; } }

/* --- Fields --------------------------------------------------------------
   Inputs are 48px tall: a thumb on a phone needs a target that size, and the
   catalogue is browsed on phones far more than on desktops. */

.campo input:not([type="checkbox"]):not([type="radio"]),
.campo select,
.campo textarea {
  min-height: 48px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campo input:hover:not(:focus),
.campo select:hover:not(:focus),
.campo textarea:hover:not(:focus) { border-color: var(--ink-400); }

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  border-color: var(--brand-bright);
  box-shadow: 0 0 0 3px var(--teal-050);
  outline: none;
}

.campo--erro input,
.campo--erro select,
.campo--erro textarea { border-color: var(--bad-600); }

/* "Opcional" is stated, rather than marking the required ones with an
   asterisk nobody reads. It also makes the form look shorter than it is. */
.campo__opcional {
  font-weight: 400;
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-left: var(--s-2);
}

.campo__erro { display: flex; align-items: flex-start; gap: var(--s-2); }
.campo__erro::before { content: "!"; font-weight: 700; flex: none; }

.campo--caixa { display: flex; align-items: flex-start; gap: var(--s-3); }
.campo--caixa input { width: 18px; height: 18px; min-height: 0; margin-top: 3px; flex: none; }
.campo--caixa label { font-weight: 400; font-size: var(--text-sm); margin: 0; }

.accoes-formulario {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: var(--s-5);
}
.accoes-formulario .botao { padding-inline: var(--s-6); }
.accoes-formulario__nota { font-size: var(--text-xs); color: var(--text-faint); }

/* --- Reassurance cards --------------------------------------------------- */

.cartao-apoio {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s-5);
}
.cartao-apoio h3 { font-size: var(--text-base); margin-bottom: var(--s-3); color: var(--ink-900); }
.cartao-apoio p { font-size: var(--text-sm); color: var(--text-quiet); margin-bottom: var(--s-3); }
.cartao-apoio p:last-child { margin-bottom: 0; }

.cartao-apoio--marca {
  background: var(--brand-surface);
  border-color: var(--teal-800);
}
.cartao-apoio--marca h3 { color: #fff; }
.cartao-apoio--marca p { color: var(--on-brand); }
.cartao-apoio--marca a { color: #fff; }

.lista-garantias { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.lista-garantias li {
  display: flex;
  gap: var(--s-3);
  font-size: var(--text-sm);
  color: var(--text-quiet);
  line-height: var(--leading-snug);
}
.lista-garantias svg { flex: none; margin-top: 2px; color: var(--good-600); }

.contacto-directo { display: grid; gap: var(--s-2); font-size: var(--text-sm); }
.contacto-directo a { text-decoration: none; font-weight: 600; }

/* --- Cart badge in the header -------------------------------------------- */

.conta-carrinho {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.conta-carrinho__bolha {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
}

/* --- Cart table ---------------------------------------------------------- */
/* A table on desktop, stacked cards on a phone: a four-column table at 390px
   either scrolls sideways or squeezes the name to two characters. */

.tabela-carrinho { width: 100%; border-collapse: collapse; }
.tabela-carrinho th {
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: var(--s-3) var(--s-3) var(--s-3) 0;
  border-bottom: 1px solid var(--line);
}
.tabela-carrinho td {
  padding: var(--s-4) var(--s-3) var(--s-4) 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tabela-carrinho .alinhar-direita { text-align: right; padding-right: 0; }

.linha-carrinho__nome { font-weight: 600; color: var(--ink-900); text-decoration: none; }
.linha-carrinho__nome:hover { color: var(--brand); }
.linha-carrinho__meta { font-size: var(--text-xs); color: var(--text-faint); margin: var(--s-1) 0 0; }

.quantidade-form { display: flex; gap: var(--s-2); align-items: center; }
.quantidade-form input {
  width: 72px;
  min-height: 40px;
  padding: var(--s-2);
  text-align: center;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--text);
  font-family: inherit;
}

.botao-texto {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-faint);
  font-family: inherit;
  font-size: var(--text-xs);
  text-decoration: underline;
  cursor: pointer;
}
.botao-texto:hover { color: var(--bad-600); }

.resumo-encomenda {
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s-5);
  position: sticky;
  top: 110px;
}
.resumo-linha {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--text-sm);
  margin-bottom: var(--s-3);
}
.resumo-linha--total {
  border-top: 1px solid var(--ink-200);
  padding-top: var(--s-3);
  margin-top: var(--s-4);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink-900);
}
.resumo-encomenda .botao { width: 100%; justify-content: center; margin-top: var(--s-4); }

@media (max-width: 760px) {
  .tabela-carrinho thead { display: none; }
  .tabela-carrinho,
  .tabela-carrinho tbody,
  .tabela-carrinho tr,
  .tabela-carrinho td { display: block; width: 100%; }
  .tabela-carrinho tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: var(--s-4);
    margin-bottom: var(--s-4);
  }
  .tabela-carrinho td { border: 0; padding: var(--s-2) 0; }
  .tabela-carrinho .alinhar-direita { text-align: left; }
  .tabela-carrinho td[data-rotulo]::before {
    content: attr(data-rotulo);
    display: block;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    margin-bottom: var(--s-1);
  }
  .resumo-encomenda { position: static; }
}

/* --- Product grid -------------------------------------------------------- */

.cartao-produto {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cartao-produto:hover { border-color: var(--teal-400); box-shadow: var(--shadow); }

.cartao-produto__imagem {
  aspect-ratio: 4 / 3;
  background: var(--surface-sunk);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.cartao-produto__imagem img { width: 100%; height: 100%; object-fit: cover; }
.cartao-produto__sem-imagem { color: var(--ink-200); }

.cartao-produto__corpo {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1;
}
.cartao-produto__categoria {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.cartao-produto__nome {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink-900);
  text-decoration: none;
  line-height: var(--leading-snug);
}
.cartao-produto__nome:hover { color: var(--brand); }
.cartao-produto__preco { font-weight: 700; color: var(--brand); }
.cartao-produto__sob-consulta { font-size: var(--text-sm); color: var(--text-quiet); }
.cartao-produto__accoes { margin-top: auto; padding-top: var(--s-3); }
.cartao-produto__accoes .botao { width: 100%; justify-content: center; }

.estado-vazio {
  text-align: center;
  padding: var(--s-8) var(--s-4);
  border: 1px dashed var(--ink-200);
  border-radius: var(--radius-lg);
  color: var(--text-quiet);
}
.estado-vazio h3 { color: var(--ink-900); }
