/* General chat container styles */
.chat-container {
    max-width: 100%; /* Make full-width for all screens */
    margin: 0 auto;
    padding: 1rem;
}

.chat-messages {
    max-height: calc(94vh - 150px); /* Leave space for the sticky input */
    overflow-y: auto;
    height: calc(94vh - 150px); /* Adjust height to fit remaining space */
    padding: 1rem;
}

/* Individual chat message */
.chat-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.chat-message.mine {
    flex-direction: row-reverse; /* Align user's messages to the right */
    text-align: right;
}

.chat-message .avatar {
    width: 40px; /* Smaller avatar for mobile */
    height: 40px;
    border-radius: 50%;
    margin: 0 10px;
}

/* Message content styles */
.message-content {
    background: #f8f9fa;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    max-width: 80%; /* Increase max width for readability */
    position: relative;
    font-size: 0.9rem;
    color: #212529;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    word-wrap: break-word; /* Ensure no overflow on long words */
    word-break: break-word;
}

.chat-message.mine .message-content {
    background: #d1ecf1;
    color: #0c5460;
}

/* Header info for messages (username + timestamp) */
.message-header {
    display: flex;
    flex-direction: column; /* Stack on small screens */
    justify-content: flex-start;
    align-items: flex-start;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.message-username {
    font-weight: bold;
    color: #343a40;
}

.message-timestamp {
    color: #6c757d;
    font-size: 0.75rem;
}

/* Chat input bar (Sticky at the bottom) */
.chat-input {
    position: sticky;
    bottom: 0;
    z-index: 100; /* On top of chat messages */
    padding: 0.75rem;
    border-top: 1px solid #dee2e6; /* Subtle top border */
}

.chat-input form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-input textarea {
    flex: 1;
    border: 1px solid #ced4da;
    border-radius: 8px;
    resize: none; /* Prevent resizing */
    padding: 0.5rem;
    font-size: 0.9rem;
    overflow-y: auto; /* Scrollable if very lengthy input */
    height: 40px; /* Fixed height for mobile */
    max-height: 80px; /* Limit height for longer inputs */
}

.chat-input button {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Highlight styling for clicked messages */
.chat-message.highlight {
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 5px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .chat-message {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-message.mine {
        flex-direction: row; /* Align left for mobile */
        text-align: left;
    }

    .message-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-username, .message-timestamp {
        font-size: 0.75rem; /* Reduce font size slightly */
    }

    .message-content {
        font-size: 0.85rem;
    }

    .chat-messages {
        padding: 0.5rem; /* Smaller padding for mobile */
    }
}
/* Ensure the card height is properly constrained */
.card {
    overflow: hidden;
    height: auto;
}

/* Improve the appearance of the scroll area */
#chatTabsContent {
    scrollbar-width: thin; /* Thinner scrollbar for better aesthetics */
}

#chatTabsContent::-webkit-scrollbar {
    width: 6px;
    background-color: #f9f9f9;
}

#chatTabsContent::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.text-truncate {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
/* Popover menu styles */
.popover-menu {
    position: relative;
    top: calc(100% + 5px);
    right: 0;
    background: rgba(0, 0, 0, 0.6); /* Dark transparent background */
    border: 1px solid rgba(255, 255, 255, 0.2); /* Subtle border */
    border-radius: 8px;
    padding: 0.5rem;
    z-index: 10;
}

.popover-menu.hidden {
    display: none; /* Hidden by default */
}

.popover-menu button {
    background: none;
    border: none;
    cursor: pointer;
    margin: 0 5px;
}

.popover-menu button svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

.popover-menu button:hover svg {
    fill: #007bff;
}

/* Highlight styling for clicked messages */
.chat-message.highlight {
    background-color: rgba(0, 0, 0, 0.05); /* Subtle gray highlight */
    border-radius: 8px;
    padding: 5px;
}
