/* Header product search (desktop) + search block inside the mobile drawer. */

.hdr-search { position: relative; display: none; }
@media (min-width: 768px) {
  /* Sits between the logo and the header actions: the auto side margins push
     it away from the far-left edge so the desktop bar looks balanced. */
  .hdr-search {
    display: block;
    flex: 0 1 26rem;
    max-width: 26rem;
    margin-left: auto;
    margin-right: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .hdr-search { flex-basis: 32rem; max-width: 32rem; margin-right: 2.5rem; }
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  /* Theme primary colour (Admin > Settings) drives the outline. */
  border: 1px solid var(--brand, #e2506a);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.search-field:focus-within {
  border-color: var(--brand, #e2506a);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand, #e2506a) 18%, transparent);
}

.search-field .search-icon { color: #94a3b8; flex: none; }
.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 0.9rem;
  color: #0f172a;
}
.search-spinner { flex: none; color: #94a3b8; animation: search-spin 0.8s linear infinite; }
.search-spinner[hidden] { display: none; }
@keyframes search-spin { to { transform: rotate(360deg); } }

.search-results {
  margin-top: 0.4rem;
  overflow: hidden auto;
  max-height: min(70vh, 26rem);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}
.search-results[hidden] { display: none; }
.hdr-search .search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover,
.search-result:focus-visible { background: rgba(15, 23, 42, 0.04); }
.search-result img,
.search-result .search-thumb-empty {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.6rem;
  object-fit: cover;
  background: #f1f5f9;
}
.search-result-body { min-width: 0; flex: 1 1 auto; }
.search-result-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-price {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand, #e2506a);
}
.search-result-old { font-weight: 500; color: #94a3b8; text-decoration: line-through; }

.search-empty {
  padding: 0.9rem 0.85rem;
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
}

/* Mobile drawer search */
.mobile-menu-search { padding: 0.6rem 0.6rem 0; }
.mobile-search-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 0.7rem;
  border-radius: 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}
.mobile-search-trigger:hover { background: rgba(15, 23, 42, 0.05); }
.mobile-menu-search .search-panel[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Mobile top search sheet (opened from the bottom navigation "Search" item)
   -------------------------------------------------------------------------- */
.top-search {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 120;
  display: none;
  padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-top, 0px));
  padding-top: calc(0.6rem + env(safe-area-inset-top, 0px));
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 28px -18px rgba(15, 23, 42, 0.45);
}
.top-search.is-open { display: block; }

.top-search-bar { display: flex; align-items: center; gap: 0.5rem; }
.top-search-bar .search-field { flex: 1 1 auto; padding: 0.6rem 0.8rem; border-radius: 0.9rem; }
.top-search-bar .search-field input { font-size: 1rem; }

.top-search-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.05);
  color: #334155;
  -webkit-tap-highlight-color: transparent;
}
.top-search-close:active { background: rgba(15, 23, 42, 0.1); }

.top-search .search-results { max-height: calc(100vh - 8rem); }

@media (min-width: 768px) {
  .top-search.is-open { display: none; }
}
