/* ==========================================================================
   Chat & Messaging Styles — Linear / Slack Dark Theme System
   ========================================================================== */

.chat-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: var(--bg-app);
}

/* --------------------------------------------------------------------------
   Conversation Sidebar (320px width, --bg-sidebar)
   -------------------------------------------------------------------------- */
.conv-sidebar {
    width: 320px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    overflow: hidden;
    transition: background var(--ease-normal), border-color var(--ease-normal);
}

/* Sidebar Header & Search Section */
.conv-sidebar-header {
    padding: var(--space-16) var(--space-16) var(--space-12) var(--space-16);
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.conv-sidebar-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.conv-sidebar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.conv-sidebar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Pill Search Bar */
.conv-search-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 7px 14px;
    gap: var(--space-8);
    transition: all var(--ease-normal);
}
.conv-search-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    background: var(--bg-surface);
}

.conv-search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.conv-search-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
}

.conv-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
}
.conv-search-input::placeholder {
    color: var(--text-muted);
}

/* Optional Quick Stories Row in Sidebar */
.conv-stories-strip {
    display: flex;
    gap: var(--space-12);
    overflow-x: auto;
    padding: var(--space-8) var(--space-16) var(--space-12) var(--space-16);
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.conv-stories-strip::-webkit-scrollbar {
    display: none;
}

.conv-story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    width: 52px;
}
.conv-story-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 2px;
    background: var(--grad-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--ease-normal);
}
.conv-story-item:hover .conv-story-avatar-wrap {
    transform: scale(1.05);
}
.conv-story-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
    background: var(--bg-surface-2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.conv-story-item.seen .conv-story-avatar-wrap {
    background: var(--border-strong);
}
.conv-story-name {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* --------------------------------------------------------------------------
   Conversation List Items (72px tall rows, 8px radius)
   -------------------------------------------------------------------------- */
.conv-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: var(--space-8) var(--space-8) var(--space-16) var(--space-8);
    gap: 2px;
}

.conv-card {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    height: 72px;
    padding: 0 var(--space-12);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--ease-normal);
    position: relative;
    user-select: none;
    border: 1px solid transparent;
}
.conv-card:hover {
    background: rgba(26, 36, 56, 0.4);
}
[data-theme="light"] .conv-card:hover {
    background: rgba(238, 242, 248, 0.7);
}

/* Selected Conversation State */
.conv-card.active {
    background: var(--grad-surface);
    border-left: 2px solid var(--accent);
    box-shadow: inset 0 0 0 1px var(--border);
}

/* Avatar with Online Indicator */
.conv-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}
.conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--grad-avatar);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    overflow: hidden;
}

.conv-online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--success);
    border: 2px solid var(--bg-sidebar);
    border-radius: 50%;
}

/* Conversation Text Stack */
.conv-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}

.conv-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.conv-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.conv-card-time {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
    margin-left: var(--space-8);
}

.conv-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conv-card-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Unread State */
.conv-card.unread .conv-card-title {
    font-weight: 700;
    color: var(--text-primary);
}
.conv-card.unread .conv-card-preview {
    color: var(--text-primary);
    font-weight: 500;
}
.conv-card-unread-badge {
    background: var(--grad-brand);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: 6px;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

/* Pin Icon */
.conv-pin-icon {
    width: 13px;
    height: 13px;
    color: var(--text-muted);
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
}
.conv-pin-icon svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
}

/* --------------------------------------------------------------------------
   Chat Window (Active Conversation Feed)
   -------------------------------------------------------------------------- */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-app);
    position: relative;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    height: 64px;
    padding: 0 var(--space-24);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: var(--z-header);
    flex-shrink: 0;
}

.chat-header-user {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    cursor: pointer;
}
.chat-header-user .conv-avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
}
.chat-header-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.chat-header-status {
    font-size: 12px;
    color: var(--success);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-header-status.offline {
    color: var(--text-muted);
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

/* --------------------------------------------------------------------------
   Messages Feed & Bubbles
   -------------------------------------------------------------------------- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-24);
    display: flex;
    flex-direction: column;
    gap: 12px; /* 12px between different senders */
    background: var(--bg-app);
}

.msg-row {
    display: flex;
    flex-direction: column;
    max-width: 65%;
    position: relative;
    animation: fadeIn var(--ease-normal) forwards;
}
.msg-row.outgoing {
    align-self: flex-end;
    align-items: flex-end;
}
.msg-row.incoming {
    align-self: flex-start;
    align-items: flex-start;
}

/* Consecutive same-sender bubbles */
.msg-row + .msg-row.same-sender {
    margin-top: -10px; /* tighten to 2px */
}

.msg-sender-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-violet);
    margin-bottom: 3px;
    padding-left: 8px;
}

.msg-bubble {
    padding: 10px 14px;
    font-size: 14.5px;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Sent Bubble: --grad-brand background, white text, 16px radius with 4px tail */
.msg-row.outgoing .msg-bubble {
    background: var(--grad-brand);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

/* Received Bubble: --bg-surface-2 background, text-primary, 16px radius with 4px tail */
.msg-row.incoming .msg-bubble {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 16px 16px 16px 4px;
}

.msg-reply-snippet {
    background: rgba(0, 0, 0, 0.18);
    border-left: 3px solid #ffffff;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 12px;
    opacity: 0.9;
}
.msg-row.incoming .msg-reply-snippet {
    background: rgba(0, 0, 0, 0.08);
    border-left: 3px solid var(--accent);
}

/* Attachment Container & Download Button */
.msg-attachment-wrap {
    position: relative;
    display: inline-block;
    max-width: 280px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.msg-attachment-img {
    max-width: 280px;
    max-height: 240px;
    width: 100%;
    display: block;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
}

.attachment-download-overlay-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    transition: all 180ms ease;
    opacity: 0.92;
    z-index: 5;
}
.attachment-download-overlay-btn:hover {
    background: rgba(37, 99, 235, 0.95);
    border-color: rgba(255, 255, 255, 0.4);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.4);
}

/* Document & File Attachment Card */
.msg-file-attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.14);
    margin-bottom: 6px;
    min-width: 220px;
    max-width: 280px;
}
.msg-row.incoming .msg-file-attachment-card {
    background: var(--bg-hover);
    border-color: var(--border);
}

.file-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.25);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.msg-row.outgoing .file-icon-box {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.file-info-box {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.file-info-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info-sub {
    font-size: 11px;
    opacity: 0.75;
}

.file-download-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 160ms ease;
    flex-shrink: 0;
}
.file-download-action-btn:hover {
    background: #ffffff;
    color: #0f172a;
    transform: scale(1.08);
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    align-self: flex-end;
    font-size: 11px;
    opacity: 0.75;
    margin-top: 4px;
}
.msg-row.outgoing .msg-meta {
    color: rgba(255, 255, 255, 0.85);
}
.msg-row.incoming .msg-meta {
    color: var(--text-muted);
}

/* Message Reactions */
.msg-reactions {
    display: flex;
    gap: 4px;
    margin-top: -6px;
    margin-left: 8px;
    z-index: 10;
}
.reaction-pill {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    transition: transform var(--ease-normal);
}
.reaction-pill:hover {
    transform: scale(1.1);
}

.msg-deleted-placeholder {
    font-style: italic;
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Typing Indicator */
.typing-indicator {
    padding: 4px var(--space-24);
    font-size: 12px;
    color: var(--accent);
    font-style: italic;
    min-height: 20px;
}

/* --------------------------------------------------------------------------
   Message Composer (Pill / 12px container at bottom)
   -------------------------------------------------------------------------- */
.chat-composer {
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    padding: var(--space-12) var(--space-24);
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    z-index: var(--z-header);
}

.composer-reply-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    border-left: 3px solid var(--accent);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin-bottom: 6px;
}

/* Attachment Preview Bar before sending */
.composer-attachment-bar {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 8px;
    animation: menuFadeIn 150ms ease-out;
}

.attachment-preview-box {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.attachment-thumbnail-wrap {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.attachment-thumbnail-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    flex: 1;
}

.attachment-filename {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-filesize {
    font-size: 11px;
    color: var(--text-muted);
}

.attachment-remove-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 140ms ease;
    flex-shrink: 0;
    margin-left: auto;
}

.attachment-remove-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    color: #ef4444;
    transform: scale(1.1);
}

.composer-row {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 4px 8px 4px 14px;
    transition: border-color var(--ease-normal), box-shadow var(--ease-normal);
}
.composer-row:focus-within {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

.composer-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    padding: 6px 0;
}
.composer-input::placeholder {
    color: var(--text-muted);
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Send Button: 36px circle with --grad-brand background, subtle glow on hover */
.btn-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--grad-brand);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    outline: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transition: transform var(--ease-normal), box-shadow var(--ease-normal);
    flex-shrink: 0;
}
.btn-send:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}
.btn-send svg {
    width: 17px;
    height: 17px;
    stroke: #ffffff;
    stroke-width: 2;
    fill: none;
    margin-left: 1px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .conv-sidebar {
        width: 100%;
    }
    .chat-window {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        display: none;
    }
    .chat-window.mobile-active {
        display: flex;
    }
}

/* --------------------------------------------------------------------------
   Floating Context Menu & Message Action Bars (Reactions & Replies)
   -------------------------------------------------------------------------- */
.msg-row {
    position: relative;
}

.msg-bubble-wrap {
    position: relative;
    display: inline-flex;
    flex-direction: column;
}

.msg-actions {
    position: absolute;
    top: -16px;
    display: none;
    align-items: center;
    gap: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    padding: 3px 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    z-index: 100;
}
.msg-row.outgoing .msg-actions {
    right: 8px;
}
.msg-row.incoming .msg-actions {
    left: 8px;
}
.msg-row:hover .msg-actions,
.msg-row:focus-within .msg-actions {
    display: flex;
}

.msg-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--ease-fast);
}
.msg-action-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-2);
    transform: scale(1.15);
}

/* Floating Context Menu */
.context-menu {
    position: fixed !important;
    z-index: 10000 !important;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.1) !important;
    padding: 6px !important;
    min-width: 170px !important;
    backdrop-filter: blur(16px) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    animation: menuFadeIn 150ms ease-out;
}

.context-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    user-select: none !important;
    transition: all 120ms ease !important;
}
.context-item:hover {
    background: var(--bg-surface-2) !important;
    color: #ffffff !important;
}
.context-item.danger {
    color: var(--danger) !important;
}
.context-item.danger:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--danger) !important;
}

/* Floating Emoji Picker Popover */
.emoji-picker-popover {
    position: fixed !important;
    z-index: 10001 !important;
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 22px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 1px rgba(255, 255, 255, 0.2) !important;
    padding: 14px 16px !important;
    display: grid !important;
    grid-template-columns: repeat(6, 42px) !important;
    gap: 8px !important;
    width: 320px !important;
    box-sizing: border-box !important;
    backdrop-filter: blur(24px) !important;
    animation: menuFadeIn 150ms ease-out;
}

.emoji-picker-btn {
    border: none !important;
    background: transparent !important;
    font-size: 22px !important;
    width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 120ms ease !important;
    line-height: 1 !important;
}
.emoji-picker-btn:hover {
    background: var(--bg-surface-2) !important;
    transform: scale(1.22) !important;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Archived Badge in Conversation Card */
.conv-archived-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    border: 1px solid var(--border);
    display: inline-block;
    vertical-align: middle;
}

/* Chat Header and Incoming Message Sender Interactive Profiles */
#active-chat-avatar-wrap:hover .conv-avatar {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}
.chat-header-user:hover .chat-header-title {
    color: var(--accent);
}
.msg-sender-header:hover .msg-sender-name {
    text-decoration: underline;
    color: var(--accent-light, #60a5fa);
}
.msg-sender-header:hover .msg-sender-mini-avatar {
    transform: scale(1.15);
}

/* --------------------------------------------------------------------------
   Flowy Quick Reactions Dock on Message Hover
   -------------------------------------------------------------------------- */
.msg-quick-react-dock {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 4px;
    border-right: 1px solid var(--border);
    margin-right: 3px;
}
.quick-react-emoji {
    font-size: 15px;
    cursor: pointer;
    padding: 2px 3px;
    border-radius: 6px;
    line-height: 1;
    transition: transform 160ms cubic-bezier(0.175, 0.885, 0.32, 1.275), background 120ms ease;
    user-select: none;
}
.quick-react-emoji:hover {
    transform: scale(1.4) translateY(-3px);
    background: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   Pinned Message Banner
   -------------------------------------------------------------------------- */
.chat-pinned-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(22, 30, 48, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    z-index: 10;
    animation: slideDownPinned 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDownPinned {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.pinned-banner-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pinned-banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.pinned-banner-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}
.pinned-banner-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-bubble.highlight-pinned {
    animation: pinnedFlash 2s ease-out;
}
@keyframes pinnedFlash {
    0%, 100% { box-shadow: none; }
    20%, 60% { box-shadow: 0 0 28px rgba(139, 92, 246, 0.8), 0 0 8px #3b82f6; }
}

/* --------------------------------------------------------------------------
   Voice Note Recording Bar & Audio Waveform Player
   -------------------------------------------------------------------------- */
.voice-recording-bar {
    position: absolute;
    inset: 6px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 14px;
    z-index: 20;
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
    animation: fadeIn 150ms ease-out;
}
.voice-recording-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 rgba(239, 68, 68, 0.6);
    animation: recordPulse 1.2s infinite;
    flex-shrink: 0;
}
@keyframes recordPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.voice-recording-timer {
    font-family: var(--font-mono);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--danger);
}
.voice-wave-anim {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 24px;
}
.voice-wave-anim span {
    width: 3px;
    height: 10px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--danger), var(--accent));
    animation: waveBounce 0.8s ease-in-out infinite alternate;
}
.voice-wave-anim span:nth-child(2) { animation-delay: 0.1s; height: 16px; }
.voice-wave-anim span:nth-child(3) { animation-delay: 0.2s; height: 22px; }
.voice-wave-anim span:nth-child(4) { animation-delay: 0.3s; height: 12px; }
.voice-wave-anim span:nth-child(5) { animation-delay: 0.4s; height: 18px; }
.voice-wave-anim span:nth-child(6) { animation-delay: 0.2s; height: 14px; }
.voice-wave-anim span:nth-child(7) { animation-delay: 0.5s; height: 8px; }
.voice-wave-anim span:nth-child(8) { animation-delay: 0.15s; height: 16px; }

@keyframes waveBounce {
    0% { transform: scaleY(0.4); opacity: 0.5; }
    100% { transform: scaleY(1.3); opacity: 1; }
}

/* Audio Voice Message Bubble Player */
.msg-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 2px;
    min-width: 220px;
}
.audio-play-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #ffffff;
    color: #1e1b4b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 120ms ease, background 120ms ease;
}
.msg-row.incoming .audio-play-btn {
    background: var(--accent);
    color: #ffffff;
}
.audio-play-btn:hover {
    transform: scale(1.08);
}
.audio-waveform-track {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 28px;
    cursor: pointer;
    position: relative;
}
.audio-wave-bar {
    width: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.4);
    transition: height 120ms ease, background 120ms ease;
}
.msg-row.incoming .audio-wave-bar {
    background: rgba(255, 255, 255, 0.25);
}
.audio-waveform-track.playing .audio-wave-bar {
    animation: barPlay 0.9s ease-in-out infinite alternate;
}
.audio-waveform-track.playing .audio-wave-bar:nth-child(odd) {
    animation-delay: 0.15s;
}
@keyframes barPlay {
    0% { opacity: 0.5; filter: brightness(0.8); }
    100% { opacity: 1; filter: brightness(1.4); }
}
.audio-wave-bar.active {
    background: #ffffff;
}
.msg-row.incoming .audio-wave-bar.active {
    background: var(--accent);
}
.audio-time-label {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}
.msg-row.incoming .audio-time-label {
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Flowy Rainbow Story Rings (Static, Elegant & Still)
   -------------------------------------------------------------------------- */
.conv-story-avatar-wrap.has-story {
    background: linear-gradient(135deg, #EC4899, #8B5CF6, #3B82F6) !important;
    padding: 2.5px;
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.25);
    transition: transform 180ms ease, box-shadow 180ms ease;
}
.conv-story-avatar-wrap.has-story .conv-story-avatar-inner {
    border: 2px solid var(--bg-app);
}
.conv-story-avatar-wrap.has-story:hover {
    box-shadow: 0 0 16px rgba(236, 72, 153, 0.45);
    transform: scale(1.06);
}
