/**
 * All of the CSS for the public-facing chatbot widget.
 *
 * @package    ChatAI_Support
 * @subpackage ChatAI_Support/public/css
 * @author     Mr. WordPress <core@chataisupport.com>
 */

/* Chat Widget Bubble */
#chatai-bubble {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--chatai-primary-color, #0073aa);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 99998;
    transition: transform 0.2s ease-in-out;
}
#chatai-bubble:hover {
    transform: scale(1.1);
}
#chatai-bubble.chatai-bottom-right {
    bottom: 20px;
    right: 20px;
}
#chatai-bubble.chatai-bottom-left {
    bottom: 20px;
    left: 20px;
}
#chatai-bubble svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Chat Widget Window */
#chatai-widget-window {
    position: fixed;
    width: 370px;
    max-width: 90vw;
    height: 70vh;
    max-height: 600px;
    background: #f9f9f9;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}
#chatai-widget-window.chatai-open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}
#chatai-widget-window.chatai-bottom-right {
    bottom: 90px;
    right: 20px;
}
#chatai-widget-window.chatai-bottom-left {
    bottom: 90px;
    left: 20px;
}

/* Header */
.chatai-header {
    background-color: var(--chatai-primary-color, #0073aa);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}
.chatai-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}
.chatai-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

/* Messages Area */
.chatai-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

/* Individual Messages */
.chatai-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    line-height: 1.4;
    font-size: 15px;
    word-wrap: break-word;
}
.chatai-message.chatai-bot {
    background-color: #f1f0f0;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.chatai-message.chatai-user {
    background-color: var(--chatai-primary-color, #0073aa);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chatai-typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
}
.chatai-typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #aaa;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: chatai-typing-bounce 1.4s infinite ease-in-out both;
}
.chatai-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chatai-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatai-typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}


/* Input Area */
.chatai-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 10px;
    background-color: #f9f9f9;
}
.chatai-input-area form {
    display: flex;
    align-items: center;
}
#chatai-user-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 15px;
    resize: none;
    margin-right: 10px;
}
#chatai-user-input:focus {
    outline: none;
    border-color: var(--chatai-primary-color, #0073aa);
}
#chatai-send-btn {
    background: var(--chatai-primary-color, #0073aa);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
#chatai-send-btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}
#chatai-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}