/* 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: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}
/* Header utility links, lifted out of the intro paragraph into their
   own scannable row. */
.header-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 2px 0 4px;
    font-size: 13px;
}
/* Leading magnifier marks the search field as navigation, distinct
   from the graph-building card below it. */
.search-input-wrap { position: relative; }
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.search-input-wrap #search-input { padding-left: 34px; }
#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. */
/* "Build a custom graph" card — one bordered block with a mode toggle
   (regex filter vs prefix coverage). Each mode is a .cg-pane holding an
   input + status + its own Show/Open buttons; only the active pane is
   shown, so the user sees a single set of controls. The Max peers cap in
   the head is shared by both modes. */
.custom-graph {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 10px;
    max-width: 980px;
    padding: 12px 14px;
}
.custom-graph-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 10px;
}
.custom-graph-title {
    color: var(--fg);
    font-size: 13px;
    font-weight: 600;
}
.cg-tabs {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-left: auto;
    overflow: hidden;
}
.cg-tab {
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    padding: 5px 12px;
    transition: background 0.12s, color 0.12s;
}
.cg-tab + .cg-tab { border-left: 1px solid var(--line); }
.cg-tab:hover:not([aria-selected="true"]) { background: var(--accent-soft); }
.cg-tab[aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.cg-tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.cg-pane[hidden] { display: none; }
/* Static description for input-less panes (e.g. the Anycast tab). */
.cg-pane-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
}
.cg-pane input[type="search"] {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--fg);
    font: inherit;
    font-size: 13px;
    padding: 6px 10px;
    width: 100%;
}
.cg-pane input[type="search"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: var(--accent);
}
.cg-pane.is-invalid input[type="search"] { border-color: #dc2626; }
.cg-pane-foot {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    justify-content: space-between;
    margin-top: 8px;
}
.cg-actions { display: flex; gap: 8px; }
.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);
}
