/* Chat Bubble */
.chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #af26c1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1050;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-bubble:hover {
    transform: scale(1.1);
    background: #911e9f;
}

/* Chat Popup Window */
.chat-popup {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 130px);
    background: white;
    border-radius: 16px;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 1050;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.chat-header {
    background: #af26c1;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.chat-header h6 {
    margin: 0;
    font-weight: 600;
}

.close-chat {
    cursor: pointer;
    opacity: 0.8;
}

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

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-input-group {
    position: relative;
    display: flex;
    gap: 8px;
}

.chat-input-group input {
    border-radius: 20px;
    padding-right: 45px;
}

.chat-input-group input:focus {
    border-color: #af26c1;
    box-shadow: 0 0 0 0.2rem rgba(175, 38, 193, 0.25);
}

.send-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #af26c1;
    padding: 8px;
}

/* Response Formatting */
.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.msg-user {
    align-self: flex-end;
    background: #af26c1;
    color: white;
    border-bottom-right-radius: 2px;
}

/* AI Analyze Button in pages */
.ai-analyze-btn {
    color: #af26c1;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.ai-analyze-btn:hover {
    color: #911e9f;
    transform: scale(1.1);
}

.ai-analyze-btn i {
    line-height: 1;
}

.msg-ai {
    align-self: flex-start;
    background: white;
    color: #333;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 2px;
}

.bg-light-purple {
    background-color: #f8f0fb !important;
}

.border-primary {
    border-color: #af26c1 !important;
}

/* Table styling in chat */
.chat-body .table-responsive {
    margin: 8px 0;
    background: white;
    border-radius: 4px;
}

.chat-body table {
    margin-bottom: 0 !important;
    font-size: 0.85rem;
}

/* Mobile adjustments */
@media (max-width: 576px) {
    .chat-popup {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 90px;
    }
}
