/*
 * Live product search. WooCommerce's native search form remains the fallback;
 * this panel is a progressive enhancement attached directly below it.
 */
.kitgenix-commerce-live-search {
  position: relative !important;
  overflow: visible !important;
}

.kitgenix-commerce-live-search__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  z-index: 1005;
  max-height: min(560px, 72vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--kitgenix-commerce-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(7, 27, 58, 0.18);
  color: var(--kitgenix-commerce-midnight);
  overscroll-behavior: contain;
}

.kitgenix-commerce-live-search__panel[hidden] {
  display: none !important;
}

.kitgenix-commerce-live-search__section-title {
  padding: 8px 10px 6px;
  color: var(--kitgenix-commerce-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.kitgenix-commerce-live-search__product,
.kitgenix-commerce-live-search__category,
.kitgenix-commerce-live-search__all {
  text-decoration: none !important;
}

.kitgenix-commerce-live-search__product {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--kitgenix-commerce-midnight) !important;
  transition: background 0.16s ease, color 0.16s ease;
}

.kitgenix-commerce-live-search__product:hover,
.kitgenix-commerce-live-search__product:focus-visible,
.kitgenix-commerce-live-search__product.is-active,
.kitgenix-commerce-live-search__category:hover,
.kitgenix-commerce-live-search__category:focus-visible,
.kitgenix-commerce-live-search__category.is-active {
  outline: none;
  background: var(--kitgenix-commerce-off-white);
}

.kitgenix-commerce-live-search__image {
  width: 52px;
  height: 52px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--kitgenix-commerce-border);
  border-radius: 10px;
  background: #fff;
}

.kitgenix-commerce-live-search__image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.kitgenix-commerce-live-search__copy,
.kitgenix-commerce-live-search__category-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.kitgenix-commerce-live-search__name {
  overflow: hidden;
  color: var(--kitgenix-commerce-midnight);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kitgenix-commerce-live-search__meta {
  overflow: hidden;
  color: var(--kitgenix-commerce-muted);
  font-size: 0.71rem;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kitgenix-commerce-live-search__price {
  padding-left: 8px;
  color: var(--kitgenix-commerce-midnight);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.kitgenix-commerce-live-search__price del {
  display: block;
  color: var(--kitgenix-commerce-muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.kitgenix-commerce-live-search__price ins {
  color: var(--kitgenix-commerce-primary);
  text-decoration: none;
}

.kitgenix-commerce-live-search__category {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--kitgenix-commerce-midnight) !important;
}

.kitgenix-commerce-live-search__category-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(33, 75, 255, 0.08);
  color: var(--kitgenix-commerce-primary);
  font-size: 0.82rem;
  font-weight: 900;
}

.kitgenix-commerce-live-search__all {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--kitgenix-commerce-border);
  color: var(--kitgenix-commerce-primary) !important;
  font-size: 0.78rem;
  font-weight: 800;
}

.kitgenix-commerce-live-search__all:hover,
.kitgenix-commerce-live-search__all:focus-visible,
.kitgenix-commerce-live-search__all.is-active {
  outline: none;
  color: var(--kitgenix-commerce-midnight) !important;
}

.kitgenix-commerce-live-search__arrow {
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.16s ease;
}

.kitgenix-commerce-live-search__all:hover .kitgenix-commerce-live-search__arrow,
.kitgenix-commerce-live-search__all.is-active .kitgenix-commerce-live-search__arrow {
  transform: translateX(3px);
}

.kitgenix-commerce-live-search__state,
.kitgenix-commerce-live-search__empty {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  padding: 13px 14px;
  color: var(--kitgenix-commerce-muted);
  font-size: 0.78rem;
}

.kitgenix-commerce-live-search__state.is-loading {
  position: relative;
  padding-left: 43px;
}

.kitgenix-commerce-live-search__state.is-loading::before {
  content: "";
  position: absolute;
  left: 15px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(33, 75, 255, 0.2);
  border-top-color: var(--kitgenix-commerce-primary);
  border-radius: 50%;
  animation: kitgenix-commerce-live-search-spin 0.7s linear infinite;
}

.kitgenix-commerce-live-search__state.is-error {
  color: #b42318;
}

.kitgenix-commerce-live-search__empty strong {
  color: var(--kitgenix-commerce-midnight);
  font-size: 0.82rem;
}

.kitgenix-commerce-search__dialog .kitgenix-commerce-live-search__panel {
  top: calc(100% + 12px);
  z-index: 3;
}

@keyframes kitgenix-commerce-live-search-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 620px) {
  .kitgenix-commerce-live-search__panel {
    max-height: min(500px, 62vh);
    padding: 6px;
    border-radius: 13px;
  }
  .kitgenix-commerce-live-search__product {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 10px;
    min-height: 62px;
    padding: 8px;
  }
  .kitgenix-commerce-live-search__image {
    width: 46px;
    height: 46px;
  }
  .kitgenix-commerce-live-search__price {
    grid-column: 2;
    padding: 0;
    text-align: left;
  }
  .kitgenix-commerce-live-search__price del {
    display: inline;
    margin-right: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kitgenix-commerce-live-search__arrow,
  .kitgenix-commerce-live-search__product,
  .kitgenix-commerce-live-search__category {
    transition: none;
  }
}
