/* Page-level layout: header bar, three-pane main area, status bar.
   `main` uses flex so the centre tree pane absorbs remaining width.
   `#results` is `hidden` until there are search hits to show — JS
   toggles the attribute. */

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 0.75em;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  flex: none;
}

.menu-wrap {
  position: relative;
  flex: none;
}

/* Dropdown anchored under the hamburger. JS toggles the `hidden`
   attribute; off-click and Escape close it. Dark-grey panel; rows
   inherit white text and have no per-row chrome. */
#app-menu {
  position: absolute;
  top: calc(100% + 0.4em);
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 14em;
  background: #3a3a3a;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  padding: var(--space-xs) 0;
}

#app-menu[hidden] {
  display: none;
}

form#search-form {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex: 1;
}

main {
  display: flex;
  flex: 1;
  min-height: 0;            /* lets children scroll instead of growing */
}

#results {
  width: 14em;
  min-width: 10em;
  max-width: 18em;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 0.5em;
}

#results[hidden] {
  display: none;
}

#tree {
  flex: 1;
  overflow: auto;
  padding: var(--space-lg);
  border-right: 1px solid var(--border);
}

/* Make the inner body fill the pane so the graph-view SVG (width/
   height: 100%) can resolve to the actual pane size. The tree-view
   still scrolls — content overflows #tree-body and the
   overflow:auto on #tree picks it up. */
#tree-body {
  height: 100%;
}

#detail {
  width: 30%;
  min-width: 280px;
  max-width: 480px;
  overflow-y: auto;
  padding: var(--space-md);
  background: var(--bg-alt);
}

/* Active-pane indicator: a thin coloured stripe on the inside-left
   edge of whichever pane currently owns the keyboard. JS sets
   data-active-pane on the body in lock-step with state.activeKeyboardPane;
   click on a pane or ArrowLeft / ArrowRight flip it. */
body[data-active-pane="results"] #results {
  box-shadow: inset 1px 0 0 var(--accent);
}
body[data-active-pane="tree"] #tree {
  box-shadow: inset 1px 0 0 var(--accent);
}

#status-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.25em var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: var(--font-size-small);
  font-family: var(--font-mono);
  min-height: 1.6em;
}

/* Logo lives in the footer now; sized to the status-bar's text
   height (~14px) so it doesn't push the bar taller. */
#status-bar .brand-icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

#status-bar-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#status-bar.error {
  color: #b91c1c;
}
