/* PowerGroom Search — desktop and mobile */

#pg-search-desktop {
  position: fixed;
  z-index: 2147483000;
  display: none;
  box-sizing: border-box;
  max-height: min(520px, calc(100vh - 90px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  background: #fff;
  color: #171717;
  border: 1px solid #e9e9e9;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, .16);
}

#pg-search-desktop .pg-search-heading,
#pg-search-mobile .pg-search-heading {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: #171717;
}

#pg-search-desktop .pg-search-products {
  display: flex;
  flex-direction: column;
}

#pg-search-desktop .pg-search-product {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  color: #171717;
  text-decoration: none;
}

#pg-search-desktop .pg-search-product:last-child { border-bottom: 0; }
#pg-search-desktop .pg-search-product:hover { background: #f8f8f8; }

#pg-search-desktop .pg-search-image {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  object-fit: contain;
  border-radius: 7px;
  background: #f7f7f7;
}

#pg-search-desktop .pg-search-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

#pg-search-desktop .pg-search-price {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

#pg-search-desktop .pg-search-message,
#pg-search-mobile .pg-search-message {
  padding: 14px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #777;
}

/* Mobile search: inside Ecwid's existing filter popup */
#pg-search-mobile {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 0 18px;
  color: #171717;
}

#pg-search-mobile [hidden] { display: none !important; }

#pg-search-mobile .pg-search-mobile-controls {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}

#pg-search-mobile .pg-search-filter-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid #dedede;
  border-radius: 8px;
  background: #fff;
  color: #171717;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

#pg-search-mobile .pg-search-filter-button[aria-expanded="true"] {
  background: #f4f4f4;
  border-color: #aaa;
}

#pg-search-mobile .pg-search-mobile-bestsellers { margin-bottom: 22px; }
#pg-search-mobile .pg-search-mobile-categories { margin-top: 6px; }

/* Three-ish cards visible; horizontal swipe for five bestsellers */
#pg-search-mobile .pg-search-products--horizontal {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 2px 1px 12px;
  -webkit-overflow-scrolling: touch;
}

#pg-search-mobile .pg-search-products--horizontal .pg-search-product {
  box-sizing: border-box;
  display: flex;
  flex: 0 0 calc((100% - 20px) / 3);
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 5px;
  border: 1px solid #eee;
  border-radius: 9px;
  background: #fff;
  color: #171717;
  text-decoration: none;
  scroll-snap-align: start;
}

#pg-search-mobile .pg-search-products--horizontal .pg-search-image {
  width: 100%;
  height: 90px;
  object-fit: contain;
  background: #fafafa;
  border-radius: 6px;
}

#pg-search-mobile .pg-search-products--horizontal .pg-search-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  min-height: 34px;
  font-size: 11px;
  line-height: 1.5;
  color: #171717;
}

#pg-search-mobile .pg-search-products--horizontal .pg-search-price {
  margin-top: auto;
  font-size: 12px;
  font-weight: 700;
  color: #171717;
}

/* Live search results: vertical list */
#pg-search-mobile .pg-search-mobile-results .pg-search-products {
  display: flex;
  flex-direction: column;
}

#pg-search-mobile .pg-search-mobile-results .pg-search-product {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  color: #171717;
  text-decoration: none;
}

#pg-search-mobile .pg-search-mobile-results .pg-search-image {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  object-fit: contain;
  background: #fafafa;
  border-radius: 6px;
}

#pg-search-mobile .pg-search-mobile-results .pg-search-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
}

#pg-search-mobile .pg-search-mobile-results .pg-search-price {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* Category tree */
#pg-search-mobile .pg-search-category {
  min-width: 0;
}

#pg-search-mobile .pg-search-category-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border-bottom: 1px solid #eee;
}

#pg-search-mobile .pg-search-category-link {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  color: #171717;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
}

#pg-search-mobile .pg-search-category-toggle {
  appearance: none;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 7px;
  background: #f4f4f4;
  color: #171717;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

#pg-search-mobile .pg-search-category-children {
  padding-left: 15px;
  border-left: 1px solid #ededed;
}

@media (max-width: 370px) {
  #pg-search-mobile .pg-search-products--horizontal .pg-search-product {
    flex-basis: calc((100% - 10px) / 2.5);
  }
  #pg-search-mobile .pg-search-products--horizontal .pg-search-image {
    height: 78px;
  }
}