
/* Floating Chat Window */
.chat-window {
    position: fixed;
    bottom: clamp(0px, 2vh, 5px);
    right: clamp(10px, 2vw, 20px);
    width: clamp(300px, 90vw, 600px); /* Responsive width */
    height: clamp(200px, 60vh, 400px); /* Responsive height */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    transition: transform 0.3s;
}

.chat-window.hidden {
    width: clamp(120px, 30vw, 200px); /* Responsive friend list width */
    height: clamp(20px, 10vh, 35px); /* Minimize height when hidden */
    transform: translateY(calc(100% - 50px)); /* Show only header */
}

.chat-header {
    background-color:  var(--main-ink);
    color: var(--logotext);
    padding: clamp(8px, 1.5vw, 10px);
    font-size: clamp(14px, 2.5vw, 16px);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header .toggle-chat {
    font-size: 14px;
}

.chat-content {
    display: flex;
    flex-grow: 1;
}

.chat-friend-list {
    width: clamp(120px, 30vw, 200px);
    background-color: #f1f3f4;
    border-right: 1px solid #ddd;
    padding: clamp(5px, 1vw, 10px);
    overflow-y: auto;
     flex-shrink: 0; 
}

.chat-friend-list h3 {
    font-size: clamp(14px, 2.5vw, 16px);
    margin: 0 0 10px;
    color: #1a1a1a;
}

.chat-friend-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-friend-list li {
    padding: clamp(5px, 1vw, 8px) clamp(8px, 1.5vw, 10px);
    font-size: clamp(12px, 2vw, 14px);
    cursor: pointer;
    color: #1a1a1a;
    border-radius: 4px;
}

.chat-friend-list li:hover {
    background-color: #e1e3e5;
}

.chat-friend-list li.active {
    background-color: #0079d3;
    color: #fff;
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-body {
    flex-grow: 1;
    padding: clamp(5px, 1vw, 10px);
    overflow-y: auto;
    background-color: #f9f9f9;
   
}

#messageList {
    max-height: clamp(150px, 40vh, 230px);
    overflow-y: auto;
    overflow-wrap: break-word;
    white-space: normal;
}

.message-item {
    display: flex;
    align-items: flex-start;
    padding: clamp(5px, 1vw, 8px);
    margin-bottom: 5px;
    background-color: #aadfec;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    font-size: clamp(12px, 2.5vw, 14px);

}

.message-item.user-message {
    background-color: #e6f3ff; /* Light blue */
}

.message-item.friend-message {
    background-color: #e6fff3; /* Light red */
}


.message-content {
    flex-grow: 1;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 100%;
}


.message-item .avatar {
    width: clamp(24px, 5vw, 32px);
    height: clamp(24px, 5vw, 32px);
    background-color: #ddd;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.message-item .message-content {
    flex-grow: 1;
}

.message-item .message-content .username-timestamp {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.message-item.friend-message .message-content .username { 
    font-weight: bold;
    color: #05914d; /* Light red */
}
.message-item.user-message .message-content .username { 
    font-weight: bold;
    color: #1800f1; /* Light red */
}


.message-item .message-content .username-timestamp {
    color: #666;
    font-size: 12px;
}

.message-item .message-content .text {
    line-height: 1.4;
}

.chat-input {
    padding: clamp(5px, 1vw, 10px);
    border-top: 1px solid #ddd;
    background-color: #fff;
    display: flex;
     gap: clamp(5px, 1vw, 10px);
    align-items: center;
}


.chat-input textarea {
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: none;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    width: 100%;
    flex-grow: 1;
    font-size: clamp(12px, 2.5vw, 14px);
}

.chat-input button {
    padding: clamp(5px, 1vw, 8px);
    margin-top: 5px;
    background-color:  var(--main-ink);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
 
   
}

.chat-input button:hover {
    background-color: #00b545;
}
