/* Style for the chat application */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    height: 100vh;
}

.chat-container {
    width: 800px;
    max-width: 95%;
    display: flex;
    flex-direction: column;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
    height: 100vh;
}

.chat-header {
    background-color: #4a69bd;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

#unread-badge {
    display: none;
    background-color: #ff3b30;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    padding: 2px;
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
    line-height: 20px;
}

.online-users {
    font-size: 0.9rem;
    background-color: rgba(255,255,255,0.2);
    padding: 5px 10px;
    border-radius: 15px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.message.mine {
    align-self: flex-end;
    background-color: #DCF8C6;
}

.message.others {
    align-self: flex-start;
    background-color: #F2F2F2;
}

.message-username {
    font-weight: bold;
    margin-bottom: 3px;
}

.message-time {
    font-size: 0.7rem;
    color: #888;
    position: absolute;
    bottom: 3px;
    right: 10px;
}

.message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    margin-top: 5px;
    cursor: pointer;
}

.message-image:hover {
    opacity: 0.9;
}

.user-input {
    padding: 15px;
    border-top: 1px solid #eee;
}

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

#message {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 1rem;
}

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

#image-upload {
    display: none;
}

.upload-icon {
    font-size: 1.5rem;
    cursor: pointer;
    color: #4a69bd;
}

#file-name {
    font-size: 0.8rem;
    color: #888;
    margin-left: 5px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

button {
    background-color: #4a69bd;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #3a5a9d;
}

.user-info {
    padding: 15px;
    background-color: #f9f9f9;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #eee;
}

.user-info > div {
    margin-bottom: 5px;
}

.username-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

#change-username {
    font-size: 0.8rem;
    padding: 5px 10px;
}