/*
 * Componentes de Produto — Technical Authority Design
 *
 * Estilos para todas as views do CPT produto:
 *   - .produto-card         — card no archive/grid
 *   - .produto-hero         — hero section (imagem + info + quick-specs)
 *   - .produto-specs        — tabela de especificacoes no single
 *   - .produto-cta          — bloco de CTA (WhatsApp + cotacao) no single
 *   - .produto-gallery      — wrapper da imagem destacada no single
 *
 * Mobile-first. Usa custom properties definidas em global.css.
 * Zero JS. Zero frameworks. Speed is the aesthetic.
 */

/* ============================================================
   1. PRODUTO CARD (archive e relacionados)
   ============================================================ */

.produto-card {
  display: flex;
  flex-direction: column;
  background-color: var(--color-white);
  border-radius: var(--radius);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition-slow),
              transform var(--transition-slow),
              border-color var(--transition-slow);
  height: 100%;
}

.produto-card:hover {
  box-shadow: var(--shadow-elevated);
  transform: translateY(-3px);
  border-color: var(--color-border);
}

.produto-card .wp-block-post-featured-image {
  margin: 0;
  overflow: hidden;
}

.produto-card .wp-block-post-featured-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-slow);
}

.produto-card:hover .wp-block-post-featured-image img {
  transform: scale(1.04);
}

.produto-card .wp-block-post-featured-image:empty {
  height: 220px;
  background: var(--color-gray-light);
}

.produto-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--sp-6) var(--sp-4) var(--sp-4);
}

.produto-card-marca {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary);
  margin-bottom: var(--sp-2);
}

.produto-card-marca a {
  color: var(--color-primary);
  text-decoration: none;
}

.produto-card-titulo {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1.3;
  margin-bottom: var(--sp-3);
}

.produto-card-titulo a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.produto-card-titulo a:hover {
  color: var(--color-primary);
}

.produto-card-excerpt {
  font-size: var(--text-sm);
  color: var(--color-gray);
  line-height: 1.6;
  margin-bottom: var(--sp-4);
  flex: 1;
}

.produto-card-categoria {
  font-size: var(--text-xs);
  color: var(--color-gray);
  margin-bottom: var(--sp-4);
}

.produto-card-categoria a {
  color: var(--color-gray);
  text-decoration: none;
}

.produto-card .wp-block-buttons {
  margin-top: auto;
}

/* ============================================================
   2. HERO SECTION (single-produto)
   ============================================================ */

.produto-hero {
  position: relative;
}

/* Image frame */
.produto-image-frame {
  border: 1px solid var(--color-border-light);
}

.produto-image-frame .wp-block-post-featured-image {
  margin: 0;
}

.produto-image-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.produto-image-frame .wp-block-post-featured-image:empty {
  aspect-ratio: 4 / 3;
  background: var(--color-gray-light);
}

/* Info column */
.produto-info-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Marca badge */
.produto-marca {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: var(--sp-2);
  display: block;
}

.produto-marca a {
  color: var(--color-primary);
  text-decoration: none;
}

/* Title */
.produto-titulo {
  font-family: var(--font-heading);
  color: var(--color-secondary);
  line-height: 1.15;
  margin-bottom: var(--sp-4);
}

/* Excerpt */
.produto-excerpt {
  color: var(--color-gray-dark);
  margin-bottom: var(--sp-4);
}

/* ============================================================
   3. HERO QUICK-SPECS (PHP-injected pills)
   ============================================================ */

.produto-hero-specs {
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
}

/* Hide if empty (no specs injected) */
.produto-hero-specs:empty {
  display: none !important;
}

.produto-hero-specs .spec-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--color-secondary);
  color: var(--color-white);
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 3px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.produto-hero-specs .spec-pill .spec-label {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   4. PRODUTO CTA (hero — action block)
   ============================================================ */

.produto-cta {
  border: 1px solid var(--color-border);
}

.produto-cta .wp-block-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
}

.produto-cta .wp-block-button {
  width: 100%;
}

/* WhatsApp button */
.btn-whatsapp .wp-block-button__link,
.produto-cta .btn-whatsapp a {
  background-color: #25D366 !important;
  color: var(--color-white) !important;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  text-decoration: none;
  transition: background-color var(--transition), box-shadow var(--transition);
}

.btn-whatsapp .wp-block-button__link:hover {
  background-color: #1ead4f !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
}

/* WhatsApp icon via CSS */
.btn-whatsapp .wp-block-button__link::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
}

/* Cotação button */
.btn-cotacao .wp-block-button__link {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}

.btn-cotacao .wp-block-button__link:hover {
  background-color: var(--color-secondary) !important;
  color: var(--color-white) !important;
}

/* Trust badges */
.produto-trust {
  gap: var(--sp-2);
  justify-content: center;
}

.produto-trust p {
  margin: 0;
  line-height: 1;
}

/* ============================================================
   5. PRODUTO CONTENT (description area)
   ============================================================ */

.produto-content-area {
  position: relative;
}

/* Content typography */
.produto-content {
  line-height: 1.75;
}

.produto-content h2 {
  font-family: var(--font-heading);
  color: var(--color-secondary);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-4);
  padding-left: var(--sp-4);
  border-left: 3px solid var(--color-primary);
}

.produto-content h3 {
  font-family: var(--font-heading);
  color: var(--color-secondary);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
}

.produto-content p {
  color: var(--color-gray-dark);
}

.produto-content ul {
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.produto-content li {
  margin-bottom: var(--sp-3);
  line-height: 1.7;
}

.produto-content li strong {
  color: var(--color-secondary);
}

.produto-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.produto-content a:hover {
  color: var(--color-primary-dark);
}

/* First paragraph (lead) — slightly larger */
.produto-content > p:first-child {
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--color-gray-dark);
}

/* ============================================================
   6. PRODUTO SPECS TABLE (PHP-injected)
   ============================================================ */

.produto-specs-wrapper {
  margin-top: var(--sp-8);
}

.produto-specs__title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-secondary);
  margin-bottom: var(--sp-4);
  padding-left: var(--sp-4);
  border-left: 3px solid var(--color-primary);
}

.produto-specs {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.produto-specs caption {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-secondary);
  text-align: left;
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  caption-side: top;
}

.produto-specs th,
.produto-specs td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
}

.produto-specs tr:last-child th,
.produto-specs tr:last-child td {
  border-bottom: none;
}

.produto-specs th {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-secondary);
  background-color: var(--color-white);
  width: 40%;
  white-space: nowrap;
}

.produto-specs td {
  color: var(--color-gray-dark);
  background-color: var(--color-white);
  font-weight: 500;
}

.produto-specs tbody tr:hover td,
.produto-specs tbody tr:hover th {
  background-color: var(--color-surface);
}

/* PDF download link */
.produto-specs__pdf {
  margin-top: var(--sp-4);
}

.produto-specs__pdf a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.produto-specs__pdf a:hover {
  text-decoration: underline;
}

.produto-specs__pdf a::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23C93A1A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
}

/* Specs table responsive */
@media (max-width: 480px) {
  .produto-specs th,
  .produto-specs td {
    display: block;
    width: 100%;
    white-space: normal;
  }

  .produto-specs th {
    background-color: var(--color-secondary);
    color: var(--color-white);
    padding-bottom: var(--sp-1);
    border-bottom: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .produto-specs td {
    padding-top: var(--sp-1);
    padding-bottom: var(--sp-3);
    font-size: var(--text-base);
  }

  /* Comparison tables (Modelos e Variantes) — horizontal scroll on mobile */
  .produto-content table:not(.produto-specs) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ============================================================
   7. ARCHIVE HEADER e FILTROS
   ============================================================ */

.produto-archive-header {
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: var(--sp-8);
  margin-bottom: var(--sp-12);
}

.produto-archive-title {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--color-secondary);
  margin-bottom: var(--sp-4);
}

@media (max-width: 768px) {
  .produto-archive-title {
    font-size: var(--text-2xl);
  }
}

.produto-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin-top: var(--sp-4);
}

.produto-filtros .wp-block-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.produto-filtros .wp-block-tag-cloud a {
  font-size: var(--text-sm) !important;
  color: var(--color-secondary);
  background-color: var(--color-gray-light);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
  border: 1px solid transparent;
}

.produto-filtros .wp-block-tag-cloud a:hover,
.produto-filtros .wp-block-tag-cloud a.current {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}

/* ============================================================
   9. PRODUTOS RELACIONADOS
   ============================================================ */

.produtos-relacionados {
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--sp-12);
  padding-bottom: var(--sp-12);
}

/* ============================================================
   10. PAGINAÇÃO
   ============================================================ */

.produto-paginacao {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-12);
}

.produto-paginacao .wp-block-query-pagination-numbers a,
.produto-paginacao .wp-block-query-pagination-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}

.produto-paginacao .wp-block-query-pagination-numbers a {
  background-color: var(--color-gray-light);
  color: var(--color-secondary);
}

.produto-paginacao .wp-block-query-pagination-numbers a:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.produto-paginacao .wp-block-query-pagination-numbers span.current {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* ============================================================
   11. LAYOUT RESPONSIVE (hero columns)
   ============================================================ */

@media (max-width: 768px) {
  .produto-layout.wp-block-columns {
    flex-direction: column;
  }

  .produto-layout .wp-block-column {
    width: 100% !important;
    flex-basis: 100% !important;
  }

  .produto-image-frame {
    margin-bottom: var(--sp-4);
  }
}

/* ============================================================
   12. CTA STRIP (pre-footer — navy background)
   ============================================================ */

.produto-cta-strip {
  margin-top: 0;
}

.produto-cta-strip .wp-block-buttons {
  width: 100%;
}

.produto-cta-strip .wp-block-button__link {
  text-align: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
}

@media (max-width: 768px) {
  .produto-cta-strip .wp-block-columns {
    flex-direction: column;
  }
  .produto-cta-strip .wp-block-column {
    width: 100% !important;
    flex-basis: 100% !important;
    text-align: center;
  }
}

/* ============================================================
   13. STICKY WHATSAPP CTA (mobile only — injected via PHP footer)
   ============================================================ */

.produto-sticky-cta {
  display: none;
}

@media (max-width: 768px) {
  .produto-sticky-cta {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    padding: var(--sp-3) var(--sp-4);
    background-color: var(--color-white);
    border-top: 1px solid var(--color-border-light);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
  }

  .produto-sticky-cta__link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    width: 100%;
    padding: 14px var(--sp-4);
    background-color: #25D366;
    color: var(--color-white);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--text-base);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background-color var(--transition);
  }

  .produto-sticky-cta__link:hover {
    background-color: #1ead4f;
  }

  /* Reserve space for sticky CTA */
  .single-produto {
    padding-bottom: 72px;
  }
}

/* ============================================================
   14. TOMBSTONE BANNERS (descontinuados / sob consulta)
   ============================================================ */

.tombstone-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 32px;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.tombstone-descontinuado {
  background-color: #fff8e5;
  border-left: 3px solid #d97706;
  color: #78350f;
}

.tombstone-sob-consulta {
  background-color: #eff6ff;
  border-left: 3px solid #3b82f6;
  color: #1e3a5f;
}

.tombstone-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.tombstone-descontinuado .tombstone-icon { color: #d97706; }
.tombstone-sob-consulta .tombstone-icon  { color: #3b82f6; }

.tombstone-text strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 700;
}

.tombstone-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.tombstone-link:hover { text-decoration: underline; }
