/* Shared action popovers: message menus, editor menus, photo actions, notes. */
.action-popover,
.msg-context-menu,
.message-context-menu,
.pp-photo-context-menu,
.notes-ctx-menu {
    position: fixed;
    z-index: 9999;
    min-width: 158px;
    max-width: min(280px, calc(100vw - 16px));
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(17, 20, 24, 0.9);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: action-popover-pop 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top left;
}

.action-popover--absolute,
.notes-ctx-menu {
    position: absolute;
    z-index: 220;
}

body.light .action-popover,
body.light .msg-context-menu,
body.light .message-context-menu,
body.light .pp-photo-context-menu,
body.light .notes-ctx-menu {
    border-color: rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.action-popover.is-hidden,
.msg-context-menu.is-hidden,
.message-context-menu.is-hidden,
.pp-photo-context-menu.is-hidden,
.notes-ctx-menu.is-hidden {
    display: none !important;
}

.action-popover__item,
.msg-ctx-item,
.context-menu-item,
.pp-photo-context-menu__item,
.notes-ctx-item {
    width: 100%;
    min-height: 34px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text, #f3f4f6);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--duration, 0.15s) ease, color var(--duration, 0.15s) ease, opacity var(--duration, 0.15s) ease;
}

.action-popover__item:hover,
.action-popover__item:focus-visible,
.msg-ctx-item:hover,
.msg-ctx-item:focus-visible,
.context-menu-item:hover,
.context-menu-item:focus-visible,
.pp-photo-context-menu__item:hover,
.pp-photo-context-menu__item:focus-visible,
.notes-ctx-item:hover,
.notes-ctx-item:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    outline: none;
}

body.light .action-popover__item,
body.light .msg-ctx-item,
body.light .context-menu-item,
body.light .pp-photo-context-menu__item,
body.light .notes-ctx-item {
    color: #1f2937;
}

.notes-ctx-item--pin.action-popover__item {
    color: var(--text, #f3f4f6) !important;
}

body.light .notes-ctx-item--pin.action-popover__item {
    color: #1f2937 !important;
}

body.light .action-popover__item:hover,
body.light .action-popover__item:focus-visible,
body.light .msg-ctx-item:hover,
body.light .msg-ctx-item:focus-visible,
body.light .context-menu-item:hover,
body.light .context-menu-item:focus-visible,
body.light .pp-photo-context-menu__item:hover,
body.light .pp-photo-context-menu__item:focus-visible,
body.light .notes-ctx-item:hover,
body.light .notes-ctx-item:focus-visible {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.action-popover__item.is-danger,
.action-popover__item.text-danger,
.context-menu-item.text-danger,
.pp-photo-context-menu__item.is-danger {
    color: #ef4444 !important;
}

.action-popover__item.is-danger:hover,
.action-popover__item.is-danger:focus-visible,
.action-popover__item.text-danger:hover,
.action-popover__item.text-danger:focus-visible,
.context-menu-item.text-danger:hover,
.context-menu-item.text-danger:focus-visible,
.pp-photo-context-menu__item.is-danger:hover,
.pp-photo-context-menu__item.is-danger:focus-visible {
    background: rgba(239, 68, 68, 0.11);
    color: #ff6b6b !important;
}

.action-popover__item.is-disabled,
.action-popover__item:disabled,
.pp-photo-context-menu__item.is-disabled,
.pp-photo-context-menu__item:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.action-popover__item .ui-icon,
.action-popover__item svg,
.context-menu-item .ui-icon,
.context-menu-item svg,
.pp-photo-context-menu__item .ui-icon,
.pp-photo-context-menu__item svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.action-popover__format-row,
.msg-fmt-row,
.notes-ctx-fmt-row {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px;
}

.action-popover__format-btn,
.msg-fmt-btn,
.notes-ctx-fmt-btn {
    flex: 1 1 0;
    min-width: 30px;
    min-height: 30px;
    padding: 6px 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background var(--duration, 0.15s) ease, color var(--duration, 0.15s) ease;
}

.action-popover__format-btn:hover,
.action-popover__format-btn:focus-visible,
.msg-fmt-btn:hover,
.msg-fmt-btn:focus-visible,
.notes-ctx-fmt-btn:hover,
.notes-ctx-fmt-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    outline: none;
}

body.light .action-popover__format-btn:hover,
body.light .action-popover__format-btn:focus-visible,
body.light .msg-fmt-btn:hover,
body.light .msg-fmt-btn:focus-visible,
body.light .notes-ctx-fmt-btn:hover,
body.light .notes-ctx-fmt-btn:focus-visible {
    background: rgba(15, 23, 42, 0.06);
}

.action-popover__separator,
.msg-ctx-sep,
.notes-ctx-sep {
    width: calc(100% - 8px);
    height: 1px;
    margin: 3px 4px;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
}

body.light .action-popover__separator,
body.light .msg-ctx-sep,
body.light .notes-ctx-sep {
    background: rgba(15, 23, 42, 0.09);
}

.action-popover__meta,
.ctx-read-info {
    min-height: 30px;
    margin: 3px 4px 0;
    padding: 7px 8px 5px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
}

body.light .action-popover__meta,
body.light .ctx-read-info {
    border-top-color: rgba(15, 23, 42, 0.09);
}

@keyframes action-popover-pop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
