/* Comparador de anúncios (/comparar): hero e tabela da página, botão de
   comparação dos cards, botão da página do anúncio, barra flutuante e toast.
   Mesmo tema do site: vermelho #ea3636, escuro #14191d, texto #2d3643. */

/* ===== Hero (mesma base do .coming-hero) ===== */
.compare-hero {
  background-color: #14191d;
  /* fundo abstrato dos títulos (escuro à esquerda, curvas e vermelho à
     direita) com um véu à esquerda para o texto ler bem */
  background-image: linear-gradient(90deg, rgba(5, 7, 10, 0.78) 0%, rgba(5, 7, 10, 0.6) 40%, rgba(5, 7, 10, 0.12) 68%, rgba(5, 7, 10, 0) 100%),
    url("../img/bg-top-titulos.webp");
  background-size: cover;
  background-position: center;
  /* topo compacto: os carros comparados precisam aparecer sem rolar */
  padding: 3.2rem 0 3rem;
}

.compare-hero .tag {
  display: inline-block;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  color: #ea3636;
  border: 1px solid #ea3636;
  border-radius: 3rem;
  padding: 0.5rem 1.4rem;
  margin-bottom: 1.2rem;
}

.compare-hero h1 {
  font-size: 3.6rem;
  line-height: 1.15;
  color: #fff;
}

.compare-hero h1 strong {
  color: #ea3636;
}

.compare-hero > .container > p {
  font-size: 1.6rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0.8rem;
}

@media (max-width: 767px) {
  .compare-hero {
    padding: 2.4rem 0;
  }

  .compare-hero > .container > p {
    font-size: 1.4rem;
  }
}

/* ===== Corpo da página ===== */
.compare-body {
  padding: 2.4rem 0 8rem;
}

.compare-empty {
  max-width: 56rem;
  margin: 0 auto;
  text-align: center;
  background: #fff;
  border: 1px solid #e5e9ec;
  border-radius: 2rem;
  padding: 5rem 4rem;
}

.compare-empty h2 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 2.4rem;
  color: #2d3643;
}

.compare-empty p {
  font-size: 1.6rem;
  color: #5b6672;
  line-height: 1.6;
  margin: 1.2rem 0 3.2rem;
}

.btn-compare-primary {
  display: inline-block;
  background: #ea3636;
  color: #fff;
  font-size: 1.6rem;
  border-radius: 3rem;
  padding: 1.6rem 3.6rem;
  transition: filter 0.3s ease;
}

.btn-compare-primary:hover {
  filter: brightness(1.08);
}

.compare-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 2.4rem;
}

.compare-summary span {
  font-size: 1.6rem;
  color: #2d3643;
}

.compare-summary a {
  font-size: 1.4rem;
  color: #ea3636;
}

/* ===== Tabela comparativa ===== */
.compare-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e5e9ec;
  border-radius: 2rem;
}

.compare-table {
  width: 100%;
  min-width: 76rem;
  border-collapse: collapse;
}

.compare-table th,
.compare-table td {
  padding: 1.8rem 2rem;
  border-bottom: 1px solid #eef1f3;
  vertical-align: top;
  text-align: left;
  font-size: 1.5rem;
  color: #2d3643;
}

.compare-table tr:last-child th,
.compare-table tr:last-child td {
  border-bottom: 0;
}

.compare-table th.compare-label-col {
  width: 15rem;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5b6672;
  position: sticky;
  left: 0;
  /* acompanha o zebra da linha (abaixo) para a coluna fixa não ficar
     branca quando a linha é listrada */
  background: var(--row-bg, #fff);
  z-index: 2;
  /* sombra à direita indica que a tabela continua rolando de lado */
  box-shadow: 1rem 0 1.2rem -0.8rem rgba(20, 25, 29, 0.28);
}

/* Zebra tipo table-striped: uma cor por linha, e a coluna de rótulos
   pega o mesmo tom via --row-bg. */
.compare-table tbody tr {
  --row-bg: #fff;
}

.compare-table tbody tr:nth-child(even) {
  --row-bg: #f7f9fa;
  background: #f7f9fa;
}

.compare-table td,
.compare-table th.compare-ad-col {
  border-left: 1px solid #eef1f3;
}

.compare-ad-col {
  width: 22rem;
  min-width: 20rem;
}

.compare-col-remove {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  color: #5b6672;
  background: #f4f6f8;
  transition: color 0.3s ease, background 0.3s ease;
}

.compare-col-remove:hover {
  color: #fff;
  background: #ea3636;
}

.compare-col-remove svg {
  width: 1.4rem;
  height: 1.4rem;
}

.compare-ad-col {
  position: relative;
}

.compare-col-photo {
  display: block;
  border-radius: 1.2rem;
  overflow: hidden;
  margin-bottom: 1.4rem;
}

.compare-col-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.compare-ad-col h2 {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  color: #2d3643;
  margin-top: 2rem;
}

.compare-ad-col > p {
  font-size: 1.4rem;
  color: #5b6672;
  margin-top: 0.4rem;
}

.compare-price {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.9rem;
  color: #2d3643;
  display: inline-block;
}

.compare-badge {
  display: inline-block;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: #ea3636;
  border-radius: 3rem;
  padding: 0.3rem 1rem;
  margin-left: 0.8rem;
  vertical-align: middle;
}

.compare-muted {
  color: #9aa4ae;
}

.compare-options {
  list-style: none;
  font-size: 1.4rem;
  color: #5b6672;
}

.compare-options li + li {
  margin-top: 0.6rem;
}

.compare-options li::before {
  content: "•";
  color: #ea3636;
  margin-right: 0.8rem;
}

.compare-footer-row td {
  padding-top: 2.4rem;
}

.compare-view-ad {
  display: inline-block;
  color: #fff;
  background: #ea3636;
  font-size: 1.4rem;
  border-radius: 3rem;
  padding: 1rem 2.4rem;
  transition: filter 0.3s ease;
}

.compare-view-ad:hover {
  filter: brightness(1.08);
}

.compare-add-col {
  text-align: center;
}

.compare-add-col a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 14rem;
  margin: 1.4rem;
  border: 0.2rem dashed #cdd5db;
  border-radius: 1.4rem;
  color: #5b6672;
  font-size: 1.5rem;
  padding: 2rem;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.compare-add-col a:hover {
  border-color: #ea3636;
  color: #ea3636;
}

.compare-add-plus {
  font-size: 3.2rem;
  line-height: 1;
  color: #ea3636;
}

/* ===== Botão de comparação dos cards de veículo ===== */
article.item {
  position: relative;
}

.compare-toggle {
  position: absolute;
  top: 2rem;
  left: 2rem;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #2d3643;
  box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.compare-toggle svg {
  width: 1.9rem;
  height: 1.9rem;
}

.compare-toggle:hover {
  background: #fff;
  color: #ea3636;
}

/* Ícone do card: vira uma pílula com "Comparar veículo" ao passar o mouse */
.compare-toggle:not(.compare-toggle-label) {
  box-sizing: border-box;
  width: auto;
  min-width: 3.6rem;
  padding: 0 0.85rem;
  border-radius: 1.8rem;
  box-shadow: none;
  transition: background 0.3s ease, color 0.3s ease;
}

.compare-toggle:not(.compare-toggle-label) svg {
  flex-shrink: 0;
}

.compare-toggle-text {
  display: inline-block;
  max-width: 0;
  margin-left: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1;
  color: inherit;
  transition: max-width 0.35s ease, margin-left 0.35s ease, opacity 0.2s ease;
}

@media (hover: hover) {
  .compare-toggle:hover .compare-toggle-text {
    max-width: 18rem;
    margin-left: 0.6rem;
    opacity: 1;
  }
}

.compare-toggle:focus-visible .compare-toggle-text {
  max-width: 18rem;
  margin-left: 0.6rem;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .compare-toggle-text {
    transition: none;
  }
}

.compare-toggle.is-active {
  background: #ea3636;
  color: #fff;
}

/* Botão com rótulo da página do anúncio */
.compare-toggle.compare-toggle-label {
  position: static;
  width: auto;
  height: auto;
  gap: 1rem;
  border-radius: 3rem;
  padding: 1.2rem 2.4rem;
  background: #ea3636;
  color: #fff;
  font-size: 1.5rem;
  box-shadow: none;
}

.compare-toggle.compare-toggle-label:hover {
  background: #ea3636;
  filter: brightness(1.08);
  transform: none;
}

.compare-toggle.compare-toggle-label.is-active {
  background: #14191d;
  color: #fff;
}

.compare-toggle.compare-toggle-label svg {
  width: 1.7rem;
  height: 1.7rem;
}

/* ícone e texto brancos: a regra "* { color }" do tema escurecia o span e o svg */
.compare-toggle.compare-toggle-label span,
.compare-toggle.compare-toggle-label svg {
  color: inherit;
}

.compare-detail-link {
  display: inline-block;
  margin-top: 1.2rem;
  font-size: 1.4rem;
  color: #ea3636;
}

/* ===== Barra flutuante de comparação ===== */
.compare-bar {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 1.6rem;
  background: #14191d;
  color: #fff;
  border-radius: 3rem;
  padding: 1rem 1.2rem 1rem 2rem;
  box-shadow: 0 0.6rem 2.4rem rgba(0, 0, 0, 0.35);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.compare-bar.is-hidden {
  transform: translateY(160%);
  opacity: 0;
  pointer-events: none;
}

.compare-bar svg {
  width: 2.2rem;
  height: 2.2rem;
  color: #ea3636;
  flex-shrink: 0;
}

.compare-bar .compare-bar-text {
  font-size: 1.6rem;
  color: #fff;
  white-space: nowrap;
}

.compare-bar .compare-bar-text strong {
  color: #fff;
  font-size: 1.8rem;
}

.compare-bar .compare-bar-cta {
  background: #ea3636;
  color: #fff;
  font-size: 1.5rem;
  border-radius: 3rem;
  padding: 1.1rem 2.2rem;
  white-space: nowrap;
  transition: filter 0.3s ease;
}

.compare-bar .compare-bar-cta:hover {
  filter: brightness(1.08);
}

.compare-bar .compare-bar-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.65);
  transition: color 0.3s ease, background 0.3s ease;
}

.compare-bar .compare-bar-clear:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.compare-bar .compare-bar-clear svg {
  width: 1.3rem;
  height: 1.3rem;
  color: currentColor;
}

/* ===== Toast ===== */
.compare-toast {
  position: fixed;
  left: 50%;
  bottom: 3rem;
  transform: translate(-50%, 1rem);
  z-index: 99;
  background: #14191d;
  color: #fff;
  font-size: 1.4rem;
  border-radius: 1rem;
  padding: 1.2rem 2rem;
  box-shadow: 0 0.6rem 2rem rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.compare-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== Mobile ===== */

/* Geometria da tabela até tablet: rótulo mais fino e colunas dimensionadas
   para CABEREM duas na tela (container tem 1.5rem de padding de cada lado,
   então cada coluna recebe metade do viewport menos rótulo e paddings). */
@media (max-width: 991px) {
  .compare-hero h1 {
    font-size: 3rem;
  }

  .compare-bar {
    right: 1rem;
    left: 1rem;
    bottom: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    text-align: center;
  }

  .compare-empty {
    padding: 4rem 2.4rem;
  }

  .compare-table-wrap {
    /* container das colunas: cqw dá a largura visível sem a scrollbar,
       que o vw inclui e infla as colunas no desktop */
    container-type: inline-size;
  }

  .compare-table {
    min-width: 0;
    /* fixed respeita os widths das colunas; no auto, palavras longas
       como "QUILOMETRAGEM" inflam a coluna de rótulos e engolem a tela */
    table-layout: fixed;
  }

  .compare-table th,
  .compare-table td {
    padding: 1.4rem 1.2rem;
    overflow-wrap: break-word;
  }

  .compare-table th.compare-label-col {
    width: 9rem;
    box-shadow: 0.8rem 0 1rem -0.6rem rgba(20, 25, 29, 0.28);
    /* palavras longas (QUILOMETRAGEM, COMBUSTÍVEL) quebram com hífen
       em vez de cortadas no meio pela célula estreita */
    hyphens: auto;
    -webkit-hyphens: auto;
  }

  .compare-ad-col {
    /* metade do espaço livre ao lado da coluna de rótulos; fallback em
       vw para navegadores sem container queries */
    width: calc(50vw - 6rem);
    width: calc(50cqw - 4.5rem);
  }

  /* com a coluna estreita, o badge não cabe ao lado do preço */
  .compare-badge {
    display: block;
    width: fit-content;
    margin: 0.5rem 0 0;
  }
}

/* Telas de celular: hero e conteúdo compactos para as duas colunas ficarem
   legíveis em ~130px cada. */
@media (max-width: 575px) {
  .compare-hero {
    padding: 5rem 0 3.6rem;
  }

  .compare-hero .tag {
    font-size: 1.1rem;
    padding: 0.6rem 1.6rem;
    margin-bottom: 1.6rem;
  }

  .compare-hero h1 {
    font-size: 3.2rem;
  }

  .compare-hero > .container > p {
    font-size: 1.5rem;
    margin-top: 1.2rem;
  }

  .compare-body {
    padding: 3.6rem 0 6rem;
  }

  .compare-summary {
    margin-bottom: 1.6rem;
  }

  .compare-summary span {
    font-size: 1.4rem;
  }

  .compare-table th,
  .compare-table td {
    padding: 1.2rem 1rem;
    font-size: 1.25rem;
  }

  .compare-table th.compare-label-col {
    padding: 1.2rem 0.8rem 1.2rem 1.2rem;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
  }

  .compare-col-remove {
    top: 1rem;
    right: 1rem;
    width: 2.6rem;
    height: 2.6rem;
  }

  .compare-col-photo {
    border-radius: 1rem;
    margin-bottom: 1rem;
  }

  .compare-ad-col h2 {
    font-size: 1.35rem;
    margin-top: 0.4rem;
  }

  .compare-ad-col > p {
    font-size: 1.2rem;
    line-height: 1.4;
  }

  .compare-price {
    font-size: 1.5rem;
  }

  .compare-badge {
    font-size: 1rem;
    padding: 0.25rem 0.8rem;
  }

  .compare-options {
    font-size: 1.2rem;
  }

  .compare-options li + li {
    margin-top: 0.5rem;
  }

  .compare-view-ad {
    display: block;
    text-align: center;
    font-size: 1.25rem;
    padding: 0.9rem 1rem;
  }

  .compare-add-col a {
    margin: 1rem;
    min-height: 10rem;
    padding: 1.4rem 1rem;
    font-size: 1.25rem;
    gap: 0.8rem;
  }

  .compare-add-plus {
    font-size: 2.4rem;
  }
}

@media (max-width: 767px) {
  .compare-hero h1 {
    font-size: 2.6rem;
  }

  /* celular: lado escuro e curvas; o vermelho cobria o "lado" (vermelho) do título */
  .compare-hero {
    /* mostra o lado escuro e as curvas; o vermelho ficaria sob o título */
    background-image: linear-gradient(rgba(5, 7, 10, 0.45), rgba(5, 7, 10, 0.45)),
      url("../img/bg-top-titulos.webp");
    background-position: 30% center;
  }
}
