/* ============================================================
   Context menu (right-click / long-press quick-edit)
   ============================================================ */
.context-menu {
    position: fixed;
    z-index: var(--z-layer-modal);
    min-width: 220px;
    padding: 6px 0;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    font-family: 'Avenir Next', -apple-system, sans-serif;
    font-size: var(--font-size-14);
    color: #1A1A2E;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--duration-fast) var(--ease-in-out),
                transform var(--duration-fast) var(--ease-in-out);
    pointer-events: none;
}

.context-menu:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.context-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 16px;
    min-height: 36px;
    background: transparent;
    border: none;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.context-menu-item:hover,
.context-menu-item.is-selected {
    background: rgba(74, 144, 217, 0.12);
    color: #357ABD;
}

.context-menu-item-suggested {
    font-weight: 600;
}

.context-menu-divider {
    height: 1px;
    margin: 6px 8px;
    background: rgba(0, 0, 0, 0.08);
}

@media (prefers-reduced-motion: reduce) {
    .context-menu {
        transition: none;
    }
}

/* Dark mode — see the note above `.input-dialog-input` for why both halves are
   written out and why `body.dark-theme` never matched.
   Only `color` is set for `.context-menu` itself: the dark background and
   border already come from the grouped modal/dropdown rule earlier in this
   file, and repeating them here (at equal specificity but later in source)
   would silently override that rule's colour with a different one. The base
   `.context-menu` sets `color: #1A1A2E`, which the grouped rule does not
   override — hence dark ink on a dark menu, 1.19:1, until now. */
[data-theme="dark"] .context-menu {
    color: #F5F5F7;
}

/* The light hover tints the label toward the accent, but every accent in the
   palette lands between 3.17:1 and 3.79:1 on this tinted dark surface, i.e.
   below AA for 14px text. The tint alone carries the hover signal; the label
   keeps the inherited #F5F5F7 (9.73:1). */
[data-theme="dark"] .context-menu-item:hover,
[data-theme="dark"] .context-menu-item.is-selected {
    background: rgba(74, 144, 217, 0.22);
}

[data-theme="dark"] .context-menu-divider {
    background: rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .context-menu {
        color: #F5F5F7;
    }

    :root:not([data-theme="light"]) .context-menu-item:hover,
    :root:not([data-theme="light"]) .context-menu-item.is-selected {
        background: rgba(74, 144, 217, 0.22);
    }

    :root:not([data-theme="light"]) .context-menu-divider {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* Entity link picker modal */
.entity-link-picker {
    max-width: 460px;
    width: 90vw;
}
.entity-link-picker-subtitle {
    font-size: var(--font-size-sm);
    color: #6b7280;
    margin: 4px 0 12px;
}
.entity-link-picker-results {
    max-height: 320px;
    min-height: 80px;
    overflow-y: auto;
    margin: 8px 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
}
.entity-link-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: background var(--duration-fast) var(--ease-in-out);
}
.entity-link-picker-row:last-child { border-bottom: none; }
.entity-link-picker-row:hover,
.entity-link-picker-row.is-selected {
    background: rgba(74, 144, 217, 0.12);
}
.entity-link-picker-row-icon {
    flex: 0 0 20px;
    height: 20px;
    display: flex;
    align-items: center;
    color: #6b7280;
}
.entity-link-picker-row-title {
    flex: 1 1 auto;
    font-size: var(--font-size-14);
    color: #1A1A2E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entity-link-picker-row-type {
    flex: 0 0 auto;
    font-size: var(--font-size-xs);
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.entity-link-picker-empty {
    padding: 24px;
    text-align: center;
    color: #9ca3af;
    font-size: var(--font-size-sm);
}
/* Dark mode — see the note above `.input-dialog-input`. The picker sits in a
   `.confirm-dialog`, whose background is `var(--bg-main)` (#121212 in dark), so
   the hardcoded #1A1A2E row title was 1.10:1 until this rule could match. */
[data-theme="dark"] .entity-link-picker-results {
    border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .entity-link-picker-row {
    border-bottom-color: rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .entity-link-picker-row-title {
    color: #F5F5F7;
}
[data-theme="dark"] .entity-link-picker-row:hover,
[data-theme="dark"] .entity-link-picker-row.is-selected {
    background: rgba(74, 144, 217, 0.22);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .entity-link-picker-results {
        border-color: rgba(255, 255, 255, 0.08);
    }
    :root:not([data-theme="light"]) .entity-link-picker-row {
        border-bottom-color: rgba(255, 255, 255, 0.04);
    }
    :root:not([data-theme="light"]) .entity-link-picker-row-title {
        color: #F5F5F7;
    }
    :root:not([data-theme="light"]) .entity-link-picker-row:hover,
    :root:not([data-theme="light"]) .entity-link-picker-row.is-selected {
        background: rgba(74, 144, 217, 0.22);
    }
}

.shopping-list-empty-hint {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
    font-style: italic;
}
