/* Messenger - Facebook Messenger-style unified message interface */

.messenger-container {
    display: flex;
    height: calc(100vh - 150px);
    min-height: 500px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Conversations sidebar */
.conversations-sidebar {
    width: 360px;

    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.conversations-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.conversations-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.conversations-search {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.conversations-search input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    background: #f0f2f5;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

/* Conversation items */
.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.conversation-item:hover {
    background: #f8f9fa;
}

.conversation-item.active {
    background: #e8f0fe;
    border-left: 4px solid #667eea;
}

.conversation-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.conversation-name {
    font-weight: 600;
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 4px;
}

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

.conversation-preview.unread {
    font-weight: 600;
    color: #2d3748;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 8px;
}

.conversation-time {
    font-size: 12px;
    color: #65676b;
    margin-bottom: 4px;
}

.unread-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

/* Messages area */
.messages-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.messages-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    background: #f8f9fa;
}

.messages-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
}

.messages-header-info h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #2d3748;
}

.messages-header-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.messages-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message-group {
    margin-bottom: 20px;
}

.message-date-divider {
    text-align: center;
    margin: 20px 0;
    font-size: 13px;
    color: #65676b;
}

/* Message bubbles */
.message-bubble {
    max-width: 60%;
    margin-bottom: 4px;
    display: flex;
    flex-direction: column;
}

.message-bubble.sent {
    margin-left: auto;
    align-items: flex-end;
}

.message-bubble.received {
    margin-right: auto;
    align-items: flex-start;
}

.message-content {
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 15px;
    word-wrap: break-word;
}

.message-bubble.sent .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-bubble.received .message-content {
    background: #e4e6eb;
    color: #2d3748;
}

.message-time {
    font-size: 11px;
    color: #65676b;
    margin-top: 4px;
    padding: 0 8px;
}

.message-subject {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 13px;
    padding: 0 8px;
}

/* Message input */
.messages-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.message-compose-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.message-compose-form textarea {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 15px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
}

.message-compose-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-send:hover {
    transform: scale(1.1);
}

.btn-send:active {
    transform: scale(0.95);
}

/* Empty state - reused across messenger and private chat */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #65676b;
    text-align: center;
    padding: 40px;
}

.empty-state i {
    font-size: 64px;
    color: #e0e0e0;
    margin-bottom: 16px;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: #2d3748;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .messenger-container {
        height: calc(100vh - 120px);
    }

    .conversations-sidebar {
        width: 100%;
    }

    .messages-area {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
    }

    .messages-area.mobile-active {
        display: flex;
    }

    .conversations-sidebar.mobile-hidden {
        display: none;
    }

    .message-bubble {
        max-width: 80%;
    }
}

