/* ===== Floating chat heads =====
   Messenger-style avatar bubbles that appear on ANY page (not the chat page
   itself - static/website/js/chat-heads.js no-ops there) when a message
   notification arrives. Loaded on both frontend/website/base.html and
   frontend/dashboard/base.html, so every custom property below has an
   inline fallback rather than relying on either site's own theme variables.
*/
.lx-chat-heads {
    position: fixed;
    inset-inline-end: 18px;
    bottom: 18px;
    z-index: 6000;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}

.lx-chat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
/* No RTL flex-direction override needed - plain `row` (the default) already
   lays out children start-to-end per the page's own direction, and the
   preview element is now the first DOM child (chat-heads.js) with the
   avatar last, so the avatar - not the preview - naturally ends up nearest
   the fixed container's anchored edge in both LTR and RTL. A row-reverse
   override here would flip that back to wrong. */

.lx-chat-head-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    margin-inline-start: 12px;
    border-radius: 50%;
    /* A white/light profile photo would otherwise blend into a light
       background - a visible ring around the bubble keeps it readable
       regardless of what the photo looks like. */
    border: 2px solid var(--danger, #ef4444);
    background: var(--accent, #4f46e5);
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    overflow: visible;
    box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 22, 40, 0.22));
    pointer-events: auto;
    cursor: pointer;
    animation: lxChatHeadPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lx-chat-head-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.lx-chat-head-badge {
    position: absolute;
    top: -5px;
    inset-inline-start: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 15px;
    text-align: center;
    border: 1px solid var(--card, #fff);
}

.lx-chat-head-preview {
    max-width: 240px;
    padding: 9px 14px;
    border-radius: 14px;
    background: var(--card, #fff);
    color: var(--text, #0f1628);
    font-size: 0.82rem;
    line-height: 1.4;
    box-shadow: var(--shadow-md, 0 4px 16px rgba(15, 22, 40, 0.12));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(6px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.lx-chat-head-preview.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@keyframes lxChatHeadPop {
    0% { transform: scale(0.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 640px) {
    .lx-chat-heads { inset-inline-end: 12px; bottom: 84px; }
    .lx-chat-head-preview { max-width: 62vw; }
}

/* Articles page's floating "write a post" button (.articles-fab) sits
   `bottom: 28px` with a 56px height - clear its top edge plus a gap,
   overriding both the base and the <=640px rule above regardless of
   breakpoint, since the FAB's own bottom offset doesn't change either.
   Also match its horizontal inset (static/website/css/articles.css) instead
   of chat-heads' own narrower 18/12px, so both float the same distance in
   from the edge instead of the chat heads sitting closer in. */
.lx-chat-heads.lx-chat-heads--above-fab {
    bottom: 80px;
    inset-inline-end: 24px;
}

@media (min-width: 992px) {
    .lx-chat-heads.lx-chat-heads--above-fab {
        inset-inline-end: calc(var(--app-sidebar-right-w, 280px) + 24px);
    }
}
