/* ==========================================================================
   NANDNEE PRODUCT AUTOCOMPLETE SEARCH
   Injects a combobox above the sticky category rail on products.html
   ========================================================================== */

.psearch {
  position: relative;
  margin-bottom: 0.9rem;
}

/* ---------- Field ---------- */

.psearch-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.1rem 0.55rem 0.1rem 0.85rem;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle, #E2E8F0);
  border-radius: 999px;
  box-shadow: 0 6px 18px -12px rgba(15, 23, 42, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.psearch-field:focus-within {
  border-color: color-mix(in srgb, var(--blue-brand, #0284C7) 55%, #FFFFFF);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue-brand, #0284C7) 12%, transparent);
}

.psearch-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--text-subtle, #64748B);
}

.psearch-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0.62rem 0;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.92rem;
  color: var(--text-main, #0F172A);
}

.psearch-input::placeholder {
  color: var(--text-subtle, #94A3B8);
}

.psearch-input::-webkit-search-cancel-button {
  display: none;
}

.psearch-clear {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-muted, #475569);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.psearch-clear svg {
  width: 13px;
  height: 13px;
}

.psearch-clear:hover {
  background: #DC2626;
  color: #FFFFFF;
}

.psearch-kbd {
  flex: 0 0 auto;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle, #E2E8F0);
  background: #F8FAFC;
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-subtle, #94A3B8);
}

/* ---------- Suggestion panel ---------- */

.psearch-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  z-index: 320;
  max-height: min(60vh, 26rem);
  overflow-y: auto;
  padding: 0.35rem;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle, #E2E8F0);
  border-radius: 18px;
  box-shadow: 0 26px 60px -18px rgba(15, 23, 42, 0.4);
  animation: psearchIn 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.psearch-panel[hidden] {
  display: none;
}

@keyframes psearchIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.psearch-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.6rem;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.psearch-item.is-active {
  background: rgba(2, 132, 199, 0.09);
}

.psearch-item-img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 10px;
  object-fit: cover;
  background: #F8FAFC;
  border: 1px solid var(--border-subtle, #E2E8F0);
}

.psearch-item-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.3;
}

.psearch-item-name {
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main, #0F172A);
  overflow-wrap: anywhere;
}

.psearch-item-name mark {
  background: rgba(245, 197, 66, 0.42);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.psearch-item-meta {
  font-size: 0.7rem;
  color: var(--text-muted, #64748B);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psearch-item-price {
  flex: 0 0 auto;
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue-brand, #0284C7);
  white-space: nowrap;
}

.psearch-more,
.psearch-none {
  padding: 0.7rem 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted, #64748B);
  text-align: center;
}

/* ---------- Result status line ---------- */

.psearch-status {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.78rem;
  color: var(--text-muted, #64748B);
}

.psearch-status[hidden] {
  display: none;
}

.psearch-status strong {
  font-family: var(--font-display, Georgia, serif);
  color: var(--text-main, #0F172A);
}

/* ---------- Flat results layout ---------- */

.shop-main.is-searching .cat-block + .cat-block {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.shop-main.is-searching .shop-head,
.shop-main.is-searching .shop-note {
  display: none;
}

.shop-main.is-searching .shop-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.shop-main.is-searching .cat-block {
  margin-top: 0;
  padding-top: 0;
}

/* Flash the exact card that was picked from the suggestions */
.prod-card.is-flash {
  animation: psearchFlash 1.6s ease;
}

@keyframes psearchFlash {
  0%, 100% { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08); }
  25% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.55), 0 18px 40px -12px rgba(16, 185, 129, 0.6); }
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .psearch {
    margin-bottom: 0.7rem;
  }

  .psearch-kbd {
    display: none;
  }

  .psearch-panel {
    max-height: 54vh;
  }

  .psearch-item-img {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
}