/*
 * The Qubibyte account control in the top right, on qubibyte.org/graphics.
 *
 * The markup and behaviour are the site's own (/js/auth-boot-inline.js and
 * /js/auth.js, which draw a "Sign In" button or the signed-in pill with its
 * menu). These rules restyle it in this editor's tokens, so it follows the
 * editor's light and dark interface rather than the rest of the site's theme,
 * and sits at the height of the other topbar controls.
 */

.qa-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: none;
  min-width: var(--qa-slot, 72px);
}

.qa-signin,
.qa-account {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--control-h);
  padding: 0 var(--space-3);
  border: var(--hairline) solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}

.qa-account {
  padding: 0 var(--space-3) 0 3px;
}

.qa-signin:hover,
.qa-account:hover,
.qa-signin:focus-visible,
.qa-account:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.qa-avatar {
  width: calc(var(--control-h) - 8px);
  height: calc(var(--control-h) - 8px);
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--surface-active);
}

.qa-avatar--letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.qa-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The name and the caret read as one control. */
.qa-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.qa-wrap .qa-account {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.qa-caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: var(--control-h);
  padding: 0;
  border: var(--hairline) solid var(--border-strong);
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  line-height: 0;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard);
}

.qa-caret:hover,
.qa-caret[aria-expanded="true"] {
  background: var(--surface-hover);
  color: var(--text);
}

.qa-caret svg {
  transition: transform var(--dur-fast) var(--ease-standard);
}

.qa-caret[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.qa-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  padding: var(--space-1);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-raised);
  box-shadow: var(--shadow-popover);
  z-index: 1200;
}

.qa-menu[hidden] {
  display: none;
}

.qa-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-md);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.qa-menu-item:hover,
.qa-menu-item:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

/* The verified or employee badge beside the name, in the site's fixed colours. */
.qb-verified {
  --qb-seal: var(--qb-verified);
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: -4px;
  align-self: center;
  color: var(--qb-seal);
  flex: none;
}

.qb-verified--employee {
  --qb-seal: var(--qb-employee);
}

.qb-verified-mark {
  display: block;
  width: 100%;
  height: 100%;
}

/* Its bubble; /js/auth.js supplies the coordinates. */
.qb-verified::after {
  content: attr(data-tip);
  position: fixed;
  left: var(--qb-tip-x, -9999px);
  top: var(--qb-tip-y, -9999px);
  transform: translateX(-50%);
  z-index: 2200;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: var(--shadow-popover);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

.qb-verified.is-tipped::after {
  opacity: 1;
  visibility: visible;
}

.qb-verified:focus-visible {
  outline: none;
}

/* The notification bell, left of the name (the site's /js/notifications.js). */
.qa-bell {
  position: relative;
  display: flex;
  margin-right: var(--space-2);
}

.qa-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border: var(--hairline) solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.qa-bell-btn svg {
  width: 16px;
  height: 16px;
}

.qa-bell-btn:hover,
.qa-bell-btn:focus-visible,
.qa-bell-btn[aria-expanded="true"] {
  background: var(--surface-hover);
}

.qa-bell-count {
  position: absolute;
  right: -5px;
  bottom: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--surface);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.qa-bell-count[hidden],
.qa-bell-menu[hidden] {
  display: none;
}

.qa-bell-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: -40px;
  width: 340px;
  border-radius: var(--radius-md, 8px);
  background: var(--surface-raised);
  box-shadow: var(--shadow-popover);
  color: var(--text);
  overflow: hidden;
  z-index: 1200;
}

.qa-note-head {
  padding: 10px 14px 8px;
  border-bottom: var(--hairline) solid var(--border);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.qa-note-list {
  max-height: min(400px, 60vh);
  overflow-y: auto;
}

.qa-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: var(--hairline) solid var(--border);
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
}

.qa-note:hover,
.qa-note:focus-visible {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.qa-note-pic {
  position: relative;
  display: inline-flex;
}

.qa-note-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-active);
}

.qa-note-av--letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.qa-note-kind {
  position: absolute;
  right: -4px;
  bottom: -3px;
  width: 15px;
  height: 15px;
  padding: 2px;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--accent);
}

.qa-note--like .qa-note-kind { color: var(--danger); }
.qa-note--solution .qa-note-kind { color: var(--success); }

.qa-note-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.qa-note-text {
  font-size: var(--text-md);
}

.qa-note-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}

.qa-note-time {
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
}

.qa-note-empty {
  margin: 0;
  padding: 18px 14px;
  color: var(--text-muted);
  text-align: center;
}

.qa-note-dismiss {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.qa-note-dismiss:hover,
.qa-note-dismiss:focus-visible {
  background: var(--surface-hover);
}
