/**
 * Facebook Messenger-Style Chat System
 * - Header chat icon with notification badge
 * - Dropdown conversation list panel
 * - Individual chat popup windows
 */

/* ============================================
   HEADER CHAT ICON
   ============================================ */
.messenger-header-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.messenger-header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #334155;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

/* Mobile Floating Action Button Style */
.mobile-fab .messenger-header-btn {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: fabPulse 3s ease-in-out infinite;
}

.mobile-fab .messenger-header-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(34, 197, 94, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.mobile-fab .messenger-icon {
    width: 26px;
    height: 26px;
    stroke-width: 2.5;
}

@keyframes fabPulse {
    0%, 100% { 
        box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    50% { 
        box-shadow: 0 4px 30px rgba(34, 197, 94, 0.6), 0 2px 12px rgba(0, 0, 0, 0.4);
    }
}

.messenger-header-btn:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    color: #22c55e;
    transform: scale(1.05);
    border-color: #22c55e;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.messenger-header-btn.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-color: #22c55e;
}

/* Icon wrapper for animations */
.messenger-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.messenger-icon {
    transition: all 0.3s ease;
}

.messenger-header-btn:hover .messenger-icon {
    transform: rotate(-10deg) scale(1.1);
}

/* Activity dots - hidden by default, shown when typing or new message */
.messenger-activity-dots {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 2px;
}

.messenger-activity-dots .dot {
    width: 3px;
    height: 3px;
    background: #22c55e;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.messenger-activity-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.messenger-activity-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-3px); opacity: 1; }
}

/* Show dots when someone is typing */
.messenger-header-btn.typing .messenger-activity-dots {
    display: flex;
}

/* Unread message animation - subtle pulse glow */
.messenger-header-btn.has-unread {
    animation: unreadPulse 2s ease-in-out infinite;
}

.messenger-header-btn.has-unread .messenger-icon {
    color: #22c55e;
}

@keyframes unreadPulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

/* Mobile FAB with unread - brighter glow */
.mobile-fab .messenger-header-btn.has-unread {
    animation: unreadPulseMobile 2s ease-in-out infinite;
}

@keyframes unreadPulseMobile {
    0%, 100% { 
        box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4), 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    50% { 
        box-shadow: 0 4px 30px rgba(34, 197, 94, 0.6), 0 0 0 12px rgba(34, 197, 94, 0);
    }
}

/* New message notification - bounce + ring animation */
.messenger-header-btn.new-message {
    animation: newMessageBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.messenger-header-btn.new-message::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #22c55e;
    animation: ring 1s ease-out forwards;
    pointer-events: none;
}

@keyframes newMessageBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.2); }
    50% { transform: scale(0.9); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes ring {
    0% { 
        transform: scale(1);
        opacity: 1;
    }
    100% { 
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Pulse effect for ongoing activity */
.messenger-header-btn.has-activity::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.3);
    animation: pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 0;
    }
    50% { 
        transform: scale(1.2);
        opacity: 0.5;
    }
}

/* Badge styles */
.messenger-header-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #0f172a;
    animation: badgePop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
}

.messenger-header-badge.hidden {
    display: none;
}

@keyframes badgePop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Badge pulse when count increases */
.messenger-header-badge.updated {
    animation: badgePulse 0.6s ease-in-out;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}


/* ============================================
   CONVERSATIONS DROPDOWN PANEL
   ============================================ */
.messenger-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 360px;
    max-height: 520px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #334155;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messenger-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Header */
.messenger-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #334155;
}

.messenger-dropdown-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.messenger-dropdown-close {
    display: none;
}

.messenger-dropdown-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin: 0;
}

.messenger-dropdown-actions {
    display: flex;
    gap: 4px;
}

.messenger-dropdown-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #334155;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.messenger-dropdown-action:hover {
    background: #475569;
    color: white;
}

/* Dropdown Tabs */
.messenger-dropdown-tabs {
    display: flex;
    padding: 8px 12px;
    gap: 4px;
    border-bottom: 1px solid #334155;
    background: rgba(0, 0, 0, 0.1);
}

.messenger-dropdown-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 20px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.messenger-dropdown-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.messenger-dropdown-tab.active {
    background: #334155;
    color: white;
}

.messenger-dropdown-tab-badge {
    min-width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Dropdown Search */
.messenger-dropdown-search {
    padding: 12px;
    border-bottom: 1px solid #334155;
}

.messenger-dropdown-search input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 10px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.messenger-dropdown-search input:focus {
    border-color: #22c55e;
}

.messenger-dropdown-search input::placeholder {
    color: #64748b;
}

/* Dropdown List */
.messenger-dropdown-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.messenger-dropdown-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.messenger-dropdown-empty svg {
    width: 48px;
    height: 48px;
    color: #475569;
    margin-bottom: 16px;
}

.messenger-dropdown-empty p {
    color: #64748b;
    font-size: 14px;
    margin: 0 0 16px;
}

.messenger-dropdown-empty button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.messenger-dropdown-empty button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Conversation Item */
.messenger-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.messenger-conv-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.messenger-conv-item.unread {
    background: rgba(34, 197, 94, 0.05);
}

.messenger-conv-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.messenger-conv-avatar span {
    font-size: 16px;
    font-weight: 600;
    color: #94a3b8;
}

.messenger-conv-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.messenger-conv-online {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #0f172a;
}

.messenger-conv-content {
    flex: 1;
    min-width: 0;
}

.messenger-conv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.messenger-conv-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messenger-conv-item.unread .messenger-conv-name {
    color: #22c55e;
}

.messenger-conv-time {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

.messenger-conv-item.unread .messenger-conv-time {
    color: #22c55e;
}

.messenger-conv-preview {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messenger-conv-item.unread .messenger-conv-preview {
    color: #94a3b8;
    font-weight: 500;
}

.messenger-conv-unread {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Dropdown Footer */
.messenger-dropdown-footer {
    padding: 12px;
    border-top: 1px solid #334155;
    text-align: center;
}

.messenger-dropdown-footer a {
    color: #22c55e;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.messenger-dropdown-footer a:hover {
    color: #16a34a;
}


/* ============================================
   CHAT POPUP WINDOWS (Bottom-Right)
   ============================================ */
.messenger-popups-container {
    position: fixed;
    bottom: 0;
    right: 24px;
    display: flex;
    flex-direction: row-reverse;
    gap: 12px;
    z-index: 9998;
    pointer-events: none;
}

.messenger-popup {
    width: 340px;
    height: 455px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #334155;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    transition: all 0.3s ease;
}

.messenger-popup.minimized {
    height: 50px;
}

.messenger-popup.minimized .messenger-popup-body,
.messenger-popup.minimized .messenger-popup-input {
    display: none;
}

/* Popup Header */
.messenger-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #334155;
    cursor: pointer;
}

.messenger-popup-header:hover {
    background: rgba(0, 0, 0, 0.4);
}

.messenger-popup-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.messenger-popup-avatar span {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

.messenger-popup-avatar-online {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #1e293b;
}

.messenger-popup-info {
    flex: 1;
    min-width: 0;
}

.messenger-popup-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messenger-popup-status {
    font-size: 11px;
    color: #22c55e;
}

.messenger-popup-actions {
    display: flex;
    gap: 4px;
}

.messenger-popup-action {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.messenger-popup-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.messenger-popup-action.close:hover {
    color: #ef4444;
}

/* Popup Body - Messages */
.messenger-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Message Bubbles */
.messenger-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.messenger-msg.sent {
    align-self: flex-end;
}

.messenger-msg.received {
    align-self: flex-start;
}

.messenger-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.messenger-msg.received .messenger-msg-row {
    flex-direction: row;
}

.messenger-msg.sent .messenger-msg-row {
    flex-direction: row-reverse;
}

.messenger-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 18px;
}

.messenger-msg-avatar span {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
}

.messenger-msg.sent .messenger-msg-avatar {
    display: none;
}

.messenger-msg-bubble {
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.messenger-msg.sent .messenger-msg-bubble {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.messenger-msg.received .messenger-msg-bubble {
    background: #334155;
    color: #e2e8f0;
    border-bottom-left-radius: 4px;
}

.messenger-msg-time {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
    padding: 0 8px;
}

.messenger-msg.sent .messenger-msg-time {
    text-align: right;
}

/* Typing Indicator */
.messenger-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    align-self: flex-start;
}

.messenger-typing-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
}

.messenger-typing-avatar span {
    font-size: 10px;
    font-weight: 600;
    color: #94a3b8;
}

.messenger-typing-bubble {
    background: #334155;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
}

.messenger-typing-dot {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.messenger-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.messenger-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Popup Input */
.messenger-popup-input {
    padding: 12px;
    border-top: 1px solid #334155;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.messenger-popup-input-tools {
    display: flex;
    gap: 4px;
}

.messenger-popup-input-tool {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #22c55e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.messenger-popup-input-tool:hover {
    background: rgba(34, 197, 94, 0.1);
}

.messenger-popup-input-field {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 8px 14px;
    color: white;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 36px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}

.messenger-popup-input-field:focus {
    border-color: #22c55e;
}

.messenger-popup-input-field::placeholder {
    color: #64748b;
}

.messenger-popup-send {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.messenger-popup-send:hover {
    transform: scale(1.05);
}

.messenger-popup-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   FILE UPLOAD PREVIEW
   ============================================ */
.messenger-popup-file-preview {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-preview-list {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    max-width: 200px;
}

.file-preview-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.file-preview-name {
    font-size: 12px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 10px;
    color: #64748b;
}

.file-preview-remove {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.file-preview-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.file-preview-clear {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.file-preview-clear:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ============================================
   FILE ATTACHMENTS IN MESSAGES
   ============================================ */
.messenger-msg-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.messenger-msg-attachments {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.messenger-msg-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #334155;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
    max-width: 220px;
}

.messenger-msg-file:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: #22c55e;
}

.messenger-msg-file-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.messenger-msg-file-name {
    font-size: 12px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.messenger-msg-file-size {
    font-size: 10px;
    color: #64748b;
}

.messenger-msg-file-download {
    flex-shrink: 0;
    color: #64748b;
    transition: color 0.2s;
}

.messenger-msg-file:hover .messenger-msg-file-download {
    color: #22c55e;
}


/* ============================================
   MINIMIZED CHAT BAR (Bottom Bar)
   ============================================ */
.messenger-bar {
    position: fixed;
    bottom: 0;
    right: 80px;
    display: flex;
    gap: 4px;
    z-index: 9997;
}

.messenger-bar-item {
    width: 48px;
    height: 48px;
    border-radius: 50% 50% 0 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-bottom: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
}

.messenger-bar-item:hover {
    background: #334155;
}

.messenger-bar-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
}

.messenger-bar-item-avatar span {
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.messenger-bar-item-online {
    position: absolute;
    bottom: 8px;
    right: 4px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #1e293b;
}

.messenger-bar-item-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    background: #ef4444;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.messenger-bar-item-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #475569;
    border: none;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.messenger-bar-item:hover .messenger-bar-item-close {
    display: flex;
}


/* ============================================
   SCROLLBAR
   ============================================ */
.messenger-dropdown-list::-webkit-scrollbar,
.messenger-popup-body::-webkit-scrollbar {
    width: 6px;
}

.messenger-dropdown-list::-webkit-scrollbar-track,
.messenger-popup-body::-webkit-scrollbar-track {
    background: transparent;
}

.messenger-dropdown-list::-webkit-scrollbar-thumb,
.messenger-popup-body::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.messenger-dropdown-list::-webkit-scrollbar-thumb:hover,
.messenger-popup-body::-webkit-scrollbar-thumb:hover {
    background: #475569;
}


/* ============================================
   SOUND TOGGLE & TYPING INDICATOR
   ============================================ */
.messenger-sound-toggle {
    position: relative;
}

.messenger-sound-toggle.muted svg {
    opacity: 0.4;
}

.messenger-sound-toggle.muted::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 2px;
    background: #ef4444;
    transform: translate(-50%, -50%) rotate(-45deg);
    border-radius: 1px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 8px 12px;
    margin: 4px 0;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
    animation: typingFade 1.5s ease-in-out infinite;
}

@keyframes typingFade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Real-time update indicator */
.messenger-conv-item.updating {
    opacity: 0.7;
}

.messenger-conv-item.new-message {
    animation: newMessageHighlight 2s ease-out;
}

@keyframes newMessageHighlight {
    0% { background: rgba(34, 197, 94, 0.2); }
    100% { background: transparent; }
}


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    /* Mobile dropdown - smaller popup above FAB */
    .messenger-dropdown {
        position: fixed;
        bottom: 90px;
        right: 16px;
        top: auto;
        left: auto;
        width: calc(100vw - 32px);
        max-width: 360px;
        max-height: 70vh;
        border-radius: 16px;
    }
}
    
    .messenger-popups-container {
        right: 16px;
        bottom: 90px;
        left: auto;
    }
    
    .messenger-popup {
        width: calc(100vw - 32px);
        max-width: 340px;
        height: 60vh;
        max-height: 450px;
        border-radius: 16px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    }
    
    .messenger-popup-header {
        border-radius: 16px 16px 0 0;
    }
    
    .messenger-bar {
        display: none;
    }
}

