.ai-chat-widget {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 9999;
    font-family: inherit;
}

.ai-chat-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59,130,246,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
}

.ai-chat-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(59,130,246,.55);
}

.ai-chat-box {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 340px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(.92) translateY(10px);
    pointer-events: none;
    transition: opacity .22s, transform .22s;
}

.ai-chat-box.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.ai-chat-header {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.ai-header-name { font-weight: 700; font-size: .95rem; }
.ai-header-status { font-size: .72rem; opacity: .85; }

.ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    opacity: .8;
    padding: 4px 8px;
}

.ai-chat-messages {
    flex: 1;
    height: 300px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.ai-msg { display: flex; }

.ai-msg--bot { justify-content: flex-start; }
.ai-msg--user { justify-content: flex-end; }

.ai-msg-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: .88rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.ai-msg--bot .ai-msg-bubble {
    background: #fff;
    color: #1f2937;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.ai-msg--user .ai-msg-bubble {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.ai-typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    margin: 0 2px;
    animation: ai-bounce .9s infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: .18s; }
.ai-typing-dots span:nth-child(3) { animation-delay: .36s; }

@keyframes ai-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

.ai-chat-form {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.ai-chat-input {
    flex: 1;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    padding: 8px 16px;
    font-size: .88rem;
    outline: none;
    transition: border-color .18s;
    font-family: inherit;
    direction: rtl;
}

.ai-chat-input:focus { border-color: #3b82f6; }

.ai-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .18s;
}

.ai-send-btn:disabled { opacity: .5; cursor: not-allowed; }
