/*
 * Ficha de produto em blocos (18/11/2026) — app/_lib/product-page.ts.
 * Identidade Evidelo: cabeçalho azul-marinho quase preto (o do site),
 * fundo creme, destaques violeta/lilás, botões roxos, selos verdes.
 * Cada bloco só existe no HTML se tiver dado; nada aqui reserva espaço
 * para bloco ausente — a grade se reorganiza sozinha.
 */
.pdp3-page {
  --p3-bg: #f6f4ef;
  --p3-card: #ffffff;
  --p3-ink: #15171c;
  --p3-muted: #636a78;
  --p3-line: #e6e1d7;
  --p3-navy: #070c16;
  --p3-violet: #6a3df0;
  --p3-violet-dark: #5329d6;
  --p3-violet-ink: #4b2bb8;
  --p3-lilac: #ece6ff;
  --p3-lilac-2: #f5f1ff;
  --p3-green: #15803d;
  --p3-green-bg: #dcfce7;
  --p3-best: #16a34a;
  --p3-radius: 18px;
  --p3-tabs-top: 72px;
  background: var(--p3-bg);
  color: var(--p3-ink);
}
.pdp3 { padding-bottom: 48px; }
.pdp3-wrap { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.pdp3-ico { width: 18px; height: 18px; flex: none; }
.pdp3-ico--round {
  width: 34px; height: 34px; padding: 8px; border-radius: 50%;
  background: var(--p3-lilac); color: var(--p3-violet-ink);
}

/* ---------- topo ---------- */
.pdp3-crumb {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 18px 0 14px; font-size: 13px; color: var(--p3-muted);
}
.pdp3-crumb a { color: var(--p3-muted); text-decoration: none; flex: none; }
.pdp3-crumb a:hover { color: var(--p3-violet-ink); text-decoration: underline; }
.pdp3-crumb [aria-current] {
  color: var(--p3-ink); font-weight: 600; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pdp3-top {
  display: grid; gap: 20px 40px; align-items: start;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  grid-template-areas: "gallery heading" "gallery buy";
  grid-template-rows: auto 1fr;
  background: var(--p3-card); border: 1px solid var(--p3-line);
  border-radius: 24px; padding: 28px;
}
.pdp3-top--noimg { grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); grid-template-areas: "heading buy"; grid-template-rows: auto; }
.pdp3-heading { grid-area: heading; min-width: 0; }
.pdp3-gallery { grid-area: gallery; min-width: 0; display: grid; gap: 12px; }
.pdp3-buy { grid-area: buy; }
.pdp3-title {
  margin: 0; font-size: clamp(1.35rem, 2.3vw, 1.85rem); line-height: 1.25;
  font-weight: 750; letter-spacing: -0.015em; overflow-wrap: anywhere; text-wrap: balance;
}
/* Nome inteiro, sem corte: nomes longos ganham fonte menor para caber em ~3 linhas. */
.pdp3-title--lg { font-size: clamp(1.2rem, 1.9vw, 1.5rem); }
.pdp3-title--xl { font-size: clamp(1.05rem, 1.6vw, 1.25rem); }
.pdp3-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin-top: 12px; font-size: 14px; color: var(--p3-muted);
}
.pdp3-dot { width: 4px; height: 4px; border-radius: 50%; background: #c9c3b6; }
.pdp3-brand { font-weight: 700; color: var(--p3-violet-ink); }
.pdp3-rating, .pdp3-stores { display: inline-flex; align-items: center; gap: 6px; }
.pdp3-rating strong { color: var(--p3-ink); }
.pdp3-stars {
  --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.8l2.8 5.9 6.4.8-4.7 4.4 1.2 6.4L12 17.2l-5.7 3.1 1.2-6.4L2.8 9.5l6.4-.8z'/%3E%3C/svg%3E");
  position: relative; display: inline-block; width: 86px; height: 16px; flex: none;
  background: #ddd6c8; -webkit-mask: var(--star) left/17.2px 16px repeat-x; mask: var(--star) left/17.2px 16px repeat-x;
}
.pdp3-stars__fill { position: absolute; inset: 0 auto 0 0; background: #f5a524; }
.pdp3-stars--sm { width: 70px; height: 13px; -webkit-mask-size: 14px 13px; mask-size: 14px 13px; }

.pdp3-photo {
  aspect-ratio: 1 / 1; border-radius: var(--p3-radius); background: #fff;
  border: 1px solid var(--p3-line); display: grid; place-items: center; overflow: hidden;
}
.pdp3-photo img { width: 100%; height: 100%; object-fit: contain; padding: 18px; }
.pdp3-thumbs { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.pdp3-thumb {
  flex: none; width: 68px; height: 68px; border-radius: 12px; padding: 4px;
  background: #fff; border: 2px solid var(--p3-line); cursor: pointer;
}
.pdp3-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pdp3-thumb:hover, .pdp3-thumb.is-active { border-color: var(--p3-violet); }

/* caixa roxa de melhor preço */
.pdp3-buy {
  border-radius: 22px; padding: 22px 22px 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #8b6cff 0%, #6a3df0 45%, #4a22c4 100%);
  box-shadow: 0 18px 40px -18px #4a22c4aa;
}
.pdp3-buy__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pdp3-buy__label { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #e5dcff; }
.pdp3-buy__price { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 6px; line-height: 1.1; }
.pdp3-buy__line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #efe9ff; margin-top: 4px; }
.pdp3-buy__store { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 15px; color: #efe9ff; }
.pdp3-buy__store strong { color: #fff; }
.pdp3-buy__actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 18px; }
.pdp3-buy .pdp3-btn--primary { background: #fff; color: var(--p3-violet-ink); }
.pdp3-buy .pdp3-btn--primary:hover { background: var(--p3-lilac); }
.pdp3-buy .pdp3-btn--ghost { color: #fff; border-color: #ffffff66; background: transparent; }
.pdp3-buy .pdp3-btn--ghost:hover { background: #ffffff1f; }

.pdp3-save {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 5px 11px; font-size: 13px; font-weight: 750;
  background: var(--p3-green-bg); color: var(--p3-green);
}
.pdp3-save--sm { position: absolute; top: 8px; left: 8px; padding: 3px 8px; font-size: 12px; }

.pdp3-store {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--store-bg, var(--p3-lilac)); color: var(--store-fg, var(--p3-violet-ink));
  font-size: 12px; font-weight: 800; letter-spacing: -0.02em; box-shadow: 0 0 0 2px #ffffff;
}
.pdp3-store--img { object-fit: contain; background: #fff; }

/* botões */
.pdp3-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.pdp3-btn:active { transform: translateY(1px); }
.pdp3-btn--primary { background: var(--p3-violet); color: #fff; }
.pdp3-btn--primary:hover { background: var(--p3-violet-dark); }
.pdp3-btn--ghost { background: #fff; color: var(--p3-violet-ink); border-color: #cbbcff; }
.pdp3-btn--ghost:hover { background: var(--p3-lilac-2); }
.pdp3-btn--small { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.pdp3-btn .pdp3-ico { width: 17px; height: 17px; }
.pdp3-btn[disabled] { opacity: .7; cursor: progress; }
.pdp3-link {
  background: none; border: 0; padding: 0; margin-top: 10px; cursor: pointer;
  color: var(--p3-violet-ink); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- menu interno ---------- */
.pdp3-tabs {
  position: sticky; top: var(--p3-tabs-top); z-index: 40; margin: 18px 0 6px;
  background: color-mix(in srgb, var(--p3-bg) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--p3-line);
}
.pdp3-tabs__inner {
  width: min(1180px, calc(100% - 32px)); margin-inline: auto; display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
}
.pdp3-tabs__inner::-webkit-scrollbar { display: none; }
.pdp3-tabs a {
  flex: none; scroll-snap-align: start; padding: 14px 14px 12px; font-size: 14.5px; font-weight: 650;
  color: var(--p3-muted); text-decoration: none; border-bottom: 3px solid transparent;
}
.pdp3-tabs a:hover { color: var(--p3-ink); }
.pdp3-tabs a.is-active { color: var(--p3-violet-ink); border-bottom-color: var(--p3-violet); }

/* ---------- blocos ---------- */
.pdp3-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 18px; }
.pdp3-sec {
  grid-column: 1 / -1; background: var(--p3-card); border: 1px solid var(--p3-line);
  border-radius: 22px; padding: 24px; min-width: 0;
  scroll-margin-top: calc(var(--p3-tabs-top) + 64px);
}
/* Histórico e Análise dividem a linha quando ambos existem; sozinho, ocupa tudo. */
#historico:has(+ #analise), #historico + #analise { grid-column: auto; }
.pdp3-sec--slim { padding: 16px 20px; }
.pdp3-sec__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pdp3-sec__head h2 { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 1.2rem; font-weight: 750; letter-spacing: -0.01em; }
.pdp3-sec h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 750; }

/* preços */
.pdp3-filters { display: grid; gap: 10px; margin-bottom: 14px; }
.pdp3-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pdp3-filter > span { font-size: 13px; font-weight: 700; color: var(--p3-muted); margin-right: 2px; }
.pdp3-chip {
  border: 1.5px solid var(--p3-line); background: #fff; border-radius: 999px; padding: 6px 13px;
  font-size: 13.5px; font-weight: 600; color: var(--p3-ink); cursor: pointer;
}
.pdp3-chip.is-active { background: var(--p3-lilac); border-color: var(--p3-violet); color: var(--p3-violet-ink); }
.pdp3-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--p3-muted); font-weight: 600; }
.pdp3-sort select {
  border: 1.5px solid var(--p3-line); border-radius: 10px; padding: 7px 10px; background: #fff;
  font: inherit; color: var(--p3-ink); font-weight: 650;
}
.pdp3-offers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pdp3-offer {
  display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 14px 16px; border: 1px solid var(--p3-line); border-radius: 16px; background: #fff;
}
.pdp3-offer.is-best { border-color: #86efac; background: linear-gradient(90deg, #f0fdf4, #fff 70%); }
.pdp3-offer[hidden] { display: none; }
.pdp3-offer__store { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pdp3-offer__store strong { display: block; font-size: 15px; }
.pdp3-offer__store small { display: block; color: var(--p3-muted); font-size: 12.5px; }
.pdp3-offer__bar { display: grid; gap: 6px; min-width: 0; }
.pdp3-bar { height: 10px; border-radius: 999px; background: #f1ede4; overflow: hidden; }
.pdp3-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a78bfa, var(--p3-violet)); }
.pdp3-offer.is-best .pdp3-bar > span { background: linear-gradient(90deg, #4ade80, var(--p3-best)); }
.pdp3-bar--thin { height: 8px; }
.pdp3-offer__price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pdp3-offer__price strong { font-size: 18px; font-weight: 800; }
.pdp3-offer__price s { color: var(--p3-muted); font-size: 13px; }
.pdp3-offer__extra { color: var(--p3-muted); font-size: 12.5px; }
.pdp3-tag { font-size: 12px; font-weight: 750; color: var(--p3-green); background: var(--p3-green-bg); padding: 3px 9px; border-radius: 999px; }
.pdp3-commission { margin: 14px 0 0; font-size: 12.5px; color: var(--p3-muted); }

/* histórico */
.pdp3-seg { display: inline-flex; background: var(--p3-lilac-2); border-radius: 12px; padding: 4px; gap: 2px; }
.pdp3-seg button {
  border: 0; background: transparent; border-radius: 9px; padding: 7px 12px; font-weight: 650;
  font-size: 13px; color: var(--p3-muted); cursor: pointer;
}
.pdp3-seg button.is-active { background: #fff; color: var(--p3-violet-ink); box-shadow: 0 1px 3px #0000001a; }
.pdp3-hist__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.pdp3-hist__stats div { background: var(--p3-lilac-2); border-radius: 14px; padding: 12px 14px; }
.pdp3-hist__stats span { display: block; font-size: 12.5px; color: var(--p3-muted); }
.pdp3-hist__stats strong { font-size: 18px; }
.pdp3-chart { width: 100%; aspect-ratio: 16 / 7; min-height: 180px; }
.pdp3-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pdp3-chart .grid { stroke: #ece7dc; }
.pdp3-chart .axis { fill: var(--p3-muted); font-size: 11px; }
.pdp3-chart .line { fill: none; stroke: var(--p3-violet); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.pdp3-chart .area { fill: url(#pdp3Grad); }
.pdp3-chart .dot { fill: #fff; stroke: var(--p3-violet); stroke-width: 2; }

/* análise */
.pdp3-know-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pdp3-know { border: 1px solid var(--p3-line); border-radius: 16px; padding: 16px; background: #fff; min-width: 0; }
.pdp3-know h3 { display: flex; align-items: center; gap: 10px; }
.pdp3-know p { margin: 0; line-height: 1.55; font-size: 14.5px; }
.pdp3-know ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.45; }
.pdp3-know__label { font-weight: 800; color: var(--p3-violet-ink); margin-bottom: 4px !important; }
.pdp3-know--pro .pdp3-ico--round { background: var(--p3-green-bg); color: var(--p3-green); }
.pdp3-know--con .pdp3-ico--round { background: #ffe4e6; color: #be123c; }
.pdp3-score {
  --deg: calc(var(--score) * 3.6deg);
  width: 110px; height: 110px; border-radius: 50%; margin: 6px auto 0; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, #fff 78%, transparent 79%), conic-gradient(var(--p3-violet) var(--deg), var(--p3-lilac) 0);
}
.pdp3-score strong { font-size: 30px; line-height: 1; }
.pdp3-score span { font-size: 12px; color: var(--p3-muted); }
.pdp3-ai { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.pdp3-sec--slim .pdp3-ai { margin-top: 0; }
.pdp3-ai__status { font-size: 14px; color: var(--p3-muted); }

/* detalhes */
.pdp3-desc p { margin: 0; line-height: 1.65; font-size: 15px; white-space: pre-line; }
.pdp3-desc.is-clamped p { max-height: 9.9em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.pdp3-desc + .pdp3-link + .pdp3-specs, .pdp3-desc + .pdp3-specs { margin-top: 24px; }
.pdp3-specs dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.pdp3-specs dl > div[hidden] { display: none; }
.pdp3-specs dl > div { display: grid; grid-template-columns: minmax(110px, 42%) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0ebe1; font-size: 14px; }
.pdp3-specs dt { color: var(--p3-muted); }
.pdp3-specs dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* avaliações */
.pdp3-rev { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 28px; align-items: start; }
.pdp3-rev__summary { display: grid; gap: 16px; }
.pdp3-rev__avg { display: grid; justify-items: start; gap: 6px; }
.pdp3-rev__avg strong { font-size: 44px; line-height: 1; font-weight: 800; }
.pdp3-rev__avg span:last-child { color: var(--p3-muted); font-size: 13.5px; }
.pdp3-rev__dist { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.pdp3-rev__dist li { display: grid; grid-template-columns: 30px 1fr 34px; align-items: center; gap: 8px; font-size: 13px; color: var(--p3-muted); }
.pdp3-rev__dist .pdp3-bar > span { background: #f5a524; }
.pdp3-comments { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pdp3-comment { border: 1px solid var(--p3-line); border-radius: 14px; padding: 14px 16px; }
.pdp3-comment[hidden] { display: none; }
.pdp3-comment__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pdp3-comment__head small { color: var(--p3-muted); font-size: 12.5px; }
.pdp3-comment p { margin: 0; line-height: 1.55; font-size: 14.5px; }
.pdp3-rev:has(.pdp3-rev__summary:empty) { grid-template-columns: 1fr; }

/* semelhantes */
.pdp3-carousel__nav { display: flex; gap: 6px; }
.pdp3-carousel__nav button {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--p3-line); background: #fff;
  display: grid; place-items: center; cursor: pointer; color: var(--p3-ink);
}
.pdp3-carousel__nav button:hover { border-color: var(--p3-violet); color: var(--p3-violet-ink); }
.pdp3-carousel {
  list-style: none; margin: 0; padding: 2px 2px 10px; display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(200px, calc((100% - 4 * 14px) / 5)); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.pdp3-sim { scroll-snap-align: start; display: grid; grid-template-rows: 1fr auto; gap: 10px; border: 1px solid var(--p3-line); border-radius: 16px; padding: 12px; background: #fff; }
.pdp3-sim__link { display: grid; align-content: start; gap: 8px; color: inherit; text-decoration: none; }
.pdp3-sim__img { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; background: #fff; }
.pdp3-sim__img img { width: 100%; height: 100%; object-fit: contain; }
.pdp3-sim__name { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pdp3-sim__link:hover .pdp3-sim__name { color: var(--p3-violet-ink); }
.pdp3-sim__price { font-size: 17px; font-weight: 800; }
.pdp3-sim__price small { display: block; font-size: 12px; font-weight: 600; color: var(--p3-muted); }
.pdp3-sim .pdp3-btn { width: 100%; }

/* barra fixa (celular) */
.pdp3-sticky { display: none; }

/* ---------- tablet / celular ---------- */
@media (max-width: 1023px) {
  .pdp3-page { --p3-tabs-top: 72px; }
  .pdp3-carousel { grid-auto-columns: minmax(190px, 34%); }
}
@media (max-width: 860px) {
  .pdp3-top, .pdp3-top--noimg {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "heading" "gallery" "buy";
    grid-template-rows: auto; padding: 18px; gap: 16px; border-radius: 20px;
  }
  .pdp3-photo { max-height: 72vw; aspect-ratio: auto; height: 72vw; }
  .pdp3-blocks { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  #historico:has(+ #analise), #historico + #analise { grid-column: 1 / -1; }
  .pdp3-sec { padding: 18px; border-radius: 18px; }
  .pdp3-offer { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "store btn" "bar bar"; gap: 10px 12px; }
  .pdp3-offer__store { grid-area: store; }
  .pdp3-offer__bar { grid-area: bar; }
  .pdp3-offer > .pdp3-btn { grid-area: btn; }
  .pdp3-specs dl { grid-template-columns: minmax(0, 1fr); }
  .pdp3-rev { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .pdp3-carousel { grid-auto-columns: 62%; }
  .pdp3-carousel__nav { display: none; }
  .pdp3-crumb { padding: 12px 0 10px; }
  .pdp3-sticky {
    position: fixed; inset: auto 0 0 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--p3-navy); color: #fff;
    box-shadow: 0 -8px 24px #0000002e; transform: translateY(110%); transition: transform .2s ease;
  }
  .pdp3-sticky.is-visible { transform: none; }
  .pdp3-sticky small { display: block; font-size: 12px; color: #b9c2d3; }
  .pdp3-sticky strong { font-size: 20px; font-weight: 800; }
  .pdp3-sticky .pdp3-btn { min-height: 44px; }
  .pdp3-page:has(.pdp3-sticky) .evidelo-footer { padding-bottom: 84px; }
}
@media (max-width: 420px) {
  .pdp3-buy__actions { grid-template-columns: 1fr; }
  .pdp3-hist__stats strong { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pdp3-sticky, .pdp3-btn { transition: none; }
}
