/* Ensure the dropdown positions under the input */
.block.block-search .field.search .control { position: relative; }

#search:focus {
  z-index: 10000;
}

/* Base container (always in DOM, hidden by default) */
.nms-quicksearch {
  position: absolute;
  z-index: 3;
  width: 250px;
  background: #fff;
  margin-left: 0;
  min-height: 0;
  height: 0;
  transition: 
    width .3s ease,
    margin-left .3s ease,
    height .3s ease,
    min-height .3s ease;
  overflow: hidden;
}

/* ✅ Visible only when focused AND input has text */
.block.block-search .field.search.has-query:focus-within .nms-quicksearch {
  min-height: 64px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  border: 1px solid #ddd;
  height: var(--nms-h, 0);
}

/* Content styling */
.nms-quicksearch ul { list-style: none; margin: 0; padding: 4px; }
.nms-quicksearch li { padding: 6px; }
.nms-quicksearch li.is-active, .nms-quicksearch li:hover { background: #f6f6f6; }
.nms-quicksearch .nms-item { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.nms-quicksearch .nms-thumb { width: 64px; height: 64px; object-fit: contain; border: 1px solid #eee; background: #fff; }
.nms-quicksearch .nms-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nms-quicksearch .nms-name { font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nms-quicksearch .nms-price { font-weight: 600; font-size: 13px; }
.nms-quicksearch .nms-stars { position: relative; font-size: 12px; line-height: 1; color: #ccc; }
.nms-quicksearch .nms-stars::before { content: '★★★★★'; opacity: .35; }
.nms-quicksearch .nms-stars .nms-stars-fill { position: absolute; top: 0; left: 0; overflow: hidden; white-space: nowrap; }
.nms-quicksearch .nms-stars .nms-stars-fill::before { content: '★★★★★'; color: #f5a623; }
.nms-quicksearch .nms-view-all { padding: 8px; text-align: center; border-top: 1px solid #eee; }
.nms-quicksearch .nms-view-all a { font-weight: 600; }
.nms-quicksearch .nms-empty { padding: 10px; color: #777; }
.block-search .field.search .label[for="search"] { pointer-events: none; }

/* Loading overlay (animated gif while query in-flight) */
.nms-quicksearch.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    rgba(255,255,255,1)
    url("../images/quicksearch-spinner.gif") /* put spinner here */
    center 16px / 32px 32px
    no-repeat;
  pointer-events: none;
}

@media (min-width: 768px) {

  #search:focus ~ .nms-quicksearch {
    width: 35vw !important;
    margin-left: calc(-35vw + 250px) !important;
  }
}

@media (min-width: 1295px) {

  #search:focus ~ .nms-quicksearch {
    width: 750px !important;
    margin-left: calc(-750px + 250px) !important;
  }
}

@media (min-width: 1000px) and (max-width: 1294px) {

  #search:focus ~ .nms-quicksearch {
    width: 50vw !important;
    margin-left: calc(-50vw + 250px) !important;
  }
}
