/* Topbar controls: inbox, language, theme.
 *
 * Injected into .topbar-actions by topbar-controls.js. Icon-sized and quiet —
 * they're persistent chrome, so they shouldn't compete with the page.
 */

.tb-controls { display: flex; align-items: center; gap: 6px; }

.tb-wrap { position: relative; }

.tb-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--stage-border);
  background: var(--stage-3);
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.tb-btn svg { width: 16px; height: 16px; display: block; }
.tb-btn:hover { border-color: var(--ebid-accent); color: var(--ebid-accent); }

.tb-btn-text { font-size: 11.5px; font-weight: 700; }

/* Unread count. Orange rather than the brand blue so it reads as "attention"
   next to two blue-on-hover icons. */
.tb-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--ebid-orange);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

/* --- popovers -------------------------------------------------------------- */

.tb-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  /* Only has to beat siblings within .topbar's stacking context (see
     app.css .topbar) — escaping the page is that rule's job, not this one. */
  z-index: 40;
  border-radius: var(--r-md);
  border: 1px solid var(--stage-border);
  background: var(--surface-solid);
  box-shadow: 0 18px 40px -14px var(--glass-shadow);
  animation: tb-pop-in var(--dur-fast) var(--ease-out);
}

@keyframes tb-pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .tb-pop { animation: none; } }

.tb-pop-menu { min-width: 150px; padding: 5px; }

.tb-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.tb-menu-item:hover { background: var(--stage-0); }
.tb-menu-item.is-active { background: var(--ebid-bg-tint); color: var(--ebid-primary); font-weight: 700; }

.tb-pop-inbox { width: min(340px, calc(100vw - 32px)); }

.tb-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--stage-border);
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.tb-pop-action {
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--ebid-accent);
  cursor: pointer;
}
.tb-pop-action:hover { text-decoration: underline; }

.tb-pop-body { max-height: min(420px, 60vh); overflow-y: auto; }

/* --- inbox items ------------------------------------------------------------ */

.ib-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--stage-border);
  text-decoration: none;
  position: relative;
}
.ib-item:last-child { border-bottom: none; }
a.ib-item:hover { background: var(--stage-0); }

.ib-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--ebid-bg-tint);
  color: var(--ebid-primary);
}
.ib-icon svg { width: 15px; height: 15px; }
.ib-icon.is-urgent { background: var(--ebid-orange-soft); color: var(--ebid-orange-strong); }

.ib-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }

.ib-kind {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

.ib-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ib-meta { font-size: 11px; color: var(--text-tertiary); }
.ib-meta.is-urgent { color: var(--ebid-urgent); font-weight: 700; }

.ib-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--ebid-orange);
}

.ib-empty {
  padding: 26px 18px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-tertiary);
}

@media (max-width: 520px) {
  /* The language short-code is the first thing to go — the globe still says
     what the button is. */
  .tb-btn-text { display: none; }
  .tb-controls { gap: 4px; }
}
