body {
  background-color: #f4f7f9;
}

.product-item-generic {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
  margin: 4px;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
  box-sizing: border-box;
  transition: box-shadow 0.2s ease;
}
.product-item-generic:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-item-generic .product-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  margin-bottom: 6px;
}

.product-item-generic .product-name {
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.product-item-generic .product-price {
  font-size: 1rem;
  font-weight: bold;
  color: blue;
  text-align: center;
}

.image-container {
  /* borda discreta: 1px sólido com cinza claríssimo */
  border: 1px solid rgba(0, 0, 0, 0.2);
  /* cantos levemente arredondados */
  border-radius: 0.375rem;
  /* um pouco de içamento interno para não grudar no conteúdo */
  padding: 0.75rem;
}

.filter-section {
  /* borda discreta: 1px sólido com cinza claríssimo */
  border: 1px solid rgba(0, 0, 0, 0.2);
  /* cantos levemente arredondados */
  border-radius: 0.375rem;
  /* um pouco de içamento interno para não grudar no conteúdo */
  padding: 0.75rem;
}

.component-container {
  background-color: #fff;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.component-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.component-header h1 {
  color: #333;
}

.image-container {
  max-width: 100%;
  overflow: auto;
  position: relative;
}

.zoom-controls {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.25rem;
  z-index: 10;
}

.zoom-controls .btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 0.25rem;
}

@media (max-width: 576px) {
  .zoom-controls .btn {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }
}

.image-container img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.table-container {
  max-width: 100%;
  min-height: 800px !important;
  overflow-y: auto;
  overflow-x: auto;
}

table.table > tbody > tr > td {
  padding: 4px;
  vertical-align: middle;
  font-size: 0.75em;
}

table.table > thead > tr > th {
  padding: 6px;
  vertical-align: middle;
  font-size: 0.8em;
}

table.table td {
  text-align: center;
}

table.table td.left-align {
  text-align: left;
}

.table-container thead th {
  position: sticky;
  top: 0;
  background-color: #fff;
  z-index: 2;
}

.no-wrap {
  white-space: nowrap;
}

.highlight {
  background-color: #acd8e6 !important;
  color: #000 !important;
}

table.table tbody tr.highlight,
table.table tbody tr.highlight td {
  opacity: 1 !important;
  background-color: #acd8e6 !important;
  color: #000 !important;
}

table.table tbody tr[data-item] {
  cursor: pointer;
}

/* Estilo para o formulário de detalhes inline */
.detail-form-container {
  display: none;
}

.detail-form {
  background: #f8f9fa;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.detail-form-header h5 {
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.detail-form-body label {
  font-weight: 600;
}

/* CSS global */
.product-list {
  background-color: white;
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  /* nunca quebra linha */
  gap: 1rem;
  overflow-x: auto;
  /* se não couber, permite scroll */
  padding: 0.5rem 0;
  cursor: pointer;
}

.product-item {
  flex: 0 0 auto;
  width: 180px;
  text-decoration: none;
  color: inherit;
  border: 1px solid #ddd;
  border-radius: 0.25rem;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: box-shadow 0.2s ease;
  position: relative;
}

.product-item.exact-match {
  border-color: #16a34a;
  box-shadow: 2px rgba(22, 163, 74, 0.18);
}

.product-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-image {
  width: 95px;
  height: 95px;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.product-name {
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-weight: bold;
  font-size: 0.9rem;
  color: #007bff;
}

.source-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.65rem;
  padding: 0.25em 0.4em;
  opacity: 0.8;
}

.product-list-title {
  display: inline-block;
  /* ajusta ao tamanho do texto */
  background-color: #ffe600;
  /* azul vivo */
  color: #000000;
  /* texto branco */
  padding: 0.4rem 0.8rem;
  /* espaço interno confortável */
  border-radius: 0.25rem;
  /* cantos arredondados */
  font-size: 1.3rem;
  /* leve aumento de tamanho */
  font-weight: 600;
  /* semi-bold */
  margin-bottom: 0.75rem;
  /* separação maior da lista */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  /* sombra sutil */
}

.disclaimer {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  /* texto menor */
  font-style: italic;
  /* opcional, para suavizar */
  color: #666;
  line-height: 1.4;
}

#detail-item-container {
  width: 100%;
  max-width: 350px;
  margin: 0 auto;
  overflow: hidden;
}

#detail-item-container .adsbygoogle {
  display: block !important;
  width: 100% !important;
  height: auto !important;
}

/* Painel flutuante */
#floating-availability-container {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 700px;
  /* largura máxima */
  background-color: #fff;
  /* branco puro para contraste */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#floating-availability-close {
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  font-size: 1.75rem;
  /* aumentado de 1.2rem para 1.75rem */
  line-height: 1;
  cursor: pointer;
  color: #333;
}

/* Loading visível até o inner ser preenchido */
#floating-availability-container .availability-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border: 1px solid #ddd;
  border-radius: 0.375rem;
  color: #333;
  font-weight: 500;
  font-size: 0.95rem;
}

#floating-availability-container .availability-inner {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
}

/* Quando tiver conteúdo, esconde o loading e mostra o inner */
#floating-availability-container.has-availability .availability-loading {
  display: none;
}

#floating-availability-container.has-availability .availability-inner {
  display: flex;
}

/* Título e lista */
#floating-availability-container .product-list-title {
  background-color: #ffe600;
  color: #000;
  padding: 0.25rem 0.5rem;
  /* padding menor */
  font-size: 1rem;
  /* fonte menor */
  font-weight: 600;
  border-radius: 0.25rem;
  align-self: center;
}

#floating-availability-container .product-list {
  display: flex;
  flex-wrap: nowrap;
  /* mantém em uma linha */
  gap: 0.75rem;
  padding: 0 1rem;
  /* buffer interno p/ não cortar cards */
  box-sizing: border-box;
  overflow-x: auto;
  /* scroll horizontal sempre ativo se extrapolar */
  scroll-padding: 0 1rem;
  /* buffer ao rolar */
  /* retire width: max-content e margin:0 auto se existir */
}

#floating-availability-container .product-item {
  flex: 0 0 auto;
  width: 160px;
}

#floating-availability-container .disclaimer {
  font-size: 0.75rem;
  text-align: center;
}

/* Responsividade */
@media (max-width: 576px) {
  #floating-availability-container {
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem;
  }

  #floating-availability-container .product-item {
    width: 120px;
  }
}

/* Pontinhos mais visíveis */
#floating-availability-container .availability-loading .dot {
  color: #007bff;
  /* azul para chamar atenção */
  animation: blink 1s infinite;
  margin: 0 2px;
}

/* Esconde o botão fechar até que os anúncios sejam carregados */
#floating-availability-container:not(.has-availability)
  #floating-availability-close {
  display: none;
}

@keyframes blink {
  0%,
  20% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@media (max-width: 576px) {
  /* Ajusta o painel para caber na tela */
  #floating-availability-container {
    left: 0.5rem !important;
    right: 0.5rem !important;
    bottom: 0.5rem !important;
    width: auto;
    max-width: calc(100% - 1rem);
    transform: none;
    /* retira o translateX(-50%) */
    padding: 0.5rem;
  }

  #floating-availability-container .product-list {
    gap: 0.5rem;
  }

  #floating-availability-container .product-list .product-item {
    flex: 0 0 calc((100% - 0.5rem) / 2);
    width: calc((100% - 0.5rem) / 2);
  }

  /* Itens menores para caber mais fácil */
  #floating-availability-container .product-item {
    width: 100px;
    /* ou até 90px, se preferir */
  }

  /* Fecha mais visível no canto */
  #floating-availability-close {
    top: 0.25rem !important;
    right: 0.25rem !important;
    font-size: 1.5rem;
  }

  /* Remove sombra exagerada e borda muito larga */
  #floating-availability-container {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.1);
  }

  /* Scroll mais “tátil” */
  #floating-availability-container .product-list {
    gap: 0.5rem;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }
}

.badge-compativel-outline {
  position: relative;
  padding: 2px 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #28a745;
  border: 1px solid #28a745;
  border-radius: 4px;
  background-color: #fff;
  animation: badgePulse 1s infinite ease-in-out;
}

@keyframes badgePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

/* Efeito de brilho passando por cima */
.badge-compativel-outline::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  transform: skewX(-20deg);
  animation: badgeShine 1s infinite;
}

@keyframes badgeShine {
  0% {
    left: -50%;
  }
  100% {
    left: 150%;
  }
}

.badge-compativel-outline:hover {
  background-color: rgba(40, 167, 69, 0.1);
}

.badge-verificar-outline {
  padding: 2px 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #a77428;
  border: 1px solid #a77428;
  border-radius: 4px;
}
.badge-verificar-outline:hover {
  background-color: rgba(167, 116, 40, 0.1);
}

/* 1) Transição suave para mudança de cor de fundo (já feito via JS) */
#loading-container {
  transition: background-color 0.5s ease;
}

/* 2) Animação de “pulse” + leve “bounce” no texto */
#loading-text {
  display: inline-block; /* necessário para transformar */
  animation: pulseBounce 1s infinite; /* duração: 1.5s, repete para sempre */
}

/* 3) Keyframes combinando leve expansão (“pulse”) e movimento vertical (“bounce”) */
@keyframes pulseBounce {
  0%,
  100% {
    transform: scale(0.9) translateY(0);
    opacity: 1;
  }
  50% {
    transform: scale(1.1) translateY(-5px);
    opacity: 0.9;
  }
}

/* 4) Opcional: adicione uma borda luminosa para destacar ainda mais */
#loading-container {
  border-radius: 0.25rem;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

/* Highlight minimalista para peças substitutas */
.substitute-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.substitute-item {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border: 1px solid #007bff;
  background: #f0f8ff;
  border-radius: 0.25rem;
  font-weight: bold;
  font-size: 0.9rem;
}
@media (max-width: 576px) {
  .substitute-item {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
  }
}
