/* ═══════════════════════════════════════════════════════════
   @MENTION AUTOCOMPLETE DROPDOWN
   ───────────────────────────────────────────────────────────
   Colors resolve through the theme's --nh-* design tokens so
   dark mode works automatically. The parent theme's
   html.nh-dark (manual toggle) and body.noteshub-dark-default
   (admin default) rules swap the underlying tokens at runtime,
   so no explicit dark-mode overrides are needed here.
   ═══════════════════════════════════════════════════════════ */

.noteshub-mention-menu {
    position: absolute;
    z-index: 10000;
    background: var(--nh-bg, #ffffff);
    border: 1px solid var(--nh-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.2);
    padding: 6px;
    min-width: 240px;
    max-width: 320px;
    max-height: 260px;
    overflow-y: auto;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--nh-text-muted, #64748b) 25%, transparent) transparent;
}

.noteshub-mention-menu::-webkit-scrollbar { width: 6px; }
.noteshub-mention-menu::-webkit-scrollbar-track { background: transparent; }
.noteshub-mention-menu::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--nh-text-muted, #64748b) 25%, transparent);
    border-radius: 999px;
}

.noteshub-mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1));
    min-height: 44px;
    box-sizing: border-box;
}

.noteshub-mention-item:hover {
    background: var(--nh-bg-tint, #f1f5f9);
}

/*
 * .is-active is the keyboard-navigation state — the JS sets it on
 * ArrowUp / ArrowDown while the textarea keeps focus. Styled more
 * prominently than :hover so keyboard users can see which item the
 * arrow keys have selected.
 */
.noteshub-mention-item.is-active {
    background: var(--nh-primary-soft, rgba(99, 102, 241, 0.12));
    box-shadow: inset 0 0 0 1.5px var(--nh-primary, #6366f1);
}

.noteshub-mention-item img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.noteshub-mention-item-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--nh-text, #0f172a);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.noteshub-mention-item-login {
    font-size: 11px;
    color: var(--nh-text-muted, #64748b);
    font-weight: 500;
    flex-shrink: 0;
}

.noteshub-mention-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--nh-text-faint, #94a3b8);
}

/* Rendered mention link inside the note body */
.noteshub-mention {
    color: var(--nh-primary, #6366f1);
    text-decoration: none;
    font-weight: 600;
    background: var(--nh-primary-softer, rgba(99, 102, 241, 0.08));
    padding: 1px 6px;
    border-radius: 6px;
    transition: background 0.15s var(--nh-ease, cubic-bezier(.4, 0, .2, 1));
}

.noteshub-mention:hover {
    background: var(--nh-primary-soft, rgba(99, 102, 241, 0.18));
    color: var(--nh-primary-2, #4f46e5);
}

.noteshub-mention:focus-visible {
    outline: 2px solid var(--nh-primary, #6366f1);
    outline-offset: 2px;
}

/* Mobile */
@media (max-width: 768px) {
    .noteshub-mention-menu {
        min-width: 200px;
        max-width: calc(100vw - 32px);
        max-height: 220px;
    }

    .noteshub-mention-item {
        min-height: 48px;
        padding: 10px 12px;
    }
}

/*
 * Dark-mode overrides are not required — every color above resolves
 * through --nh-* tokens, which html.nh-dark and
 * body.noteshub-dark-default swap automatically. The one exception
 * is the drop shadow, which is intentionally darker in dark mode.
 */
html.nh-dark .noteshub-mention-menu,
body.noteshub-dark-default .noteshub-mention-menu {
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}