:root {
    --purity-ai-primary: #001A72;
    --purity-ai-bg: #ffffff;
    --purity-ai-text: #333333;
    --purity-ai-shadow: rgba(0, 0, 0, 0.15);
}

.purity-ai-chatbot {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999999;
    font-family: 'Inter', 'Roboto', sans-serif;
}

/* Toaster */
.purity-ai-toaster {
    position: absolute;
    right: 80px;
    bottom: 10px;
    background: #fff;
    color: var(--purity-ai-text);
    padding: 12px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px var(--purity-ai-shadow);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}
.purity-ai-toaster.show {
    opacity: 1;
    transform: translateX(0);
}
.purity-ai-toaster::after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 15px;
    border-width: 8px 0 8px 10px;
    border-style: solid;
    border-color: transparent transparent transparent #fff;
}

/* Toggle Button */
.purity-ai-chatbot-toggle {
    width: 65px;
    height: 65px;
    background: var(--purity-ai-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--purity-ai-shadow);
    transition: transform 0.3s ease;
    animation: purityPulse 2s infinite;
}
.purity-ai-chatbot-toggle:hover {
    transform: scale(1.08);
    animation: none;
}
.purity-ai-chatbot-toggle .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}
@keyframes purityPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 26, 114, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(0, 26, 114, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 26, 114, 0); }
}

/* Chat Window */
.purity-ai-chatbot-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 360px;
    height: 550px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.purity-ai-chatbot-window.open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.purity-ai-chatbot-header {
    background: linear-gradient(135deg, var(--purity-ai-primary), #0033cc);
    color: #fff;
    padding: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: grab;
}
.purity-ai-chatbot-header:active {
    cursor: grabbing;
}
.purity-ai-chatbot-title {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
}
.purity-ai-chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background 0.2s;
}
.purity-ai-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages */
.purity-ai-chatbot-messages {
    flex: 1;
    padding: 20px 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.purity-ai-message {
    display: flex;
    max-width: 85%;
    opacity: 0;
    transform: translateY(10px);
    animation: puritySlideUp 0.3s forwards;
}
@keyframes puritySlideUp {
    to { opacity: 1; transform: translateY(0); }
}
.purity-ai-message.system {
    align-self: flex-start;
}
.purity-ai-message.user {
    align-self: flex-end;
}
.purity-ai-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.purity-ai-message.system .purity-ai-bubble {
    background: #f1f2f6;
    color: #2f3542;
    border-bottom-left-radius: 4px;
}
.purity-ai-message.user .purity-ai-bubble {
    background: var(--purity-ai-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Markdown formatting inside bubbles */
.purity-ai-bubble p { margin: 0 0 10px 0; }
.purity-ai-bubble p:last-child { margin-bottom: 0; }
.purity-ai-bubble ul, .purity-ai-bubble ol { margin: 0 0 10px 0; padding-left: 20px; }
.purity-ai-bubble ul:last-child, .purity-ai-bubble ol:last-child { margin-bottom: 0; }
.purity-ai-bubble li { margin-bottom: 5px; }
.purity-ai-bubble strong { font-weight: 700; }

/* Typing Indicator */
.purity-ai-message.system.typing .purity-ai-bubble {
    display: flex;
    gap: 4px;
    padding: 15px 18px;
}
.purity-ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #a4b0be;
    border-radius: 50%;
    animation: purityTyping 1.4s infinite ease-in-out both;
}
.purity-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.purity-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes purityTyping {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.purity-ai-chatbot-input {
    display: flex;
    padding: 15px;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.05);
}
.purity-ai-chatbot-input input {
    flex: 1;
    border: 1px solid #e1e2e6;
    background: #f8f9fa;
    border-radius: 25px;
    padding: 10px 18px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s;
}
.purity-ai-chatbot-input input:focus {
    border-color: var(--purity-ai-primary);
    background: #fff;
}
.purity-ai-chatbot-input button {
    background: var(--purity-ai-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s, background 0.2s;
}
.purity-ai-chatbot-input button:hover {
    transform: scale(1.05);
}
.purity-ai-chatbot-input button svg {
    margin-left: -2px;
}
