




.message-thread {
    background-color: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.message-thread__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border-light);
}

.message-thread__header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
}


.message-thread__messages {
    max-height: 500px;
    overflow-y: auto;
    padding: 1.5rem;
}

.message-thread__loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.message-thread__empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}


.message {
    margin-bottom: 1.5rem;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message:last-child {
    margin-bottom: 0;
}

.message--customer {
    margin-left: auto;
    max-width: 75%;
}

.message--admin {
    margin-right: auto;
    max-width: 75%;
}

.message__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.message__sender {
    font-weight: 600;
    color: var(--text);
}

.message--customer .message__sender {
    color: var(--primary);
}

.message__time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.message__content {
    background-color: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    color: var(--text);
    line-height: 1.5;
    word-wrap: break-word;
}

.message--customer .message__content {
    background-color: var(--primary-light);
    border: 1px solid var(--primary);
}

.message__unread {
    display: inline-block;
    background-color: var(--accent);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-left: 0.5rem;
}


.message__attachments {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.message__attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background-color: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.message__attachment:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
}


.message-thread__form {
    padding: 1.5rem;
    background-color: var(--bg);
    border-top: 1px solid var(--border-light);
}

.message-form__input-group {
    margin-bottom: 1rem;
}

.message-form__textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    background-color: var(--bg-light);
    color: var(--text);
    transition: border-color 0.2s ease;
}

.message-form__textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg);
}

.message-form__char-count {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}


.message-form__attachments {
    margin-bottom: 1rem;
}

.attached-files {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.attached-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.attached-file__name {
    color: var(--text);
}

.attached-file__remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.attached-file__remove:hover {
    background-color: var(--danger-light);
    color: var(--danger);
}


.message-thread__error {
    margin: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--danger-light);
    color: var(--danger);
    border-radius: var(--radius);
    font-size: 0.9rem;
}


.message-thread__messages::-webkit-scrollbar {
    width: 8px;
}

.message-thread__messages::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.message-thread__messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.message-thread__messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


@media (max-width: 768px) {
    .message-thread__header {
        padding: 0.75rem 1rem;
    }
    
    .message-thread__messages {
        max-height: 400px;
        padding: 1rem;
    }
    
    .message--customer,
    .message--admin {
        max-width: 85%;
    }
    
    .message__content {
        padding: 0.75rem;
    }
    
    .message-thread__form {
        padding: 1rem;
    }
}