/* ============================================================
   HeaderSearch component
   Overlay + result dropdown for the header search.
   The input/button keep their existing header.css styling.
   ============================================================ */

/* Author display rules would otherwise beat the UA [hidden] rule */
.hsearch-overlay[hidden],
.hsearch-panel[hidden],
.hsearch-status[hidden],
.hsearch-results[hidden] {
  display: none !important;
}

/* Dark full-page overlay.
   Rendered inside the sticky <header> (z-index: 2000 stacking context):
   z-index -1 paints it above the header background but BELOW the header
   content (top bar / main row / nav keep their white backgrounds), while
   the whole context sits above the page - so the page darkens and the
   header stays fully visible. */
.hsearch-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: -1;
}

/* Result dropdown (fixed + JS positioned so it escapes .sk-search's
   overflow: hidden and always aligns with the input) */
.hsearch-panel {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  max-height: min(72vh, 470px);
  background: #fff;
  border: 1px solid #ececef;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

/* Loading / empty / error states (stable min-height - no layout jump) */
.hsearch-status {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 18px;
  text-align: center;
  font-family: var(--secondary-font);
  font-size: 14px;
  color: #6b7280;
}

.hsearch-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(236, 26, 35, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: hsearch-spin 0.7s linear infinite;
}

@keyframes hsearch-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Results block */
.hsearch-results {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hsearch-head {
  padding: 12px 16px;
  font-family: var(--secondary-font);
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 1px solid #f0f1f3;
}

.hsearch-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 0;
}

.hsearch-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  text-decoration: none;
  color: inherit;
}

.hsearch-item:hover,
.hsearch-item.is-active {
  background: #fdeced;
}

.hsearch-item-img {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  background: #f3f4f6;
}

.hsearch-item-name {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--secondary-font);
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hsearch-item-price {
  flex: 0 0 auto;
  font-family: var(--secondary-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  white-space: nowrap;
}

.hsearch-item-old {
  color: #9ca3af;
  font-weight: 400;
  font-size: 12.5px;
  margin-left: 4px;
}

.hsearch-foot {
  display: block;
  padding: 12px 16px;
  text-align: center;
  font-family: var(--secondary-font);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  border-top: 1px solid #f0f1f3;
  transition: background-color 0.15s ease;
}

.hsearch-foot:hover {
  background: #fdeced;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 991.98px) {
  .hsearch-panel {
    max-height: 60vh;
  }
}

@media (max-width: 767.98px) {
  .hsearch-panel {
    max-height: 55vh;
    border-radius: 10px;
  }

  .hsearch-status {
    min-height: 96px;
    font-size: 13.5px;
  }

  .hsearch-head {
    padding: 10px 14px;
    font-size: 12.5px;
  }

  .hsearch-item {
    gap: 10px;
    padding: 8px 14px;
  }

  .hsearch-item-img {
    width: 40px;
    height: 40px;
  }

  .hsearch-item-name {
    font-size: 13.5px;
  }

  .hsearch-item-price {
    font-size: 13px;
  }

  .hsearch-foot {
    padding: 11px 14px;
    font-size: 13px;
  }
}
