/* ═══════════════════════════════════════════════════════════════════════
   SEARCH — the quick-search overlay (mission screen #5) + the /search
   results page (mission screen #6). Loaded ONLY where _SearchOverlay.cshtml
   is included (self-contained partial — it carries its own stylesheet link)
   and by Pages/Search.cshtml.

   Composes tokens.css/theme.css/base.css/components.css/layout.css —
   nothing here redeclares a colour, radius, spacing or shadow, and the
   /search results PAGE reuses .catalog/.catalog-layout/.filters/
   .product-grid/.product-card/.pagination/.chips-row/.state-banner/
   .empty-state verbatim from layout.css + components.css (same PLP the
   home grid already renders — Q9: one grid, not a second one).
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Overlay shell — backdrop + a "mega dropdown" panel anchored under the
   header's search bar. The panel's `top` is set by search.js from the
   search bar's live boundingClientRect (utility-bar + header height are
   NOT hardcoded here — they can change in _Layout.cshtml without this file
   going stale, Q46). ─────────────────────────────────────────────────── */

.search-overlay[hidden] { display: none; }

.search-overlay__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 23, 28, .45);
    z-index: var(--z-overlay);
}

.search-overlay__panel {
    position: fixed;
    inset-inline: 0;
    margin-inline: auto;
    width: min(720px, 94vw);
    max-height: min(560px, 78vh);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--card-radius, var(--radius-md));
    box-shadow: var(--shadow-pop);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-overlay__close {
    position: absolute;
    top: var(--space-2);
    inset-inline-end: var(--space-2);
    z-index: 1;
}

.search-overlay__body {
    padding: var(--space-6) var(--space-6) var(--space-5);
    overflow-y: auto;
}

/* ── Sections inside the panel ───────────────────────────────────────── */

.search-suggest__section + .search-suggest__section { margin-top: var(--space-6); }
.search-suggest__heading {
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    color: var(--ink-soft);
    margin: 0 0 var(--space-3);
}

.search-suggest__chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.search-suggest__brands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.search-suggest__brand-link,
.search-suggest__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: .55rem .7rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--ink);
    font-size: var(--text-base);
}
.search-suggest__brand-link:hover,
.search-suggest__brand-link.is-active,
.search-suggest__item:hover,
.search-suggest__item.is-active { background: var(--paper-muted); color: var(--brand-deep); }
.search-suggest__count { color: var(--ink-faint); font-size: var(--text-sm); }

.search-suggest__products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-3);
}

.search-suggest__product {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    text-decoration: none;
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: .4rem;
    transition: background var(--duration-fast) var(--ease-standard);
}
.search-suggest__product:hover,
.search-suggest__product.is-active { background: var(--paper-muted); }
.search-suggest__product-media {
    aspect-ratio: var(--ratio-square);
    background: var(--tray);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.search-suggest__product-media img { width: 100%; height: 100%; object-fit: contain; padding: .5rem; }
.search-suggest__product-name {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: var(--leading-snug);
}
.search-suggest__product-price { font-size: var(--text-sm); color: var(--ink-soft); }

.search-suggest__footer {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
    text-align: center;
}
.search-suggest__footer a {
    color: var(--brand);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}
.search-suggest__footer a:hover { text-decoration: underline; }

.search-suggest__empty,
.search-suggest__error { color: var(--ink-soft); text-align: center; padding-block: var(--space-6); }
.search-suggest__error { color: var(--danger-base); }

.search-suggest__loading { display: flex; flex-direction: column; gap: var(--space-2); }
.search-suggest__loading .skeleton { height: 40px; }

/* ── /search results page — everything else is the shared PLP vocabulary;
   only the "results for …" header is page-specific. ────────────────── */

.search-results-head { padding-block: var(--space-2) 0; }
.search-results-head__title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--ink);
    margin: 0 0 var(--space-2);
}
.search-results-head__term { color: var(--brand-deep); }
.search-results-head__count { color: var(--ink-soft); font-weight: var(--weight-regular); font-size: var(--text-lg); }

.search-prompt { padding-block: var(--space-10) var(--space-16); }
