/* Messaging system styles */

/* Messaging icon */
.cp-message-icon-wrapper {
    position: relative;
}

.cp-message-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff3b30;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#cp-messaging-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

#cp-messaging-trigger:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Conversations panel */
.cp-conversations-panel {
    position: absolute;
    z-index: 9999;
    width: 320px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    max-height: 500px;
    overflow: hidden;
}

.cp-conversations-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    border-radius: 12px 12px 0 0;
}

.cp-conversations-title {
    font-weight: bold;
    font-size: 16px;
    margin: 0;
    color: #333;
}

.cp-conversations-actions {
    display: flex;
    gap: 10px;
}

.cp-conversation-action {
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.cp-conversation-action:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.cp-search-container {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.cp-search-wrapper {
    position: relative;
    width: 100%;
}

.cp-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.cp-search-input {
    width: 100%;
    padding: 8px 12px 8px 35px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 14px;
    background-color: #f5f5f5;
    transition: all 0.2s;
}

.cp-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.cp-conversations-list {
    overflow-y: auto;
    flex-grow: 1;
}

/* Search divider */
.cp-search-divider {
    padding: 5px 15px;
    background-color: #f5f5f5;
    font-size: 12px;
    color: #65676B;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
}

/* Conversation item */
.cp-conversation-item {
    display: flex;
    padding: 12px 15px;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-conversation-item:hover {
    background-color: #f5f5f5;
}

.cp-conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    flex-shrink: 0;
}

.cp-conversation-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.cp-conversation-content {
    flex-grow: 1;
    overflow: hidden;
    min-width: 0;
}

.cp-conversation-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.cp-conversation-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1c1e21;
}

.cp-conversation-time {
    font-size: 12px;
    color: #65676B;
    flex-shrink: 0;
    margin-left: 8px;
}

.cp-conversation-preview {
    font-size: 13px;
    color: #65676B;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cp-conversation-preview span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.cp-conversation-unread {
    background-color: #3b82f6;
    color: white;
    font-size: 12px;
    font-weight: bold;
    height: 20px;
    min-width: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    padding: 0 5px;
    margin-left: 5px;
    display: inline-block;
}

/* Member item */
.cp-member-item {
    display: flex;
    padding: 12px 15px;
    align-items: center;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-member-item:hover {
    background-color: #f5f5f5;
}

.cp-member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    flex-shrink: 0;
}

.cp-member-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.cp-member-info {
    flex-grow: 1;
}

.cp-member-name {
    font-weight: 600;
    font-size: 14px;
    color: #1c1e21;
    margin-bottom: 2px;
}

.cp-member-community {
    font-size: 12px;
    color: #65676B;
    margin-bottom: 2px;
}

.cp-online-status {
    font-size: 12px;
    color: #65676B;
}

.cp-online-status.online {
    color: #42b72a;
}

/* Empty states */
.cp-empty-conversations, 
.cp-empty-search, 
.cp-no-results {
    padding: 30px 20px;
    text-align: center;
    color: #65676B;
}

.cp-empty-icon {
    margin-bottom: 12px;
}

.cp-start-first-convo {
    margin-top: 15px;
    display: inline-block;
    background-color: #3b82f6;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-start-first-convo:hover {
    background-color: #2563eb;
}

/* Loading state */
.cp-loading {
    padding: 20px;
    text-align: center;
    color: #65676B;
}


.cp-chat-header {
    height: 60px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fff;
    cursor: default;
}

.cp-chat-title {
    display: flex;
    align-items: center;
    flex: 1;
}

.cp-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    flex-shrink: 0;
}

.cp-chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.cp-chat-name {
    font-weight: 600;
    font-size: 16px;
    margin-left: 10px;
    color: #1c1e21;
}

.cp-chat-actions {
    display: flex;
    align-items: center;
}

.cp-chat-action {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 5px;
    background-color: #f0f2f5;
    transition: background-color 0.2s;
}

.cp-chat-action:hover {
    background-color: #e4e6eb;
}

/* Chat options menu */
.cp-chat-options-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 200px;
    z-index: 10;
    display: none;
    margin-top: 8px;
    border: 1px solid #e0e0e0;
}

.cp-clear-conversation {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    color: #e41e3f;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-clear-conversation:hover {
    background-color: #f5f5f5;
}

.cp-clear-conversation svg {
    margin-right: 10px;
}

/* Chat messages area */
.cp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f5f7f9;
}

/* Message styling */
.cp-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.cp-message-wrapper {
    display: flex;
    max-width: 85%;
}

.cp-message-receiver .cp-message-wrapper {
    align-self: flex-start;
    
}

.cp-message-sender .cp-message-wrapper {
    align-self: flex-end;
    justify-content: flex-end;
}

.cp-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 8px;
    align-self: flex-end;
}

.cp-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cp-message-bubble {
    border-radius: 18px;
    padding: 10px 14px;
    max-width: 100% ;
    word-wrap: break-word; 
    position: relative;
}

.cp-message-receiver .cp-message-bubble {
    background-color: #e4e6eb;
    font-size: 14px;
    color: #1c1e21;
    border-bottom-left-radius: 4px;
}

.cp-message-sender .cp-message-bubble {
    background-color: #0084ff;
    font-size: 14px;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.cp-message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
    color: #65676B;
}

.cp-message-receiver .cp-message-time {
    margin-left: 40px;
}

.cp-message-sender .cp-message-time {
    text-align: right;
}

/* System messages */
.cp-message-system {
    text-align: center;
    margin: 15px 0;
}

.cp-message-system-content {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 15px;
    background-color: #f0f2f5;
    color: #65676b;
    font-size: 12px;
}

/* Image messages */
.cp-message-image img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    margin-top: 5px;
    cursor: pointer;
}

/* File messages */
.cp-message-file {
    display: flex;
    align-items: center;
}

.cp-file-icon {
    margin-right: 8px;
    flex-shrink: 0;
}

.cp-file-details {
    flex: 1;
    min-width: 0;
}

.cp-file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.cp-file-download {
    font-size: 12px;
    text-decoration: none;
}

.cp-message-sender .cp-file-download {
    color: rgba(255, 255, 255, 0.9);
}

.cp-message-receiver .cp-file-download {
    color: #0084ff;
}

/* Chat input area */
.cp-chat-input {
    padding: 10px 15px;
    border-top: 1px solid #e0e0e0;
    background-color: #fff;
    display: flex;
    align-items: center;
}

.cp-chat-input-field {
    flex: 1;
    height: 36px;
    border: none;
    border-radius: 18px;
    padding: 0 12px;
    background-color: #f5f7f9;
    font-size: 14px;
}

.cp-chat-input-field:focus {
    outline: none;
}

.cp-chat-attachment {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    margin-right: 8px;
}

.cp-chat-attachment:hover {
    background-color: #f0f2f5;
}

.cp-chat-send {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    margin-left: 8px;
    background-color: #0084ff;
    color: white;
}

.cp-chat-send:hover {
    background-color: #0078e7;
}

/* File preview */
.cp-file-preview {
    background-color: #f0f2f5;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cp-file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.cp-file-size {
    color: #65676b;
    font-size: 12px;
    margin-right: 10px;
}

.cp-file-remove {
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cp-file-remove:hover {
    background-color: #e4e6eb;
}

/* Member search modal */
.cp-member-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.cp-modal-content {
    background-color: white;
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
}

.cp-modal-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.cp-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1c1e21;
}

.cp-modal-close {
    background: none;
    border: none;
    color: #65676b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.cp-modal-close:hover {
    background-color: #f0f2f5;
}

.cp-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    max-height: 70vh;
}

/* Enhanced unread styling */
.cp-name-unread {
    font-weight: 700 !important;
    color: #000 !important;
}

.cp-preview-unread {
    font-weight: 600 !important;
    color: #000 !important;
}

/* Responsive design */
@media (max-width: 767px) {
    .cp-conversations-panel {
        width: 100%;
        right: 0 !important;
        left: 0;
        top: 60px !important;
        height: calc(100% - 60px);
        max-height: none;
        border-radius: 0;
        position: fixed;
    }
    
    .cp-conversations-header {
        border-radius: 0;
    }
    
    .cp-chat-window {
        width: 100%;
        height: 100%;
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        border-radius: 0;
    }
    
    .cp-member-search-modal .cp-modal-content {
        height: 100%;
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .cp-modal-body {
        max-height: none;
    }
}

/* Error messages */
.cp-error {
    padding: 10px 15px;
    background-color: #fee2e2;
    color: #b91c1c;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
}


/* Add to messaging.css */

/* Minimized chat styles */
.cp-chat-minimized {
    overflow: hidden;
}

.cp-chat-minimized .cp-chat-messages,
.cp-chat-minimized .cp-chat-input {
    display: none;
}

.cp-chat-header {
    cursor: pointer;
}

.cp-chat-header:hover {
    background-color: #f5f7f9;
}



/* Add to messaging.css */



.cp-chat-window:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Minimized chat */
.cp-chat-minimized {
    width: 240px;
    height: 50px;
    overflow: hidden;
}

.cp-chat-minimized .cp-chat-header {
    height: 100%;
}

.cp-chat-minimized .cp-chat-messages,
.cp-chat-minimized .cp-chat-input {
    display: none;
}

/* Header - clickable for minimize/maximize */
.cp-chat-header {
    height: 60px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-chat-header:hover {
    background-color: #f5f7f9;
}

/* Unread badge for minimized chat */
.cp-chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff3b30;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    /* Subtle pulse animation */
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}





/* Update in messaging.css */

/* Online indicator styling - positioned on avatar */
.cp-chat-avatar {
    position: relative;
}

.cp-online-indicator {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #ccc; /* Default gray for offline */
    border-radius: 50%;
    border: 2px solid white;
    bottom: 0;
    right: 0;
    display: block;
}

.cp-online-indicator.online {
    background-color: #42b72a; /* Green for online */
}

/* Remove the old .cp-chat-title .cp-online-indicator style since we moved it */

/* Minimized chat styling */
.cp-chat-minimized {
    width: 240px;
    height: 50px;
    overflow: hidden;
    margin-top: 10px; /* Add spacing between minimized chats */
    border-radius: 25px; /* More rounded when minimized */
    transition: transform 0.2s ease;
}

.cp-chat-minimized:hover {
    transform: scale(1.03);
}

.cp-chat-minimized .cp-chat-header {
    height: 100%;
    border-radius: 25px;
}

/* Ensure the name is vertically centered in minimized chats */
.cp-chat-minimized .cp-chat-title {
    align-items: center;
}

/* Unread badge for minimized chat - repositioned */
.cp-chat-unread-badge {
    position: absolute;
    top: 5px;
    right: 10px;
    background-color: #ff3b30;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: pulse 0.5s infinite;
}

/* Chat window - smooth transition for all properties */
.cp-chat-window {
    position: fixed;
    bottom: 20px;
    right: 120px !important;
    width: 320px;
    height: 400px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    transition: all 0.001s ease;
}


.cp-chat-window.cp-chat-minimized {
    right: 20px !important;

}




/* Add to messaging.css */

/* Mark all as read button */
.cp-mark-all-read {
    position: relative;
}

/* Loading spinner */
.cp-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: cp-spin 1s linear infinite;
}

@keyframes cp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification system */
.cp-notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cp-notification {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 12px 16px;
    margin-bottom: 10px;
    max-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    font-size: 14px;
}

.cp-notification-show {
    transform: translateX(0);
}

.cp-notification-success {
    border-left: 4px solid #22c55e;
}

.cp-notification-error {
    border-left: 4px solid #ef4444;
}

.cp-notification-info {
    border-left: 4px solid #3b82f6;
}


.cp-conversation-action.cp-new-message {
    display: none;
}
.cp-chat-action.cp-chat-options {
    display: none;
}


.cp-conversation-action.cp-close-conversations {
    display: none;
}

#cp-close-conversations {
    display: none ;
}
