/* --- Launcher & Pulse Animation --- */
#ai-chatbot-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000001;
    box-shadow: 0 4px 15px rgba(103, 61, 230, 0.4);
    transition: background-color 0.3s ease;
}

#ai-chatbot-launcher .pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--primary-color);
    animation: ai-pulse-wave 2s infinite;
    z-index: -1;
    opacity: 0.7;
}

#ai-chatbot-launcher .notification-dot {
    position: absolute;
    top: 2px;
    right: 5px;
    width: 12px;
    height: 12px;
    background-color: #ff4d4d;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 2;
}

@keyframes ai-pulse-wave {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(2.2); opacity: 0; }
}

/* --- Chat Window --- */
#ai-chatbot-container {
    position: fixed;
    bottom: 100px; 
    right: 25px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: none; 
    flex-direction: column;
    overflow: hidden;
    z-index: 1000000;
    transition: all 0.3s ease;
}

#ai-chatbot-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    font-weight: 600;
    text-align: center;
    display: flex;
    justify-content: space-between;
}

#ai-chatbot-box {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}

/* --- Messages & Typing --- */
#ai-chatbot-box .msg { 
    padding: 10px 15px; 
    border-radius: 18px; 
    max-width: 80%; 
    font-size: 14px; 
    line-height: 1.4; 
    word-wrap: break-word; 
}
#ai-chatbot-box .user { 
    align-self: flex-end; 
    background: var(--user-bg); 
    color: white; 
    border-bottom-right-radius: 4px; 
}
#ai-chatbot-box .bot { 
    align-self: flex-start; 
    background: var(--bot-bg); 
    color: #333; 
    border-bottom-left-radius: 4px; 
}

/* Markdown Styles */
#ai-chatbot-box .bot strong {
    font-weight: 600;
    color: var(--primary-color);
}
#ai-chatbot-box .bot a {
    color: var(--primary-color);
    text-decoration: underline;
}
#ai-chatbot-box .bot a:hover {
    text-decoration: none;
}
#ai-chatbot-box .bot ul {
    margin: 5px 0 5px 15px;
    padding: 0;
}
#ai-chatbot-box .bot li {
    margin-bottom: 3px;
}

#ai-chatbot-box .typing { 
    align-self: flex-start; 
    background: var(--bot-bg); 
    padding: 12px 16px; 
    border-radius: 18px; 
    display: flex; 
    gap: 4px; 
    margin-bottom: 10px; 
} 
#ai-chatbot-box .typing span { 
    width: 6px; 
    height: 6px; 
    background-color: #999; 
    border-radius: 50%; 
    display: inline-block; 
    animation: ai-bounce 1.3s infinite ease-in-out; 
} 
#ai-chatbot-box .typing span:nth-child(2) { 
    animation-delay: 0.2s; 
} 
#ai-chatbot-box .typing span:nth-child(3) { 
    animation-delay: 0.4s; 
}
        
@keyframes ai-bounce { 
    0%, 80%, 100% { transform: translateY(0); } 
    40% { transform: translateY(-6px); } 
}

/* --- Input Area --- */
#ai-chatbot-input-area { 
    display: flex; 
    padding: 15px; 
    border-top: 1px solid #eee; 
    gap: 10px; 
    background: white; 
}
#ai-chatbot-input-area input { 
    flex: 1; 
    padding: 10px 15px; 
    border: 1px solid #ddd; 
    border-radius: 25px; 
    outline: none; 
}
#ai-chatbot-input-area button { 
    background-color: var(--primary-color) !important;
    border: none;
    background: none;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    color: #fff;
}
#ai-chatbot-input-area button:disabled { 
    color: #ccc; 
}

/* --- Lead Form --- */
.ai-lead-form {
    background: #fdfdfd;
    border: 1px solid #eee;
    padding: 18px;
    border-radius: 12px;
    margin: 10px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    align-self: flex-start;
    width: 90%;
}
.ai-lead-form p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
}
.ai-lead-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
}
.ai-lead-form input:focus {
    border-color: var(--primary-color);
}
.ai-lead-form button {
    width: 100%;
    padding: 10px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}
.ai-lead-form button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    #ai-chatbot-container {
        width: 95%;
        right: 2.5%;
        bottom: 80px;
        height: 500px;
    }
    
    #ai-chatbot-launcher {
        bottom: 20px;
        right: 20px;
    }
}