/* ==========================================================================
   Agrofutura — Página Histórico de cotações
   Hero só-texto (mesmo padrão do Contato) + lista simples com filtro.
   Ícones e indicador de variação reusam .cot-card__* de home.css.
   ========================================================================== */

/* ---------- Hero ---------- */
.hist-hero {
  position: relative;
  overflow: hidden;
  background: var(--verde);
  color: #fff;
  padding-top: clamp(8.5rem, 13vh, 11rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
  text-align: center;
}
.hist-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../img/patterns/white.webp") center / 480px repeat;
  opacity: 0.07;
  pointer-events: none;
}
.hist-hero__inner { position: relative; z-index: 1; max-width: 760px; }
.hist-hero__eyebrow { color: var(--creme); margin-bottom: 1rem; }
.hist-hero__title { color: #fff; margin-bottom: 1.25rem; }
.hist-hero__subtitle {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
  margin-inline: auto;
  text-wrap: balance;
}

/* ---------- Filtro por período ---------- */
.hist-filtro {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.hist-filtro__opt {
  padding: 0.6em 1.4em;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #000;
  border: 1px solid rgba(0, 0, 0, 0.2);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.hist-filtro__opt:hover { border-color: var(--verde); color: var(--verde); }
.hist-filtro__opt.is-active { background: #000; color: #fff; border-color: #000; }

/* ---------- Tabela: uma linha por data, uma coluna por item ---------- */
.hist-table {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  border-collapse: collapse;
  table-layout: fixed; /* colunas de item com a mesma largura */
  font-variant-numeric: tabular-nums;
}
.hist-table th,
.hist-table td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  text-align: right;
  vertical-align: middle;
}
.hist-table thead th {
  border-bottom-color: rgba(0, 0, 0, 0.3);
  vertical-align: bottom;
  font-weight: 400;
}
.hist-table .hist-table__data { width: 20%; text-align: left; padding-left: 0.25rem; }
.hist-table thead .hist-table__data { font-size: var(--fs-label); color: var(--cinza); }
.hist-table tbody .hist-table__data { font-weight: 400; color: var(--cinza); font-size: 0.9rem; }

.hist-head {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}
.hist-head__icon svg { width: 32px; height: 32px; }
.hist-head__name { font-weight: 700; color: var(--preto); }
.hist-head__unit { font-size: 0.75rem; color: var(--cinza); }

/* Célula: preço em cima, variação embaixo */
.hist-table td { line-height: 1.3; }
.hist-cell__value { display: block; font-weight: 700; color: var(--preto); }
.hist-table td .cot-card__var { margin-top: 0.15rem; }
.hist-cell__vazio { color: rgba(0, 0, 0, 0.3); }

.hist-mais { margin-top: clamp(2rem, 4vw, 3rem); text-align: center; }
.hist-vazio { text-align: center; color: var(--cinza); }

/* Diagnóstico (só administradores) */
.hist-status {
  max-width: 1000px;
  margin: 2rem auto 0;
  padding: 1rem 1.25rem;
  border: 1px dashed rgba(0, 0, 0, 0.25);
  font-size: 0.8rem;
  color: var(--cinza);
}
.hist-status p { margin: 0.35rem 0 0; }
.hist-status__erro { color: var(--vinho); }
.hist-status form { margin-top: 0.85rem; }

/* Mobile: cada data vira um bloco com os 4 itens em grade 2×2 */
@media (max-width: 640px) {
  .hist-table thead { display: none; }
  .hist-table,
  .hist-table tbody { display: block; }
  .hist-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem 1rem;
    padding: 1.1rem 0.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  }
  .hist-table tr[hidden] { display: none; }
  .hist-table th,
  .hist-table td { padding: 0; border: 0; text-align: left; }
  .hist-table tbody .hist-table__data { grid-column: 1 / -1; font-weight: 700; color: var(--preto); }
  .hist-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    color: var(--cinza);
    margin-bottom: 0.15rem;
  }
}


/* Mobile: subtítulo do hero no tamanho do parágrafo normal */
@media (max-width: 560px) {
  .hist-hero__subtitle { font-size: 1rem; }
}
