/* Chat Bubble AI Agent - Frontend Styles */

.cbai-chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 100px;
    height: 100px;
    background: none;
    border-radius: 0;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cbai-chat-bubble:hover .cbai-bubble-icon {
    transform: scale(1.1);
}

.cbai-chat-bubble:hover {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.cbai-bubble-icon {
    color: #667eea;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.cbai-bubble-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cbai-bubble-icon svg {
    width: 100%;
    height: 100%;
}



/* Chat Popout */
.cbai-chat-popout {
    position: fixed;
    bottom: 140px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 500px;
    max-height: calc(100vh - 130px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
}

.cbai-chat-popout.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

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

.cbai-popout-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cbai-close-popout {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cbai-close-popout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cbai-popout-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cbai-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.cbai-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    animation: cbai-message-appear 0.3s ease;
}

.cbai-message-user {
    background: #667eea;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.cbai-message-ai {
    background: #e9ecef;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.cbai-message-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.cbai-typing-indicator {
    background: #e9ecef;
    padding: 12px 16px;
    width: 80px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.cbai-typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    margin: 0 2px;
    animation: cbai-typing 1.4s infinite both;
}

.cbai-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.cbai-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes cbai-typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
}

@keyframes cbai-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cbai-input-area {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.cbai-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    transition: border 0.2s;
}

.cbai-message-input:focus {
    outline: none;
    border-color: #667eea;
}

.cbai-send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cbai-send-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.cbai-send-button:active {
    transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .cbai-chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 75px;
        height: 75px;
    }
    
    .cbai-bubble-icon {
        width: 60px;
        height: 60px;
    }
    
    .cbai-chat-popout {
        bottom: 105px;
        right: 20px;
        left: 20px;
        width: auto;
        max-width: none;
    }
    
    .cbai-message {
        max-width: 90%;
    }
}