.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
}

.message {
    margin-bottom: 1rem;
    max-width: 70%;
    clear: both;
    position: relative;
}

.message.sent {
    float: right;
    background-color: #007bff;
    color: white;
    border-radius: 1rem 1rem 0 1rem;
    padding: 0.75rem 1rem;
    margin-right: 0;
    margin-left: 30%;
}

.message.received {
    float: left;
    background-color: #e9ecef;
    color: #212529;
    border-radius: 1rem 1rem 1rem 0;
    padding: 0.75rem 1rem;
    margin-left: 0;
    margin-right: 30%;
}

.message-content {
    position: relative;
}

.message-header {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message.sent .message-header {
    color: rgba(255, 255, 255, 0.8);
    flex-direction: row-reverse;
}

.message.received .message-header {
    color: rgba(0, 0, 0, 0.6);
}

.message-text {
    word-wrap: break-word;
    clear: both;
}

.message-time {
    font-size: 0.7em;
    opacity: 0.7;
}

/* Clear floats after messages */
.chat-messages::after {
    content: "";
    display: table;
    clear: both;
}

.message .time {
    font-size: 0.7em;
    opacity: 0.7;
    margin-top: 5px;
}

.message .attachment {
    margin-top: 5px;
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

.user-list-item {
    cursor: pointer;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

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

.user-list-item.active {
    background-color: #e9ecef;
}

.user-list-item .text-truncate {
    max-width: 200px;
}

.user-list-item .badge {
    font-size: 0.7em;
    padding: 0.25em 0.6em;
}

#userSearch {
    margin-bottom: 10px;
}

#messages {
    display: flex;
    flex-direction: column;
}

.message-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.message-container.sent {
    align-items: flex-end;
}

.message-container.received {
    align-items: flex-start;
}

.message-info {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 2px;
}

/* New styles for chat list */
.user-list-item img {
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-list-item h6 {
    font-weight: 600;
    margin-bottom: 2px;
}

.user-list-item small {
    color: #6c757d;
}

.user-list-item .unread-badge {
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: bold;
}

/* Image Message Styles */
.image-container {
    position: relative;
    max-width: 300px;
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
}

.chat-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-image:hover {
    transform: scale(1.02);
}

.download-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-container:hover .download-btn {
    opacity: 1;
}

.message.sent .image-container {
    margin-left: auto;
}

.message.received .image-container {
    margin-right: auto;
}

/* Ensure proper spacing between message elements */
.message-content > * {
    margin-bottom: 5px;
}

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

/* File input styling */
#fileInput {
    display: none;
}

#attachFile {
    cursor: pointer;
    padding: 8px 12px;
}

#attachFile:hover {
    background-color: #e9ecef;
}

/* Error message styling */
.upload-error {
    color: #dc3545;
    font-size: 0.8em;
    margin-top: 5px;
}

/* Error Message Styles */
.message.error {
    background-color: #fff3f3;
    border-color: #ffcdd2;
}

.message.error .message-text {
    color: #d32f2f;
}

.message.error .message-header {
    color: #d32f2f;
}

/* Loading Message Styles */
.message.loading {
    background-color: #f5f5f5;
    border-color: #e0e0e0;
}

.message.loading .message-text {
    color: #757575;
    font-style: italic;
}

/* Message Seen Status */
.seen-badge {
    display: inline-block;
    font-size: 0.7em;
    color: #666;
    margin-left: 8px;
    font-style: italic;
}

.message.sent .seen-badge {
    align-self: flex-end;
}

.message.received .seen-badge {
    align-self: flex-start;
}

/* Unread Message Indicator */
.user-list-item .unread-count {
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7em;
    margin-left: 8px;
}

/* Message Seen State */
.message.seen {
    opacity: 0.8;
}

.message-seen-status {
    position: absolute;
    right: 5px;
    bottom: 5px;
    font-size: 12px;
    color: #666;
}

.message.sent .message-seen-status {
    color: #4CAF50;
}

.message-seen-status i {
    margin-left: 2px;
}

.message-seen-status .fa-check-double {
    color: #4CAF50;
} 