/* Messages - Inbox & Archive */
.message-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: background-color 0.15s;
}

.message-list-item:hover {
    background-color: var(--color-bg);
}

.message-list-item.unread {
    background-color: #eff6ff;
    border-left: 3px solid var(--color-primary);
}

.message-list-item .partner-name {
    font-weight: 600;
    min-width: 150px;
}

.message-list-item .preview {
    flex: 1;
    color: var(--color-text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-list-item .time {
    color: var(--color-text-light);
    font-size: 0.85rem;
    white-space: nowrap;
}

.message-list-item .unread-badge {
    background-color: var(--color-primary);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Thread / Chat View */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md);
    max-height: 60vh;
    overflow-y: auto;
}

.chat-bubble {
    max-width: 70%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    position: relative;
}

.chat-bubble.sent {
    align-self: flex-end;
    background-color: var(--color-primary);
    color: white;
}

.chat-bubble.received {
    align-self: flex-start;
    background-color: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.chat-bubble .chat-meta {
    font-size: 0.75rem;
    margin-top: var(--space-xs);
    opacity: 0.7;
}

.chat-bubble .chat-attachments {
    margin-top: var(--space-xs);
    font-size: 0.85rem;
}

.chat-bubble .chat-attachments a {
    color: inherit;
    text-decoration: underline;
}

.chat-bubble.sent .chat-attachments a {
    color: white;
}

/* Reply Form */
.chat-reply-form {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.chat-reply-form textarea {
    flex: 1;
    resize: none;
    min-height: 60px;
}

/* Compose */
.compose-toggle {
    margin-bottom: var(--space-md);
}

/* Message nav badge */
.message-badge {
    background-color: var(--color-primary);
    color: white;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 4px;
    vertical-align: middle;
}

/* Dashboard message preview */
.message-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.message-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
}

.message-preview-item:last-child {
    border-bottom: none;
}

.message-preview-item .sender {
    font-weight: 600;
}

.message-preview-item .preview-text {
    color: var(--color-text-light);
    font-size: 0.85rem;
}

.message-preview-item .preview-time {
    color: var(--color-text-light);
    font-size: 0.8rem;
    white-space: nowrap;
}
