/* Styling für das Messaging System */

/* Message Container */
.message-container {
    margin-bottom: 20px;
    position: relative;
}

.message-sent {
    padding-left: 10%;
}

.message-received {
    padding-right: 10%;
}

/* Message Header */
.sender-name {
    font-size: 0.9rem;
}

.message-time {
    font-size: 0.8rem;
}

/* Message Content */
.message-content {
    position: relative;
    word-wrap: break-word;
}

.message-sent .message-content {
    background-color: var(--primary-color, #0d6efd);
    color: #fff;
    border-radius: 15px 15px 0 15px;
}

.message-received .message-content {
    background-color: #f1f1f1;
    border-radius: 15px 15px 15px 0;
}

/* Attachments */
.message-attachment {
    margin-top: 8px;
}

.attachment-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    transition: background-color 0.2s;
}

.attachment-link:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.attachment-thumbnail {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.attachment-name {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

/* Message Actions */
.message-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-container:hover .message-actions {
    opacity: 1;
}

/* Status Icons */
.message-status i {
    font-size: 0.8rem;
}

/* Conversation List */
.conversations-list {
    list-style-type: none;
    padding: 0;
}

.conversation-item {
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.conversation-item.unread {
    border-left-color: var(--primary-color, #0d6efd);
    background-color: rgba(13, 110, 253, 0.05);
}

.conversation-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #6c757d;
}

.conversation-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.conversation-preview {
    color: #6c757d;
    font-size: 0.85rem;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Message input area */
.message-form {
    border-top: 1px solid #dee2e6;
    padding: 15px;
    background-color: #f8f9fa;
}

.message-input {
    resize: none;
    border-radius: 20px;
    padding-right: 70px;
}

.attachment-button {
    position: absolute;
    right: 60px;
    bottom: 8px;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    z-index: 5;
}

.send-button {
    position: absolute;
    right: 15px;
    bottom: 5px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* File upload */
.attachment-upload {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.attachment-upload input[type=file] {
    position: absolute;
    font-size: 100px;
    right: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

/* Upload preview */
.upload-preview {
    margin-top: 10px;
    padding: 10px;
    border: 1px dashed #dee2e6;
    border-radius: 5px;
}

.upload-preview-image {
    max-height: 100px;
    border-radius: 5px;
}

.upload-preview-file {
    display: flex;
    align-items: center;
}

.upload-preview-file i {
    margin-right: 10px;
    font-size: 24px;
}

.upload-preview-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Message search results */
.message-search-results mark {
    background-color: #ffe066;
    padding: 0 2px;
    border-radius: 2px;
}

/* Media Queries */
@media (max-width: 768px) {
    .message-sent {
        padding-left: 5%;
    }
    
    .message-received {
        padding-right: 5%;
    }
    
    .attachment-name {
        max-width: 120px;
    }
    
    .chat-widget-container {
        width: 300px;
        height: 400px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .message-received .message-content {
        background-color: #2b2b2b;
        color: #e2e2e2;
    }
    
    .attachment-link {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .attachment-link:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    .message-form {
        background-color: #1e1e1e;
        border-color: #343434;
    }
}
