/* @mentions — the "@" picker list and the "you were mentioned" popup
   (public/js/crm-mention.js, partials/mention-alert). */

/* ── The picker ───────────────────────────────────────────────────────────── */
.crm-mention-menu {
    position: fixed;
    z-index: 1100;                /* above Bootstrap modals (1055) — edit boxes live in modals */
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--crm-border, #e8eaef);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
    padding: 4px;
}
.crm-mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 7px;
    cursor: pointer;
    min-width: 0;
    font-size: .84rem;
}
.crm-mention-item.active,
.crm-mention-item:hover { background: #f3e8ff; }
.crm-mention-avatar {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--crm-primary, #530383);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.crm-mention-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}
.crm-mention-role {
    flex: 0 0 auto;
    font-size: .66rem;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
}
.crm-mention-empty { padding: 8px 10px; font-size: .8rem; color: #6b7280; }

/* ── The popup ────────────────────────────────────────────────────────────── */
/* Bottom-right, above the chat button (#crmChatFab sits at bottom:24px) and
   above its panel, so neither ever hides a mention. */
#crm-mention-alerts {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 9990;
    width: 380px;
    max-width: calc(100vw - 24px);
    pointer-events: none;
}
.crm-mention-card {
    pointer-events: auto;
    background: #fff;
    border: 1px solid var(--crm-border, #e8eaef);
    border-left: 4px solid var(--crm-primary, #530383);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
    padding: 14px 14px 12px;
    /* The slow rise from the bottom of the screen. */
    transform: translateY(calc(100% + 120px));
    opacity: 0;
    transition: transform .9s cubic-bezier(.22, .61, .36, 1), opacity .9s ease;
}
.crm-mention-card.is-in { transform: translateY(0); opacity: 1; }
.crm-mention-card .cmc-head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.crm-mention-card .cmc-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f3e8ff;
    color: var(--crm-primary, #530383);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    animation: crm-mention-pulse 2.4s ease-in-out infinite;
}
.crm-mention-card .cmc-titles { flex: 1 1 auto; min-width: 0; }
.crm-mention-card .cmc-title { font-weight: 700; font-size: .9rem; line-height: 1.25; overflow-wrap: anywhere; }
.crm-mention-card .cmc-where {
    font-size: .74rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.crm-mention-card .cmc-count {
    flex: 0 0 auto;
    font-size: .66rem;
    font-weight: 700;
    color: #5b21b6;
    background: #ede9fe;
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
}
.crm-mention-card .cmc-body {
    margin: 10px 0 0;
    padding: 8px 10px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: .82rem;
    color: #374151;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 7.5em;
    overflow: hidden;
}
.crm-mention-card .cmc-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 10px;
}
.crm-mention-card .cmc-ago { margin-right: auto; font-size: .7rem; color: #9ca3af; }

@keyframes crm-mention-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--crm-primary-rgb, 83,3,131), .28); }
    50%      { box-shadow: 0 0 0 6px rgba(var(--crm-primary-rgb, 83,3,131), 0); }
}

/* Phones: full width, lifted clear of the bottom nav bar and the chat button. */
@media (max-width: 576px) {
    #crm-mention-alerts { right: 12px; left: 12px; bottom: 136px; width: auto; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .crm-mention-card { transition: opacity .3s ease; transform: none; }
    .crm-mention-card .cmc-icon { animation: none; }
}
