/*
 * Site header — single source of truth.
 *
 * Loaded by every page that has a top bar (marketing, docs, and the app), so
 * the header renders identically everywhere. Values are hardcoded rather than
 * tokenized because the marketing pages and styles.css define different custom
 * property names for the same colors.
 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  padding: 0.5rem 1.5rem;
  background: rgba(26, 29, 39, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid #2d3148;
}

/* Brand */

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f1f5f9;
  text-decoration: none;
}

.topbar-brand:hover {
  color: #f1f5f9;
  text-decoration: none;
}

.topbar-brand img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Actions */

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

/*
 * .btn-ghost is the app's generic ghost button and is also used for header
 * links; scoping it here keeps header links identical to .topbar-link without
 * changing ghost buttons elsewhere in the app.
 */
.topbar-link,
.topbar .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 17, 23, 0.6);
  border: 1px solid #2d3148;
  border-radius: 6px;
  padding: 0.38rem 0.75rem;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  color: #94a3b8;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.topbar-link:hover,
.topbar .btn-ghost:hover {
  color: #f1f5f9;
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  text-decoration: none;
}

/* Emphasized link — the primary call to action in a header. */
.topbar-link--primary {
  color: #f1f5f9;
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.16);
}

/* Current page. */
.topbar-link[aria-current="page"] {
  color: #f1f5f9;
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
}

.topbar .user-email {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
}

/* Read-only / shared-view badge (dashboard). */
.topbar .shared-view-badge {
  font-size: 0.72rem;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}

/* Sidebar toggle (docs). */
.topbar-menu-btn {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 17, 23, 0.6);
  border: 1px solid #2d3148;
  border-radius: 6px;
  padding: 0.34rem 0.6rem;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.2;
  color: #94a3b8;
  cursor: pointer;
}

.topbar-menu-btn:hover {
  color: #f1f5f9;
  border-color: #6366f1;
}

.topbar-menu-btn svg {
  width: 14px;
  height: 14px;
}

/* Pushes the actions group to the right when the brand is not the only
   left-hand element (docs uses this alongside the menu button). */
.topbar-spacer {
  flex: 1;
}

.topbar :focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
}

@media (max-width: 680px) {
  .topbar {
    padding: 0.5rem 1rem;
  }

  .topbar-actions {
    gap: 0.35rem;
  }
}
