/* Teams-like chat styling */
.chat-message-group {
    margin-bottom: 8px;
    position: relative;
    clear: both;
    width: 100%;
}

/* Common message styles */
.chat-message {
    max-width: 85%;
    word-wrap: break-word;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 2px;
    position: relative;
    display: inline-block;
}

/* Left side messages (other users) */
.chat-message-left {
    background-color: #f5f5f5;
    color: #252525;
    border-radius: 8px 8px 8px 0;
    float: left;
    clear: both;
}

/* Right side messages (current user) */
.chat-message-right {
    background-color: #e2efff;
    color: #252525;
    border-radius: 8px 8px 0 8px;
    float: right;
    clear: both;
}

.chat-username {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

/* Username alignment */
.chat-username-left {
    text-align: left;
}

.chat-username-right {
    text-align: right;
}

/* Avatar positioning */
.chat-avatar-left {
    margin-right: 8px;
}

.chat-avatar-right {
    margin-left: 8px;
    order: 2; /* Move to the right in flex container */
}

/* Message group alignment */
.chat-message-group-left {
    align-items: flex-start;
    text-align: left;
}

.chat-message-group-right {
    align-items: flex-end;
    text-align: right;
    justify-content: flex-end;
}

/* Style for comment box */
#commentContent {
    border-radius: 20px;
    padding: 10px 45px 10px 15px;
    border: 1px solid #ddd;
    transition: border-color 0.2s ease;
}

#commentContent:focus {
    border-color: #6c7ae0;
    box-shadow: 0 0 0 0.2rem rgba(108, 122, 224, 0.25);
}

/* Send button styling */
#sendButton {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    transition: transform 0.2s ease;
}

#sendButton:hover {
    transform: scale(1.1);
}

#sendButton:focus {
    outline: none;
}

/* Date divider styling */
.badge.bg-light {
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Avatar styling */
.chat-avatar .rounded-circle {
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Comment container */
#comments-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
    height: calc(100% - 120px); /* Subtract height of input area */
    overflow-y: auto;
}

#comments-container::-webkit-scrollbar {
    width: 6px;
}

#comments-container::-webkit-scrollbar-track {
    background: transparent; 
}
 
#comments-container::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.2);
    border-radius: 20px;
}

/* Connection status styling */
.chat-status {
    transition: all 0.3s ease;
}

#connection-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

#connection-status.bg-success {
    background-color: #10b981 !important;
}

#connection-status.bg-warning {
    background-color: #f59e0b !important;
}

#connection-status.bg-danger {
    background-color: #ef4444 !important;
}

#connection-status.bg-info {
    background-color: #3b82f6 !important;
    animation: pulse 1.5s infinite;
}

/* Message actions (edit/delete buttons) */
.message-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    transform: translateY(-100%);
}

.chat-message {
    position: relative;
}

.chat-message:hover .message-actions {
    display: flex;
    opacity: 1;
}

.message-actions .btn {
    border: none;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-actions .btn-edit {
    color: #6c7ae0;
}

.message-actions .btn-delete {
    color: #ef4444;
}

.message-actions .btn:hover {
    transform: scale(1.1);
    color: #fff;
}

.message-actions .btn-edit:hover {
    background-color: #6c7ae0;
}

.message-actions .btn-delete:hover {
    background-color: #ef4444;
}

/* Editing message highlight */
.chat-message.editing {
    background-color: rgba(108, 122, 224, 0.1);
    border: 1px solid #6c7ae0;
}

/* Cancel editing button */
#cancelEditButton {
    text-decoration: none;
    font-size: 0.85rem;
}

#cancelEditButton:hover {
    text-decoration: underline;
}

/* Deleted message styling */
.chat-message .text-muted.fst-italic {
    color: #999 !important;
    font-size: 0.9rem;
}

/* Message timestamp */
.message-timestamp-left {
    text-align: left;
    margin-left: 2px;
}

.message-timestamp-right {
    text-align: right;
    margin-right: 2px;
}

/* Clearfix for message groups */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Full Screen Description Styles */
.fullscreen-container {
    transition: all 0.3s ease;
    flex: 1;
    min-width: 0; /* Required for proper flexbox behavior */
}

.fullscreen-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    background-color: #fff;
    padding: 20px;
    overflow-y: auto;
}

.description-fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

/* Layout container - For side-by-side layout */
.edit-description-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 120px); /* Adjust based on your page header/footer */
    position: relative;
}

/* Fixed position for floating chat */
.floating-chat {
    width: 30%; /* Set to a percentage of the screen width */
    min-width: 350px; /* Minimum width */
    max-width: 450px; /* Maximum width */
    transition: all 0.3s ease;
    flex-shrink: 0; /* Prevent from shrinking */
}

.floating-chat .card {
    height: 100%;
}

.floating-chat .card-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: calc(100% - 56px); /* Subtract header height */
}

.floating-chat.hidden {
    display: none;
}

.floating-chat.pinned {
    width: 30%; /* Width when pinned */
}

/* For mobile responsiveness */
@media (max-width: 992px) {
    .edit-description-layout {
        flex-direction: column;
        height: auto;
    }
    
    .floating-chat {
        width: 100%;
        min-width: 0;
        margin-top: 20px;
        height: 500px; /* Fixed height for mobile */
    }
    
    .floating-chat .card {
        height: 100%;
    }
    
    /* Show toggle button on mobile */
    .chat-toggle-button {
        display: flex;
    }
}

/* Chat toggle button for small screens */
.chat-toggle-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #6c7ae0;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1039;
    transition: all 0.2s ease;
}

/* Show the toggle button only on smaller screens */
@media (min-width: 993px) {
    .chat-toggle-button {
        display: none;
    }
}

.chat-toggle-button:hover {
    transform: scale(1.1);
}

.chat-toggle-button i {
    font-size: 24px;
}

.chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ef4444;
    color: white;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-buttons button {
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chat-header-buttons button:hover {
    background-color: #f0f0f0;
}

.chat-header-buttons button.active {
    color: #6c7ae0;
}

/* Add comment form */
.add-comment-form {
    padding: 10px 0;
    flex-shrink: 0; /* Prevent from shrinking */
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

/* New message notification */
.new-message-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #3b82f6;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.new-message-indicator.show {
    opacity: 1;
}

.new-message-indicator i {
    margin-right: 8px;
}