/* BD-124: shared note toolbar ⋯ overflow menu.
 * BD-155: also the AI Quick Actions (sparkle) menu on V4 board cards, so the
 * chrome comes from the shared --ln-cardmenu-* tokens defined in
 * ai_canvas_enhanced.css. Fallbacks keep this usable on pages that do not
 * load the canvas stylesheet (e.g. Document view). */

.ln-note-toolbar-overflow {
    position: fixed;
    z-index: 12000;
    min-width: 188px;
    width: var(--ln-cardmenu-width, min(280px, calc(100vw - 24px)));
    max-width: calc(100vw - 16px);
    padding: var(--ln-cardmenu-pad, 6px);
    margin: 0;
    border: 1px solid var(--ln-cardmenu-border, rgba(15, 23, 42, 0.12));
    border-radius: var(--ln-cardmenu-radius, 10px);
    background: var(--ln-cardmenu-bg, #fff);
    box-shadow: var(--ln-cardmenu-shadow,
        0 10px 28px rgba(15, 23, 42, 0.14),
        0 2px 8px rgba(15, 23, 42, 0.06));
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
}

.ln-note-toolbar-overflow[hidden] {
    display: none !important;
}

/* Matches .ln-card-aff-pop-hd so the sparkle menu is titled like Tags/Objects. */
.ln-note-toolbar-overflow-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 6px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--ln-cardmenu-divider, rgba(15, 23, 42, 0.08));
    font-size: var(--ln-cardmenu-font-sm, 12px);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--ln-cardmenu-muted, #64748b);
}

.ln-note-toolbar-overflow-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: inherit;
}

.ln-note-toolbar-overflow-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    flex-shrink: 0;
    color: var(--ln-cardmenu-muted, #64748b);
}

/* Same mask glyph as Board card AI affordance (.ln-card-aff-glyph--ai). */
.ln-ai-sparkle-glyph {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 1;
    background-color: currentColor;
    -webkit-mask-image: var(--ln-aff-icon);
    mask-image: var(--ln-aff-icon);
    -webkit-mask-mode: alpha;
    mask-mode: alpha;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.ln-note-toolbar-overflow-title-icon .ln-ai-sparkle-glyph {
    width: 12px;
    height: 12px;
}

/* Visual break before a footer section (e.g. "AI Chat" when chat is off). */
.ln-note-toolbar-overflow-separator {
    height: 0;
    margin: 4px 6px;
    border: 0;
    border-top: 1px solid var(--ln-cardmenu-divider, rgba(15, 23, 42, 0.08));
    pointer-events: none;
}

.ln-note-toolbar-overflow-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: none;
    border-radius: var(--ln-cardmenu-row-radius, 7px);
    background: transparent;
    color: var(--ln-cardmenu-text, #334155);
    font: inherit;
    font-size: var(--ln-cardmenu-font, 13px);
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.ln-note-toolbar-overflow-item:hover:not(:disabled),
.ln-note-toolbar-overflow-item:focus-visible {
    background: var(--ln-cardmenu-hover, rgba(100, 116, 139, 0.12));
    outline: none;
}

.ln-note-toolbar-overflow-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ln-note-toolbar-overflow-item i {
    width: 1em;
    text-align: center;
    color: var(--ln-cardmenu-muted, #64748b);
    flex-shrink: 0;
}

.ln-note-toolbar-overflow-item--danger {
    color: #b91c1c;
}

.ln-note-toolbar-overflow-item--danger i {
    color: #dc2626;
}

.ln-note-toolbar-overflow-label {
    flex: 1;
    min-width: 0;
}

/* Board: hide overflow-source affordances from the primary strip; keep in DOM for refresh/handlers. */
.ln-card-affordances > .ln-card-aff-btn--overflow-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}

.document-meta-dot--overflow-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}

/* BD-128: Archive lives under ⋯ More; keep button in DOM for state + menu handler. */
.document-toolbar-btn--overflow-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}

.document-meta-icons {
    position: relative;
}
