/* Search bar — single text input with a dropdown underneath. The
   dropdown is absolutely-positioned so the tree below doesn't shift
   as results appear/disappear. */
.search-bar {
    position: relative;
    margin-top: 12px;
    max-width: 560px;
}
.search-bar-label {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    text-transform: uppercase;
}
#search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--panel);
    color: var(--fg);
}
#search-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}
.search-results {
    position: absolute;
    z-index: 50;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    font-size: 13px;
}
.search-results[hidden] { display: none; }
.search-result {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover,
.search-result.is-active { background: var(--accent-soft); }
.search-result .sr-primary {
    font-weight: 600;
    color: var(--fg);
}
.search-result .sr-secondary {
    color: var(--muted);
    font-size: 12px;
    margin-top: 1px;
}
.search-result-empty,
.search-result-error {
    padding: 8px 12px;
    color: var(--muted);
    font-style: italic;
}

/* Global filter bar. Sits just below the AS / prefix search and
   scans every route in the loaded topology for matches against
   prefix string, prefix-holder, or AS-in-path. The "Open graph"
   button is gated on the matched set having no more than ``max
   peers`` direct Internet2 neighbours — past that the diagram
   becomes unreadable. */
.global-filter {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    max-width: 980px;
}
.global-filter-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
#global-filter-input {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--fg);
    flex: 1 1 26rem;
    font: inherit;
    font-size: 13px;
    min-width: 14rem;
    padding: 6px 10px;
}
#global-filter-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}
.global-filter.is-invalid #global-filter-input {
    border-color: #dc2626;
}
.global-filter-status {
    color: var(--muted);
    font-size: 12px;
    min-width: 12rem;
}
.global-filter-status.is-error { color: #b91c1c; }
.global-filter-status.is-ready { color: var(--accent); font-weight: 600; }
.global-filter-status.is-blocked {
    color: #b45309;
    font-weight: 600;
}
.global-filter-threshold-label {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    font-size: 12px;
    gap: 4px;
}
#global-filter-threshold {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--fg);
    font: inherit;
    font-size: 12px;
    padding: 3px 4px;
    width: 4em;
}
.global-filter-open {
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    transition: opacity 0.12s, background 0.12s;
}
.global-filter-open:hover:not(:disabled) {
    background: var(--accent);
    opacity: 0.85;
}
.global-filter-open:disabled {
    background: var(--panel);
    border-color: var(--line);
    color: var(--muted);
    cursor: not-allowed;
}
.global-filter-open:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* Secondary action — always available when there are matches, even
   if the graph button is gated by the peer cap. Outline-style so
   the primary "Open graph" button stays the dominant call to
   action. */
.global-filter-show {
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    transition: background 0.12s, color 0.12s;
}
.global-filter-show:hover:not(:disabled) {
    background: var(--accent-soft);
}
.global-filter-show:disabled {
    border-color: var(--line);
    color: var(--muted);
    cursor: not-allowed;
}
.global-filter-show:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

main {
    padding: 16px 28px 60px;
}

#tree {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 0;
}

ul.tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

ul.tree ul.tree {
    margin-left: 22px;
    border-left: 1px dotted var(--line);
}

li.node { padding: 0; margin: 0; }

.row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px 3px 4px;
    border-radius: 4px;
    user-select: none;
}

/* Brief highlight pulse applied to a row by the search-result
   navigation so the user can spot where they just landed. The
   animation fades from a strong accent tint back to transparent
   over 2s; the JS adds the class after scrolling the row into
   view and removes it once the animation finishes. */
@keyframes row-flash-pulse {
    0%   { background: rgba(217, 119, 6, 0.55); }
    20%  { background: rgba(217, 119, 6, 0.45); }
    100% { background: transparent; }
}
.row.row-flash {
    animation: row-flash-pulse 2s ease-out;
}

/* Zebra-stripe rows so the eye can track from the AS pill on the
   left to the numeric columns on the right without losing the line.
   Striping is applied per-sibling within each tree level, so nested
   subtrees also get their own alternating bands — which keeps the
   pattern readable even when the user expands several levels. The
   tint is intentionally subtle so it sits behind the bar/pill colors
   without competing with them. */
li.node:nth-child(even) > .row {
    background: var(--zebra, #f4f6f9);
}
.row:hover {
    background: var(--accent-soft);
}

