/* Tekno Muaz — modern predictive search (overrides theme predictive-search.css) */

.header-search-wrap {
  position: relative;
  z-index: 40;
}

/* Closed by default. Never cover the page when search is idle. */
predictive-search .js-search-overlay,
predictive-search .overlay.js-search-overlay {
  display: none !important;
  pointer-events: none !important;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: transparent;
}

predictive-search[open] .js-search-overlay,
predictive-search[open] .overlay.js-search-overlay {
  display: block !important;
  pointer-events: auto !important;
  background: rgba(0, 0, 0, 0.35);
  z-index: 35;
}

.header-search {
  position: relative;
}

.header-search .search__input {
  padding-inline-end: 2.4rem;
}

.header-search .search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.header-search .search__reset {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 1.85rem;
  height: 1.85rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #ececec;
  color: #555;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.header-search .search__reset[hidden] {
  display: none !important;
}

.header-search .search__reset::before {
  content: "×";
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  color: #555;
}

.header-search .search__reset:hover {
  background: #e0e0e0;
  color: #111;
}

/* Dropdown panel */
.header-search-wrap .js-search-results.predictive-search,
.header-search-wrap .predictive-search,
.js-search-results.predictive-search,
.predictive-search {
  position: absolute;
  top: calc(100% + 8px) !important;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 0;
  border: 1px solid #ececec;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.14);
  z-index: 80;
  -webkit-overflow-scrolling: touch;
}

predictive-search[open] .js-search-results.predictive-search,
predictive-search[open] .predictive-search,
.header-search-wrap[data-open] .js-search-results.predictive-search {
  display: block;
}

.predictive-search__scroller {
  max-height: inherit;
}

.predictive-search .tablist {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.predictive-search .tablist__scroller {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0.65rem 0.85rem 0;
}

.predictive-search .tablist__tab {
  border: 0;
  background: transparent;
  padding: 0.45rem 0.15rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  color: #9ca3af;
  letter-spacing: 0.01em;
  cursor: default;
  border-bottom: 2px solid transparent;
}

.predictive-search .tablist__tab[aria-selected="true"] {
  color: #111;
  border-bottom-color: #ff580d;
}

.predictive-search__list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.predictive-search__item {
  margin: 0;
}

.predictive-search__item:not(.js-submit):hover,
.predictive-search__item[aria-selected="true"] {
  background: #fff7f0;
}

.predictive-result {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.9rem;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.predictive-result__media {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 12px;
  background: #f6f6f6;
  border: 1px solid #efefef;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.predictive-result__media img,
img.predictive-result__media {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  display: block;
  padding: 4px;
  box-sizing: border-box;
}

.predictive-result__info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.predictive-result__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  color: #111;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.predictive-result__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.predictive-result__vendor {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: capitalize;
}

.predictive-result__stock {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  line-height: 1.2;
}

.predictive-result__stock--in {
  background: #ecfdf3;
  color: #15803d;
}

.predictive-result__stock--out {
  background: #fef2f2;
  color: #b91c1c;
}

.predictive-result__price {
  margin-top: 0.15rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ff580d;
  letter-spacing: -0.01em;
}

.predictive-search__view-all {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: calc(100% - 1.6rem);
  margin: 0.35rem 0.8rem 0.85rem;
  padding: 0.75rem 1rem !important;
  border-radius: 10px;
  background: #111;
  color: #fff !important;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none !important;
  line-height: 1.2;
}

.predictive-search__view-all:hover {
  background: #ff580d;
}

.predictive-search__view-all::after {
  content: "›";
  font-size: 1.1rem;
  line-height: 1;
}

.predictive-search__no-results {
  padding: 1.25rem 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 600;
}

.predictive-search__no-results strong {
  display: block;
  color: #111;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

@media (max-width: 860px) {
  .header-search-wrap .js-search-results.predictive-search,
  .header-search-wrap .predictive-search,
  .js-search-results.predictive-search,
  .predictive-search {
    top: calc(100% + 6px) !important;
    max-height: min(55vh, 420px);
    border-radius: 12px;
  }

  .predictive-result {
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
  }

  .predictive-result__media {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }

  .predictive-result__title {
    font-size: 0.86rem;
  }

  .predictive-result__price {
    font-size: 0.9rem;
  }
}
