/* Messaging System Styles */

/* Message List */
.message-list {
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.message-list-item {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background-color: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.message-list-item:hover {
    background-color: #f8f9fa;
}

.message-list-item.unread {
    background-color: #f0f7ff;
    border-left: 3px solid #0d6efd;
}

.message-list-item.active {
    background-color: #e9f2ff;
    border-left: 3px solid #0d6efd;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: #6c757d;
    font-weight: 600;
}

.message-avatar.buyer {
    background-color: #e3f2fd;
    color: #0d6efd;
}

.message-avatar.sales {
    background-color: #e8f5e9;
    color: #198754;
}

.message-avatar.admin {
    background-color: #fff3cd;
    color: #fd7e14;
}

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

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.message-sender {
    font-weight: 600;
    color: #212529;
    margin-right: 10px;
}

.message-time {
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
}

.message-subject {
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-preview {
    font-size: 0.875rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-indicators {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.message-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 5px;
}

.message-indicator.unread {
    background-color: #0d6efd;
}

.message-indicator.priority-high {
    background-color: #dc3545;
}

.message-indicator.attachment {
    background-color: #6c757d;
}

/* Message Thread */
.message-thread {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.thread-header {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thread-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.thread-actions {
    display: flex;
    gap: 10px;
}

.thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message-bubble {
    max-width: 80%;
    margin-bottom: 20px;
    position: relative;
}

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

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

.message-bubble-content {
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-bubble.sent .message-bubble-content {
    background-color: #e3f2fd;
    border-bottom-right-radius: 0;
}

.message-bubble.received .message-bubble-content {
    background-color: #f8f9fa;
    border-bottom-left-radius: 0;
}

.message-bubble-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.875rem;
}

.message-bubble-sender {
    font-weight: 600;
    color: #212529;
}

.message-bubble-time {
    color: #6c757d;
}

.message-bubble-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-bubble-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.75rem;
    color: #6c757d;
}

.message-attachments {
    margin-top: 10px;
}

.message-attachment {
    display: flex;
    align-items: center;
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 5px;
    margin-bottom: 5px;
}

.message-attachment-icon {
    margin-right: 10px;
    font-size: 1.25rem;
}

.message-attachment-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-attachment-actions {
    display: flex;
    gap: 5px;
}

/* Compose Message */
.compose-message {
    padding: 15px;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.compose-message-form {
    display: flex;
    flex-direction: column;
}

.compose-message-input {
    resize: none;
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    min-height: 100px;
}

.compose-message-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compose-message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.compose-attachment {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    font-size: 0.875rem;
}

.compose-attachment-name {
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.compose-attachment-remove {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    font-size: 0.875rem;
}

.compose-attachment-remove:hover {
    color: #dc3545;
}

/* Message Templates */
.template-selector {
    margin-bottom: 10px;
}

/* Message Search */
.message-search {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.message-search-form {
    display: flex;
    gap: 10px;
}

.message-search-input {
    flex: 1;
}

/* Message Filters */
.message-filters {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .message-bubble {
        max-width: 90%;
    }
    
    .thread-actions {
        flex-wrap: wrap;
    }
}
