/* Floating Avatar */
.ai-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border: 3px solid #fff;
    overflow: hidden;
    transition: transform 0.3s;
    background: #fff;
}
.ai-widget-btn:hover { transform: scale(1.1); }
.ai-widget-btn img { width: 100%; height: 100%; object-fit: cover; }

/* Chat Box */
.ai-chat-box {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 360px;
    height: 550px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    display: none; /* Hidden by default */
    flex-direction: column;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
}

/* Header */
.ai-header {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-header h4 { margin: 0; font-size: 18px; font-weight: 600; }
.ai-status { font-size: 11px; background: rgba(255,255,255,0.2); padding: 3px 8px; border-radius: 10px; margin-left: 8px; }

/* Messages Area */
.ai-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}
.msg.user {
    background: #FF6B6B;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.msg.ai {
    background: #fff;
    color: #444;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Input Area */
.ai-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-input-area input {
    flex: 1;
    border: 1px solid #ddd;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}
.ai-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #FF6B6B;
    cursor: pointer;
    transition: 0.2s;
    padding: 8px;
}
.ai-btn:hover { background: #fff0f0; border-radius: 50%; }
.ai-btn.listening { color: red; animation: pulse 1s infinite; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* Sound Wave */
.wave-container {
    display: none;
    height: 30px;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
}
.wave-bar { width: 4px; height: 10px; background: #FF6B6B; animation: wave 1s infinite; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
@keyframes wave { 0%, 100% { height: 10px; } 50% { height: 25px; } }