/* top-bar.css – retro banner and theme toggle */
@import url("variables.css");

.top-bar {
  /* paper surface — the retro lives in the ASCII logo + mono, not the chrome */
  background: var(--container-bg);
  color: var(--fg);
  font-family: var(--oh-font-mono, "Lucida Console", "Courier New", monospace);
  font-size: 0.9rem;
  padding: 3px 10px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--container-border);
  /* pinned to the viewport top + stacking context so its tooltips and
     dropdowns paint above page content */
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

/* Bare anchors take ink; .top-bar-link gets its own colour below — it must
   out-specify this rule so nav icons render --oh-icon. */
.top-bar a { color: var(--fg); text-decoration: none; }
.top-bar a.top-bar-link { color: var(--oh-icon, #2563eb); }

.top-bar-brand {
  font-size: 0.9rem;
  font-weight: 700;
  margin-right: 0.75rem;
  white-space: nowrap;
  color: var(--oh-accent);
}

/* Nav links — same pill on every page; .active marks the current one. */
.top-bar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  color: var(--oh-icon, #2563eb);
  margin-right: 4px;
  white-space: nowrap;
}
.top-bar-link i {
  font-size: 0.9rem;
}


.top-bar-link.active {
  /* soft blue selection tint instead of the jarring solid-black fill */
  background: rgba(37, 99, 235, 0.12);
  color: var(--oh-icon, #2563eb);
}
html.oh-dark .top-bar-link.active {
  background: rgba(96, 165, 250, 0.16);
  color: var(--oh-icon, #60a5fa);
}

.top-auth-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}

.top-auth-status a {
  background: transparent;
  border: 1px solid var(--container-border, #888);
  border-radius: 6px;
  color: var(--fg, #222);
  font-size: 0.75rem;
  padding: 4px 10px;
  text-decoration: none;
}
.top-auth-status a:hover {
  border-color: var(--accent, #4a9eff);
  color: var(--accent, #4a9eff);
}

.top-auth-status .top-auth-user {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
}

/* Shared style for all top-bar controls */
.top-bar select,
.top-bar button {
  font-size: 0.75rem;
  padding: 4px 12px;
  background: transparent;
  color: var(--fg, #222);
  border: 1px solid var(--container-border, #888);
  border-radius: 6px;
  cursor: pointer;
}
.top-bar button:hover:not(:disabled) {
  border-color: var(--accent, #4a9eff);
  color: var(--accent, #4a9eff);
}

.top-bar select {
  width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  appearance: auto;
}

.top-bar select.placeholder {
  color: #888 !important;
}



/* Theme toggle + global assistant — icon-only, accent-coloured.
   Must come AFTER the generic .top-bar button rule: that rule would
   otherwise paint them as white Win95 buttons with black text. */
.top-bar button.oh-theme-toggle,
.top-bar button.oh-assistant-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: var(--oh-icon, #2563eb);
  font-size: 1rem;
  height: auto;
  cursor: pointer;
}
.top-bar button.oh-theme-toggle:hover,
.top-bar button.oh-assistant-btn:hover {
  opacity: 0.75;
}

/* --- Dark mode --- */
html.oh-dark .top-bar {
  background: var(--container-bg-dark);
  color: var(--fg-dark);
  border-bottom-color: var(--container-border-dark);
}
html.oh-dark .top-bar a { color: var(--fg-dark); }
html.oh-dark .top-bar a.top-bar-brand,
html.oh-dark .top-auth-status a { color: var(--fg-dark); transition: none; }
html.oh-dark .top-bar a.top-bar-link { color: var(--oh-icon, #60a5fa); }
html.oh-dark .top-bar-brand { color: var(--oh-accent); }

html.oh-dark .top-bar-link {
  background: transparent;
  border: none;
}
html.oh-dark .top-auth-status a {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--oh-border-strong);
}
html.oh-dark .top-auth-status a:hover {
  border-color: var(--accent, #60a5fa);
  color: var(--accent, #60a5fa);
}

html.oh-dark .top-bar select,
html.oh-dark .top-bar button {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--oh-border-strong);
}
html.oh-dark .top-bar button:hover:not(:disabled) {
  border-color: var(--accent, #60a5fa);
  color: var(--accent, #60a5fa);
}
html.oh-dark .top-bar button.oh-theme-toggle,
html.oh-dark .top-bar button.oh-assistant-btn {
  background: transparent;
  border: none;
  color: var(--oh-icon, #60a5fa);
}
html.oh-dark .top-bar select.placeholder {
  color: #666 !important;
}

/* Responsive top bar */
@media (max-width: 640px) {
  .top-bar {
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
  }
  .top-bar a.top-bar-brand {
    font-size: 0.75rem;
    margin-right: 0;
  }
  .top-bar-link {
    font-size: 0.62rem;
    padding: 1px 6px;
  }
  .top-bar select {
    width: 90px;
    font-size: 0.6rem;
    height: 20px;
  }
  .top-bar button {
    font-size: 0.6rem;
    height: 20px;
    padding: 1px 4px;
  }
}
