/* =====================================================================
   Search bar extras (assets/js/search-tools.js): suggestion dropdown,
   microphone (voice search) and the ✨ AI mark on the Search button.
   ===================================================================== */

.st-field { position: relative; display: flex; align-items: center; flex: 1 1 220px; min-width: 0; }
.st-field > .st-input { width: 100%; min-width: 0; }
.st-field.has-mic > .st-input { padding-right: 2.6rem; }
/* The browser's own clear (×) button would sit under the microphone */
.st-field.has-mic > .st-input::-webkit-search-cancel-button { display: none; }
.lf-search-q .st-field { flex: 1 1 auto; }
.lf-search-q > svg { z-index: 1; } /* keep Lost & Found's magnifier above the wrapped box */
.portal-search-row .st-field { flex: 1 1 auto; }

/* Microphone inside the box */
.st-mic {
    position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
    width: 2rem; height: 2rem; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer;
}
.st-mic svg { width: 18px; height: 18px; }
.st-mic:hover, .st-mic:focus-visible { background: var(--brand-soft); color: var(--brand); outline: none; }
.st-mic.on { background: var(--danger); color: #fff; animation: st-pulse 1.2s ease-in-out infinite; }
@keyframes st-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); } 50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); } }

/* Suggestions dropdown */
.st-drop {
    position: fixed; left: 0; top: 0; z-index: 60; /* placed under the box by search-tools.js */
    max-height: 380px; overflow-y: auto; padding: .35rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
    text-align: left;
}
.st-drop[hidden] { display: none; }
.st-opt { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 8px; cursor: pointer; color: var(--ink); }
.st-opt:hover, .st-opt.active { background: var(--brand-soft); }
.st-ico { flex: none; width: 1.6rem; text-align: center; font-size: 1.05rem; }
.st-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.st-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.st-label mark { background: transparent; color: var(--brand); font-weight: 700; }
.st-txt small { color: var(--ink-soft); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* AI search lives in the Search button: "✨ Search" while an AI search
   is left, plain "Search" after. Same button, same size, one line. */
.st-ai-btn { gap: .35rem; }
.st-spark { display: inline-block; font-size: .95em; line-height: 1; }
.st-busy { cursor: progress; }
.st-spin {
    display: inline-block; width: .9em; height: .9em; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent; animation: st-spin .7s linear infinite; vertical-align: -.1em;
}
@keyframes st-spin { to { transform: rotate(360deg); } }

/* The box and its Search button always share one line, on every page
   and screen size: the box shrinks, the button never wraps below it. */
.svc-search, .portal-search-row, .lf-search-bar { flex-wrap: nowrap; }
.svc-search .st-field, .portal-search-row .st-field { flex: 1 1 0; min-width: 0; }
/* html[lang] keeps this above app.css's "Sinhala/Tamil buttons may wrap" */
html .svc-search > .btn, html .portal-search-row > .btn, html .lf-search-bar > .btn { flex: none; white-space: nowrap; }
@media (max-width: 640px) {
    .svc-search .st-field { flex: 1 1 0; }
    html .svc-search > .btn, html .portal-search-row > .btn, html .lf-search-bar > .btn { padding-inline: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
    .st-mic.on, .st-spin { animation: none; }
}
