/* Search - Knuspr style */

.header__search {
  position: relative;
}

.header__search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: var(--c-primary, #1f8b4c);
  border: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s;
  z-index: 2;
}
.header__search-btn:hover { background: var(--c-primary-dark, #156635); }
.header__search-btn svg { color: #fff; }

#searchInput {
  padding-right: 48px !important;
}

/* Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  max-height: 420px;
  overflow-y: auto;
  display: none;
  z-index: 9000;
}
.search-dropdown.open { display: block; }

.search-dropdown__empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: #888;
  font-size: .9rem;
}

.search-dropdown__heading {
  padding: .6rem 1rem .3rem;
  font-size: .7rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.search-dropdown__item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem;
  text-decoration: none;
  color: #1a1d1b;
  transition: background .1s;
  cursor: pointer;
}
.search-dropdown__item:hover,
.search-dropdown__item.active {
  background: #f5f5f3;
}

.search-dropdown__item-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0f0f0;
  flex-shrink: 0;
}
.search-dropdown__item-img--placeholder {
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f0f0f0;
  flex-shrink: 0;
}

.search-dropdown__item-info {
  flex: 1;
  min-width: 0;
}

.search-dropdown__item-name {
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-dropdown__item-name mark {
  background: rgba(242, 92, 84,.15);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.search-dropdown__sponsored {
  display: inline-block;
  margin-left: .35rem;
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 4px;
  padding: .05rem .35rem;
  vertical-align: middle;
}

.search-dropdown__item-supplier {
  font-size: .7rem;
  color: #888;
}

.search-dropdown__item-price {
  font-size: .85rem;
  font-weight: 700;
  color: #1a1d1b;
  flex-shrink: 0;
}

.search-dropdown__viewall {
  display: block;
  text-align: center;
  padding: .75rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  color: #F25C54;
  border-top: 1px solid #eee;
  text-decoration: none;
  transition: background .1s;
}
.search-dropdown__viewall:hover { background: #fff8f0; }

/* Full results view (replaces product rows when searching) */
.search-results {
  padding: 1rem 0;
}

.search-results__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 1rem;
}

.search-results__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1d1b;
}
.search-results__title span { color: #888; font-weight: 400; }

.search-results__clear {
  background: none;
  border: none;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: #F25C54;
  cursor: pointer;
}
.search-results__clear:hover { text-decoration: underline; }

.search-results__grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

@media (min-width: 600px) {
  .search-results__grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

.search-results__none {
  text-align: center;
  padding: 3rem 1rem;
  color: #888;
  font-size: 1rem;
}
.search-results__none strong { color: #1a1d1b; }

/* Homepage Knuspr - botão pesquisa verde */
body.home-knuspr .header__search-btn {
  background: #82AD49;
}
body.home-knuspr .header__search-btn:hover {
  background: #6A9238;
}

/* ── Dark · Knuspr tangerine-dark ── */
html[data-theme="dark"] .search-dropdown {
  background: #252525;
  border-color: #374045;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .55);
}
html[data-theme="dark"] .search-dropdown__empty,
html[data-theme="dark"] .search-dropdown__heading,
html[data-theme="dark"] .search-dropdown__item-supplier {
  color: #b6bdc0;
}
html[data-theme="dark"] .search-dropdown__item {
  color: #f2f4f4;
}
html[data-theme="dark"] .search-dropdown__item:hover,
html[data-theme="dark"] .search-dropdown__item.active {
  background: #1c2529;
}
html[data-theme="dark"] .search-dropdown__item-img,
html[data-theme="dark"] .search-dropdown__item-img--placeholder {
  background: #1c2529;
}
html[data-theme="dark"] .search-dropdown__item-price {
  color: #f2f4f4;
}
html[data-theme="dark"] .search-dropdown__viewall {
  color: #f88424;
  border-top-color: #374045;
}
html[data-theme="dark"] .search-dropdown__viewall:hover {
  background: #522500;
}
html[data-theme="dark"] .search-dropdown__sponsored {
  color: #7cacc3;
  background: #0f2e3e;
}
html[data-theme="dark"] .search-results__title { color: #f2f4f4; }
html[data-theme="dark"] .search-results__title span,
html[data-theme="dark"] .search-results__none { color: #b6bdc0; }
html[data-theme="dark"] .search-results__none strong { color: #f2f4f4; }
html[data-theme="dark"] .search-results__clear { color: #f88424; }
html[data-theme="dark"] body.home-knuspr .header__search-btn {
  background: #9dcb9a;
}
html[data-theme="dark"] body.home-knuspr .header__search-btn:hover {
  background: #2a7337;
}
