/* ==========================================================================
   Live Search v1 — Matthuset
   AJAX product search dropdown with mobile fullscreen overlay
   ========================================================================== */

/* ===== WRAPPER — position anchor for dropdown ===== */
.site-search {
  position: relative;
}

/* ===== DROPDOWN CONTAINER ===== */
.mh-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 340px;
  background: #fff;
  border: 1px solid #eee;
  border-top: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 100;
  max-height: 420px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== RESULT ITEM ===== */
.mh-search-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  text-decoration: none !important;
  color: #333 !important;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
  transition: background 0.15s;
}

.mh-search-item:last-child {
  border-bottom: none;
}

.mh-search-item:hover,
.mh-search-item.is-active {
  background: #faf7f2;
}

/* Thumbnail */
.mh-search-item__img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #f0f0f0;
}

/* Text stack */
.mh-search-item__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.mh-search-item__title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mh-search-item__title mark {
  background: #fff3cd;
  color: inherit;
  padding: 0;
}

.mh-search-item__cat {
  font-size: 0.7rem;
  color: #888;
}

.mh-search-item__price {
  font-size: 0.78rem;
  font-weight: 600;
  color: #333;
}

.mh-search-item__price del {
  color: #aaa;
  font-weight: 400;
  margin-right: 0.3rem;
}

.mh-search-item__price ins {
  text-decoration: none;
  color: #ef0000;
}

/* ===== "VISA ALLA" LINK ===== */
.mh-search-view-all {
  display: block;
  text-align: center;
  padding: 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #ef0000 !important;
  text-decoration: none !important;
  border-top: 1px solid #eee;
  transition: background 0.15s;
}

.mh-search-view-all:hover {
  background: #faf7f2;
}

/* ===== LOADING STATE ===== */
.mh-search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  gap: 0.5rem;
}

.mh-search-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #eee;
  border-top-color: #ef0000;
  border-radius: 50% !important;
  animation: mh-spin 0.6s linear infinite;
}

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

/* ===== EMPTY STATE ===== */
.mh-search-empty {
  padding: 1.5rem;
  text-align: center;
  color: #888;
  font-size: 0.82rem;
}

/* ===== MOBILE OVERLAY ===== */
@media (max-width: 767px) {
  .mh-search--mobile-open {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    background: #fff !important;
    padding: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    margin: 0 !important;
  }

  .mh-search--mobile-open form {
    flex-shrink: 0;
  }

  .mh-search--mobile-open .search-field {
    font-size: 1rem !important;
    max-width: 100% !important;
    padding-right: 3rem !important;
  }

  /* Close button — injected by JS as first child */
  .mh-search-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    z-index: 1;
    padding: 0;
  }

  .mh-search-close:hover {
    color: #333;
  }

  .mh-search--mobile-open .mh-search-dropdown {
    position: static !important;
    flex: 1;
    max-height: none;
    border: none;
    box-shadow: none;
    min-width: 0;
    margin-top: 0.5rem;
  }
}
