/* ==================== SEARCH AUTOCOMPLETE DROPDOWN ==================== */

/* Make .header-search the positioning parent */
.header-search {
  position: relative;
}

/* ── Dropdown container ── */
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: min(480px, calc(100vw - 24px));
  min-width: 0;
  max-height: 440px;
  overflow-y: auto;
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
  z-index: 9999;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-200) transparent;
}

.search-dropdown.is-open {
  display: block;
}

/* ── Sections ── */
.sd-section {
  padding: 4px 0;
}

.sd-section + .sd-section {
  border-top: 1px solid var(--gray-100);
}

.sd-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 8px 16px 4px;
}

/* ── Items ── */
.sd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.sd-item:hover,
.sd-item.is-active {
  background: var(--orange-50);
}

.sd-item-icon {
  color: var(--gray-400);
  flex-shrink: 0;
}

/* ── Product items ── */
.sd-item--product {
  gap: 12px;
}

.sd-product-img {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sd-product-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sd-product-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-product-ref {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sd-ref-badge {
  display: inline-block;
  background: var(--orange-50);
  color: var(--orange-600);
  border: 1px solid var(--orange-100);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── Brand items ── */
.sd-item--brand span {
  font-size: 0.875rem;
  color: var(--gray-700);
}

/* ── Recent items ── */
.sd-item--recent span {
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* ── Category items ── */
.sd-item--category span {
  font-size: 0.875rem;
  color: var(--gray-700);
}

/* ── Footer "Ver todos" ── */
.sd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--blue-500);
  font-weight: 500;
  transition: background 0.12s ease;
  border-radius: 0 0 12px 12px;
}

.sd-footer:hover,
.sd-footer.is-active {
  background: var(--blue-50);
}

.sd-footer-count {
  background: var(--orange-500);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ── Empty state ── */
.sd-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  color: var(--gray-400);
  font-size: 0.875rem;
}

/* ── Highlight mark ── */
.search-dropdown mark,
#productsGrid mark {
  background: var(--orange-50);
  color: var(--orange-700);
  font-weight: 600;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Mobile: full-width, no min-width ── */
@media (max-width: 768px) {
  .search-dropdown {
    width: auto;
    min-width: 0;
    left: max(-10px, calc(12px - env(safe-area-inset-left, 0px)));
    right: max(-10px, calc(12px - env(safe-area-inset-right, 0px)));
    border-radius: 0 0 12px 12px;
    max-height: 65vh;
  }
}

/* ── Catalog: "Pesquisar em" badge ── */
.search-context-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--blue-100);
  border-radius: 20px;
  padding: 4px 10px 4px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 8px;
}

.search-context-badge button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--blue-400);
  display: flex;
  align-items: center;
  padding: 0;
  margin-left: 2px;
  line-height: 1;
  transition: color 0.15s;
}

.search-context-badge button:hover { color: var(--blue-700); }

/* O fallback Solzaima do catálogo vive em pages/catalogo.css: esta folha só é
   injetada pelo search-autocomplete.js, que não corre na página do catálogo. */
