/* Compute CRM Chat Widget Styles */

.compute-crm-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close:hover {
    opacity: 0.8;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f5f5f5;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.message-user {
    align-items: flex-end;
}

.message-user .message-text {
    background: #667eea;
    color: white;
    border-radius: 12px 12px 4px 12px;
}

.message-ai {
    align-items: flex-start;
}

.message-ai .message-text {
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 12px 12px 12px 4px;
}

.message-text {
    max-width: 80%;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-time {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #ddd;
    background: white;
    border-radius: 0 0 8px 8px;
}

#compute-crm-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}

#compute-crm-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

#compute-crm-chat-send {
    background: #667eea !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 8px 16px !important;
    font-size: 14px;
    cursor: pointer !important;
    transition: background 0.3s;
}

#compute-crm-chat-send:hover {
    background: #5568d3 !important;
}

#compute-crm-chat-send:active {
    transform: scale(0.98);
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading indicator */
.message-loading {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
}

.message-loading span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.message-loading span:nth-child(2) {
    animation-delay: 0.2s;
}

.message-loading span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Mobile responsive */
@media (max-width: 600px) {
    .compute-crm-chat-widget {
        position: fixed;
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .message-text {
        max-width: 90%;
    }
}
