/**
 * Internal Message Styles
 *
 * Recipient view: amber/yellow bubble with sender attribution.
 * Sender view: normal user-message bubble (no overrides needed here).
 *
 * All selectors scoped to #chatMessages to prevent conflicts.
 */

/* ── Recipient bubble ─────────────────────────────────────────────────────── */

#chatMessages .internal-message-container {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: auto;
    max-width: 100%;
    position: relative;
    padding: 10px;
    margin: 5px 0;
    animation: fadeIn 0.3s ease-out;
}

#chatMessages .internal-message-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 75%;
}

#chatMessages .internal-message-bubble {
    max-width: 100%;
    color: var(--message-bot-color);
}

/* ── Sender meta (shown on recipient screen only) ─────────────────────────── */

#chatMessages .internal-message-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-left: 2px;
    color: #a9a7a6;
}

#chatMessages .internal-message-sender {
    font-size: 12px;
    font-weight: 600;
}

#chatMessages .internal-message-timestamp {
    font-size: 11px;
    font-weight: 500;
}

/* ── Message content ─────────────────────────────────────────────────────── */

#chatMessages .internal-message-content {
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* ── @mention name: blue for others, red for the pinged user themselves ───── */

.mention-name {
    color: #2563eb !important;
    font-weight: 500;
}

/* Red highlight when the current viewer is the pinged user */
.mention-name--self {
    color: #dc2626 !important;
    font-weight: 600;
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */

body.dark-theme #chatMessages .internal-message-bubble,
[data-theme="dark"] #chatMessages .internal-message-bubble {
    background: #422006;
    border: 1px solid #713f12;
    color: var(--message-bot-color);
}

body.dark-theme .mention-name,
[data-theme="dark"] .mention-name {
    color: #60a5fa !important;
}

body.dark-theme .mention-name--self,
[data-theme="dark"] .mention-name--self {
    color: #f87171 !important;
}

/* ── Session sidebar @mention unread badge ─────────────────────────────── */

#sessionsList .session-item .session-mention-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #d97706;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 0 0 2px var(--background-color, #fff);
}

/* Make the session-icon relative so the badge can position against it */
#sessionsList .session-item .session-icon {
    position: relative;
}

body.dark-theme #sessionsList .session-item .session-mention-badge,
[data-theme="dark"] #sessionsList .session-item .session-mention-badge {
    background: #f59e0b;
    color: #1a1a1a;
    box-shadow: 0 0 0 2px var(--background-color, #1f2937);
}
