/* ===== AI Chat Widget ===== */

#aiChatBtn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3182F6;
    color: #fff;
    border: none;
    cursor: pointer;
    z-index: 2100;
    box-shadow: 0 4px 16px rgba(49, 130, 246, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform 0.2s;
}

#aiChatBtn:hover {
    transform: scale(1.08);
}

#aiChatPanel {
    position: fixed;
    bottom: 148px;
    right: 16px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 480px;
    max-height: calc(100vh - 200px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 2100;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#aiChatPanel.open {
    display: flex;
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #3182F6;
    color: #fff;
    flex-shrink: 0;
}

.ai-chat-header-title {
    font-weight: 600;
    font-size: 15px;
}

.ai-chat-header-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

#aiChatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-msg {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

.ai-msg.assistant {
    background: #F0F4FF;
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.ai-msg.user {
    background: #3182F6;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-msg.thinking {
    background: #F0F4FF;
    color: #999;
    align-self: flex-start;
    font-style: italic;
}

.ai-chat-input-area {
    display: flex;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    gap: 8px;
    flex-shrink: 0;
    align-items: flex-end;
}

#aiChatInput {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 80px;
    overflow-y: auto;
    font-family: inherit;
}

#aiChatInput:focus {
    border-color: #3182F6;
}

#aiChatSend {
    background: #3182F6;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

#aiChatSend:disabled {
    background: #b0c4f8;
    cursor: not-allowed;
}
