/*
 * Split from chat.css.
 * Do not patch-stack random chat styles here.
 * Keep selectors grouped by purpose.
 */

.messages-list {
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
    padding: 6px 0 14px;
    border: 0;
    background: transparent;
    box-shadow: none;
    scrollbar-width: thin;
}

.messages-list::before {
    content: "";
    margin-top: auto;
}

.message-bubble {
    max-width: 78%;
    flex: 0 0 auto;
    padding: 10px 13px;
    border-radius: 18px;
    background: var(--surface);
    border: 0;
    box-shadow: 0 10px 28px var(--shadow);
}

.message-bubble.is-own {
    align-self: flex-end;
    color: #ffffff;
    background: var(--button-gradient);
    border-color: transparent;
}

.message-bubble:not(.is-own) {
    align-self: flex-start;
}

.message-bubble p {
    margin: 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.message-bubble time {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    opacity: 0.75;
}

.message-bubble {
    position: relative;
    border-radius: 20px 20px 20px 8px;
}

.message-bubble.is-own {
    border-radius: 20px 20px 8px 20px;
}

.message-status {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: -2px;
}

.message-status.is-read {
    color: #22c55e;
}

.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.reaction-pill {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(127, 195, 255, 0.16);
    font-size: 13px;
    line-height: 1;
}

.reaction-pill strong {
    font-size: 11px;
    font-weight: 900;
}

.reaction-pill.is-mine {
    background: rgba(34, 197, 94, 0.22);
}

.message-bubble.is-options-target {
    outline: 2px solid rgba(127, 195, 255, 0.45);
    outline-offset: 3px;
}

.message-bubble {
    user-select: none;
}

.message-bubble.is-options-target {
    outline: 2px solid rgba(127, 195, 255, 0.45);
    outline-offset: 3px;
}

.message-bubble.is-reply-target {
    outline: 2px solid rgba(127, 195, 255, 0.38);
    outline-offset: 3px;
}

.message-bubble.is-jump-highlight {
    animation: replyJumpHighlight 0.9s ease-in-out;
}

/* Consolidated chat bubble contrast rules */
html[data-theme="light"] .message-bubble:not(.is-own) {
    color: #0f172a;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.10);
}

html[data-theme="dark"] .message-bubble:not(.is-own) {
    color: #07111f;
    background: #d9efff;
}

.message-bubble:not(.is-own) .inline-reply-preview {
    border-left-color: #0f172a;
}

.message-bubble.is-own {
    color: #ffffff;
}

.message-bubble.is-own .inline-reply-preview {
    border-left-color: rgba(255, 255, 255, 0.95) !important;
}

.message-bubble.is-own .inline-reply-preview span {
    opacity: 0.88;
}

.message-status.is-read,
.message-bubble.is-own .message-status.is-read {
    color: #22c55e !important;
}

.message-translation {
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(127, 195, 255, 0.12);
}

.message-translation strong,
.message-translation p {
    margin: 0;
}

.message-translation strong {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.message-translation p {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.45;
}


.message-sender-name {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
}

.message-bubble.is-pending-message {
    opacity: 0.82;
}

.message-bubble.is-failed-message {
    outline: 2px solid rgba(239, 68, 68, 0.55);
    outline-offset: 2px;
}

.message-status.is-sending {
    letter-spacing: 0;
    opacity: 0.85;
}

.message-status.is-failed {
    color: #fecaca !important;
    letter-spacing: 0;
}

.message-retry-area {
    display: block;
    margin-top: 6px;
}

.message-retry-button {
    border: 0;
    border-radius: 999px;
    padding: 5px 9px;
    color: #ffffff;
    background: rgba(239, 68, 68, 0.9);
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
}
