/* Messaging System Styles */

/* General messaging container */
.messaging-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Conversation list styles */
.conversation-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.conversation-item {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

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

.conversation-item.unread {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-left: 4px solid #dc3545;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.conversation-title {
    font-weight: 600;
    color: #333;
    font-size: 1.1em;
}

.conversation-time {
    color: #666;
    font-size: 0.9em;
}

.conversation-preview {
    color: #666;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-type {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.conversation-type.support {
    background: #fff3cd;
    color: #856404;
}

.conversation-type.private {
    background: #d1ecf1;
    color: #0c5460;
}

.conversation-type.group {
    background: #d4edda;
    color: #155724;
}

.unread-badge {
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
}

/* Chat interface styles */
.chat-interface {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
}

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

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
}

.message.own {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin: 0 10px;
    flex-shrink: 0;
}

.message.own .message-avatar {
    background: #28a745;
}

.message-content {
    max-width: 70%;
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message.own .message-content {
    background: #007bff;
    color: white;
}

.message-text {
    margin-bottom: 8px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.8em;
    opacity: 0.7;
    text-align: right;
}

.message.own .message-time {
    text-align: left;
}

.message-attachments {
    margin-top: 8px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 4px;
}

.attachment {
    display: inline-block;
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    margin: 4px 0;
    text-decoration: none;
    color: inherit;
    font-size: 0.9em;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    word-break: break-all;
}

.attachment:hover {
    background: rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
}

.message.own .attachment {
    background: rgba(255, 255, 255, 0.2);
}

.message.own .attachment:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-input {
    background: white;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

/* Make chat input area and textarea full width */
.chat-input-container {
    width: 100%;
    box-sizing: border-box;
    padding: 0;
}

.chat-input-form {
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    box-sizing: border-box;
}

.message-input {
    flex: 1 1 0%;
    width: 100%;
    min-width: 0;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 20px;
    resize: none;
    min-height: 50px;
    max-height: 120px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.message-input:focus {
    outline: none;
    border-color: #007bff;
}

.send-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.send-btn:disabled {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

.attachment-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.attachment-btn:hover {
    background: #5a6268;
    transform: scale(1.05);
}

/* Attachment preview styles */
.attachment-preview {
    display: flex;
    align-items: center;
    background: #e9ecef;
    border-radius: 20px;
    padding: 8px 12px;
    margin: 0 10px;
    font-size: 0.9em;
    color: #495057;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-preview span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-attachment {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.remove-attachment:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* Empty state styles */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 4em;
    color: #ddd;
    margin-bottom: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .messaging-container {
        padding: 10px;
    }
    
    .chat-interface {
        height: calc(100vh - 150px);
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .conversation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .chat-input-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .send-btn, .attachment-btn {
        width: 100%;
        border-radius: 25px;
    }
}

/* Animation effects */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: slideIn 0.3s ease;
}

/* Typing indicator */
.typing-indicator {
    padding: 10px 20px;
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

.typing-dots {
    display: inline-block;
}

.typing-dots::after {
    content: '';
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Read receipts */
.read-receipt {
    font-size: 0.7em;
    opacity: 0.6;
    margin-top: 4px;
}

.read-receipt i {
    color: #007bff;
}

/* System messages */
.system-message {
    text-align: center;
    margin: 20px 0;
    color: #666;
    font-style: italic;
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 8px;
}

/* Message actions */
.message-actions {
    position: absolute;
    top: -10px;
    right: -10px;
    background: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.8em;
    color: #dc3545;
}

.message:hover .message-actions {
    display: flex;
}

.message.own .message-actions {
    left: -10px;
    right: auto;
} 

/* Force full width for file-only messages */
.message-content.full-width {
    width: 100vw !important;
    max-width: calc(100vw - 60px) !important; /* 60px for avatar and padding */
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
}
.message.own .message-content.full-width {
    margin-left: 0;
    margin-right: 0;
}

@media (max-width: 768px) {
    .message-content.full-width {
        width: 100vw !important;
        max-width: 100vw !important;
    }
} 