// =============================================================================
// Mention Styles
// =============================================================================
// Mention renders as span.mention[data-type="mention"]
// =============================================================================

.dm-editor .ProseMirror {
  .mention {
    display: inline;
    background: var(--dm-mention-bg);
    color: var(--dm-mention-color);
    border-radius: var(--dm-mention-border-radius);
    padding: 0.1em 0.3em;
    font-weight: 500;
    font-size: 0.95em;
    white-space: nowrap;
  }

  // In-progress mention suggestion (typing @name)
  .mention-suggestion {
    text-decoration: underline;
    text-decoration-color: var(--dm-accent, #2563eb);
    text-underline-offset: 2px;
  }
}

// ─── Inline Suggestion Dropdown ─────────────────────────────────────────────

.dm-mention-suggestion {
  position: absolute;
  // border-box so the measured available space maps 1:1 to max-height below.
  box-sizing: border-box;
  z-index: 100;
  min-width: 12rem;
  max-width: 20rem;
  // `positionFloatingOnce({ constrainHeight })` writes the space around the
  // caret to `--dm-available-height`; plain 22rem cap when unset.
  max-height: min(22rem, var(--dm-available-height, 100vh));
  overflow-y: auto;
  padding: 0.25rem;
  background: var(--dm-surface, #f8f9fa);
  border: 1px solid var(--dm-border-color, #e0e0e0);
  border-radius: 0.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  animation: dm-fade-in 0.2s ease;

  // Slim custom scrollbar, matches the slash-command menu styling.
  scrollbar-width: thin;
  scrollbar-color: var(--dm-scrollbar-thumb, rgba(0, 0, 0, 0.18)) transparent;

  &::-webkit-scrollbar {
    width: 6px;
  }
  &::-webkit-scrollbar-track {
    background: transparent;
    margin: 0.25rem 0;
  }
  &::-webkit-scrollbar-thumb {
    background: var(--dm-scrollbar-thumb, rgba(0, 0, 0, 0.18));
    border-radius: 3px;
    transition: background-color 0.15s;
  }
  &::-webkit-scrollbar-thumb:hover {
    background: var(--dm-scrollbar-thumb-hover, rgba(0, 0, 0, 0.28));
  }
}

.dm-mention-suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--dm-text, #1a1a1a);
  cursor: pointer;
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: left;
  transition: background-color 0.1s;

  &:hover,
  &--selected {
    background: var(--dm-hover, rgba(0, 0, 0, 0.06));
  }

  &:focus-visible {
    outline: 2px solid var(--dm-accent, #2563eb);
    outline-offset: 1px;
  }
}

.dm-mention-suggestion-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-mention-suggestion-empty {
  padding: 0.5rem;
  text-align: center;
  color: var(--dm-text, #1a1a1a);
  opacity: 0.5;
  font-size: 0.8125rem;
}
