/* The search owns its overlays; the theme remains responsible for the surrounding header. */
.app-search-host { position: relative; flex: 1 1 auto; min-width: 0; }
.app-search-host .app-search { max-width: none; }
.app-search-settings { flex: 0 0 2.75rem; color: var(--app-color-text-muted); background: var(--app-color-surface-alternate); border: 0; border-right: 1px solid var(--app-color-border); cursor: pointer; }
.app-search-settings:hover { color: var(--app-color-text); background: var(--app-color-border); }
.app-search-scopes, .app-search-mega { position: absolute; top: calc(100% + .65rem); left: 0; z-index: 35; background: var(--app-color-surface); color: var(--app-color-text); border: 1px solid var(--app-color-border); border-radius: var(--app-radius); box-shadow: 0 18px 45px color-mix(in srgb, var(--app-color-text) 15%, transparent); }
.app-search-scopes[hidden], .app-search-mega[hidden] { display: none; }
.app-search-scopes { min-width: 16rem; max-width: 100%; padding: .8rem; }
.app-search-scopes p { margin: 0 0 .5rem; font-size: .75rem; color: var(--app-color-text-muted); padding: .35rem; }
.app-search-scopes button { display: block; width: 100%; border: 0; border-radius: var(--app-radius); min-height: var(--app-control-height); padding: .65rem; background: transparent; color: var(--app-color-text-muted); text-align: left; cursor: pointer; }
.app-search-scopes button:hover { background: var(--app-color-surface-alternate); }
.app-search-scopes button[aria-pressed=true] { background: var(--app-color-selection); color: var(--app-color-selection-text); font-weight: 700; }
/* The mega menu follows the fluid search host, not the generic popover width. */
.app-search-mega { right: 0; max-width: none; max-height: min(65vh, 38rem); overflow: auto; overscroll-behavior: contain; padding: 1.25rem; }
.app-search-widget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1.5rem; }
.app-search-widget h2 { margin: 0 0 .8rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .055em; color: var(--app-color-text-muted); }
.app-search-completions { list-style: none; padding: 0; margin: 0; }
.app-search-completions a { display: flex; gap: .75rem; align-items: center; padding: .7rem; border-radius: var(--app-radius); font-size: .9rem; text-decoration: none; }
.app-search-completions a:hover, .app-search-completions a:focus { background: var(--app-color-surface-alternate); color: var(--app-color-link); }
.app-search-completions .fa { color: var(--app-color-text-muted); }
.app-search-hint { margin: .5rem; color: var(--app-color-text-muted); font-size: .9rem; }
.app-search-mega [aria-busy=true] { opacity: .55; min-height: 3rem; }
.app-search-items { display: grid; gap: .35rem; }
.app-search-item { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); align-items: center; gap: .75rem; border-radius: var(--app-radius); padding: .55rem; color: var(--app-color-text); text-decoration: none; }
.app-search-item:hover { background: var(--app-color-surface-alternate); }
.app-search-item .shop-item-image { display: flex; align-items: center; justify-content: center; height: 3.5rem; background: var(--app-color-surface); border-radius: var(--app-radius); overflow: hidden; }
.app-search-item img { width: 100%; height: 100%; object-fit: contain; }
.app-search-item .shop-image-placeholder { color: var(--app-color-text-muted); font-size: 1.5rem; }
.app-search-item strong { display: block; font-size: .85rem; font-weight: 600; overflow-wrap: anywhere; }
.app-search-item small { display: block; color: var(--app-color-text-muted); margin-top: .2rem; }
.app-search-item .app-search-item-price { color: var(--app-color-link); font-weight: 600; }
@media (max-width: 640px) {
    .app-search-mega { padding: .8rem; max-height: 60vh; }
    .app-search-widget-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
}

.app-search-widget:only-child .app-search-items { grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }

.app-search .app-search-settings { flex: 0 1 auto; display: inline-flex; align-items: center; gap: .6rem; width: auto; max-width: 18rem; padding: .65rem .85rem; }
.app-search-settings strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .app-search .app-search-settings { max-width: 35%; } }

/* Provider-neutral compact entity cards; loaded with the shared search menu. */
.app-search-directory-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,18rem),1fr));gap:.7rem}
.app-search-directory-card{display:flex;align-items:center;gap:.85rem;padding:1rem;border:1px solid var(--app-color-border);border-radius: var(--app-radius);background:var(--app-color-surface);color:var(--app-color-text);text-decoration:none;transition:background var(--app-motion-duration),border-color var(--app-motion-duration)}
.app-search-directory-card:hover,.app-search-directory-card:focus-visible{background:var(--app-color-surface-alternate);border-color:var(--app-color-text-muted)}
.app-search-directory-card img,.app-search-directory-monogram{width:3rem;height:3rem;object-fit:contain;flex:none;border-radius: var(--app-radius)}
.app-search-directory-monogram{display:grid;place-items:center;background:var(--app-color-surface-alternate);color:var(--app-color-text-muted);font-size:1.35rem;font-weight:700}
.app-search-directory-card>span:not(.app-search-directory-monogram){display:grid;gap:.2rem;min-width:0;flex:1}.app-search-directory-card strong{overflow-wrap:anywhere}.app-search-directory-card small{color:var(--app-color-text-muted)}.app-search-directory-card>i{color:var(--app-color-text-muted)}
