.lexicon-ai-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 90px;
    z-index: 999999;
    font-family: Arial, sans-serif;
}

.lexicon-ai-chat-toggle {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #56378F 0%, #A56BEE 55%, #D3A7F6 100%);
    color: transparent;
    box-shadow: 0 14px 40px rgba(86, 55, 143, 0.28);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.lexicon-ai-chat-toggle:hover {
    opacity: 0.95;
}

.lexicon-ai-chat-toggle-icon {
    font-size: 0;
    line-height: 0;
}

.lexicon-ai-chat-toggle::before {
    content: "";
    position: absolute;
    width: 28px;
    height: 20px;
    background: #fff;
    border-radius: 12px;
    top: 19px;
    left: 18px;
}

.lexicon-ai-chat-toggle::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    left: 22px;
    top: 34px;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

.lexicon-ai-chat-box {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: 380px;
    max-width: calc(100vw - 20px);
    height: 520px;
    max-height: calc(100vh - 110px);
    border: 1px solid rgba(86, 55, 143, 0.18);
    border-radius: 18px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
}

.lexicon-ai-hidden {
    display: none !important;
}

#lexicon-ai-chat-header {
    background: linear-gradient(135deg, #56378F 0%, #A56BEE 55%, #D3A7F6 100%);
    color: #fff;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: bold;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lexicon-ai-chat-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
}

#lexicon-ai-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px;
    background: #f7f7f7;
}

.lexicon-ai-message {
    max-width: 88%;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
}

.lexicon-ai-message.user {
    margin-left: auto;
    background: #efe7ff;
    color: #111;
    border-bottom-right-radius: 4px;
}

.lexicon-ai-message.assistant {
    margin-right: auto;
    background: #ffffff;
    color: #111;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 4px;
    text-align: left;
}

.lexicon-ai-message a {
    color: #56378F;
    text-decoration: underline;
}

#lexicon-ai-input-wrap {
    display: flex;
    gap: 10px;
    padding: 14px;
    border-top: 1px solid #ececec;
    background: #fff;
    flex: 0 0 auto;
}

#lexicon-ai-input {
    flex: 1;
    min-height: 64px;
    max-height: 140px;
    resize: vertical;
    border: 1px solid #ccc;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

#lexicon-ai-input:focus {
    border-color: #56378F;
    box-shadow: 0 0 0 2px rgba(86, 55, 143, 0.15);
}

#lexicon-ai-send {
    min-width: 100px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    padding: 0 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    background: linear-gradient(135deg, #56378F 0%, #A56BEE 55%, #D3A7F6 100%);
    box-shadow: 0 6px 18px rgba(86, 55, 143, 0.18);
}

#lexicon-ai-send:hover {
    opacity: 0.92;
}

#lexicon-ai-send:disabled,
#lexicon-ai-input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.lexicon-ai-thinking {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lexicon-ai-thinking-label {
    font-weight: 600;
    color: #333;
}

.lexicon-ai-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lexicon-ai-thinking-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #666;
    display: inline-block;
    animation: lexicon-ai-thinking-bounce 1.2s infinite ease-in-out;
}

.lexicon-ai-thinking-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.lexicon-ai-thinking-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes lexicon-ai-thinking-bounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.45;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .lexicon-ai-chat-widget {
        right: 20px;
        bottom: 90px;
    }

    .lexicon-ai-chat-box {
        right: 0;
        left: auto;
        width: min(360px, calc(100vw - 20px));
        height: 62vh;
        max-height: 62vh;
        bottom: 74px;
        border-radius: 16px;
    }

    #lexicon-ai-input-wrap {
        flex-direction: column;
    }

    #lexicon-ai-send {
        width: 100%;
        min-height: 44px;
    }
}