/* Search box shared by the bus pages (see bus-search.js): bus services, stops and places in one list. */
.top-search-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1200;
    width: min(92vw, 420px);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.top-search-input-wrapper {
    position: relative;
    width: 100%;
}

.top-search-input {
    width: 100%;
    border: 1px solid var(--nv-line);
    border-radius: var(--nv-r);
    padding: 10px 14px 10px 38px;
    font-size: 0.95em;
    box-shadow: none;
    backdrop-filter: none;
    background: var(--nv-surface);
    color: var(--nv-ink);
    outline: none;
}

.top-search-input:focus {
    border-color: var(--nv-line);
    box-shadow: none;
}

.top-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--nv-ink);
    font-size: 0.9em;
    pointer-events: none;
}

.top-search-results {
    display: none;
    background: var(--nv-surface);
    border-radius: var(--nv-r);
    box-shadow: none;
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--nv-line);
}

.top-search-results.visible {
    display: block;
}

.top-search-result {
    width: 100%;
    display: block;
    padding: 10px 14px;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--nv-line);
    cursor: pointer;
    color: var(--nv-ink);
}

.top-search-result:hover,
.top-search-result:focus {
    background: var(--nv-surface);
    outline: none;
}

.top-search-result strong {
    display: block;
    font-size: 0.95em;
    margin-bottom: 2px;
}

.top-search-result span {
    font-size: 0.8em;
    color: var(--nv-ink);
}

.top-search-result:last-child {
    border-bottom: none;
}

.top-search-empty,
.top-search-error {
    padding: 12px 16px;
    font-size: 0.85em;
    color: var(--nv-ink);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Unified search: services, stops and places share one list, each in its own style. */
.top-search-results { max-height: min(60vh, 420px); }
.ts-heading { display: flex; align-items: center; gap: 6px; padding: 8px 14px 4px; font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--nv-muted); background: var(--nv-surface); }
.ts-heading .bus-ph { width: 14px; height: 14px; }
.top-search-result.ts-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 14px; text-decoration: none; box-sizing: border-box; }
.ts-row .ts-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ts-row .ts-text strong { margin: 0; font-size: .9375rem; overflow-wrap: anywhere; }
.ts-row .ts-text small { font-size: .75rem; color: var(--nv-muted); overflow-wrap: anywhere; }
.ts-chip { flex: none; display: grid; place-items: center; min-width: 52px; min-height: 30px; padding: 0 8px; box-sizing: border-box; border-radius: var(--nv-r); font-size: .875rem; font-weight: 800; }
.ts-service .ts-chip { background: var(--nv-accent); color: var(--nv-accent-ink, var(--nv-ink)); }
.ts-stop .ts-chip { background: var(--nv-raised); color: var(--nv-ink); border: 2px solid var(--nv-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.ts-place .ts-chip { min-width: 30px; width: 30px; padding: 0; background: var(--nv-surface); color: var(--nv-ink); border: 1px solid var(--nv-line); border-radius: 50%; }
.ts-place .ts-chip .bus-ph { width: 16px; height: 16px; }
.ts-place .ts-text strong { font-weight: 600; }

/* Theme overrides */
.top-search-container { top: calc(var(--nv-bar-h) + 12px); z-index: 1200; }
@media (max-width: 600px) { .top-search-container { width: calc(100vw - 124px); top: calc(var(--nv-bar-h) + 12px); left: 60px; transform: none; } }
.top-search-input { background: var(--nv-raised); color: var(--nv-ink); border: 1px solid var(--nv-line); min-height: 44px; }
.top-search-input:focus { border-color: var(--nv-accent); outline: 2px solid var(--nv-accent); outline-offset: 0; }
.top-search-results { background: var(--nv-raised); border: 1px solid var(--nv-line); }
.top-search-result { color: var(--nv-ink); }
.top-search-result span, .top-search-empty, .top-search-error { color: var(--nv-muted); }
.top-search-result:hover, .top-search-result:focus { background: var(--nv-surface); padding-left: 16px; color: var(--nv-ink); }
