/* 자연어 검색 챗봇 플로팅 위젯 (text_action_match_demo 연동) */
#nlpChatWidget {
    /* nlp 서비스(8100 등)가 켜져 있는지 확인되기 전까지는 숨김.
       chatbot.js가 헬스체크(/api/nlp/health)에 성공해야 .nlp-ready를 붙여 노출한다. */
    display: none;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: 'pretendard', sans-serif;
}

#nlpChatWidget.nlp-ready {
    display: block;
}

#nlpChatWidget .nlp-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: #CA0033;
    color: #fff;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

#nlpChatWidget .nlp-chat-toggle:hover {
    background-color: #a8002b;
}

#nlpChatWidget .nlp-chat-panel {
    display: none;
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    flex-direction: column;
    overflow: hidden;
}

#nlpChatWidget .nlp-chat-panel.active {
    display: flex;
}

#nlpChatWidget .nlp-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background-color: #CA0033;
    color: #fff;
    flex: none;
}

#nlpChatWidget .nlp-chat-header strong {
    font-size: 15px;
}

#nlpChatWidget .nlp-chat-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

#nlpChatWidget .nlp-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #F4F4F4;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#nlpChatWidget .nlp-chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-line;
    word-break: break-word;
}

#nlpChatWidget .nlp-chat-bubble.user {
    align-self: flex-end;
    background-color: #CA0033;
    color: #fff;
    border-bottom-right-radius: 4px;
}

#nlpChatWidget .nlp-chat-bubble.bot {
    align-self: flex-start;
    background-color: #EBECF0;
    color: #222;
    border-bottom-left-radius: 4px;
}

#nlpChatWidget .nlp-chat-bubble.bot.error {
    background-color: #FEE2E2;
    color: #991B1B;
}

#nlpChatWidget .nlp-product-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#nlpChatWidget .nlp-product-card {
    display: block;
    background-color: #fff;
    border: 1px solid #EBECF0;
    border-radius: 10px;
    padding: 10px 12px;
    text-decoration: none;
    color: #222;
}

#nlpChatWidget .nlp-product-card:hover {
    border-color: #CA0033;
}

#nlpChatWidget .nlp-product-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

#nlpChatWidget .nlp-product-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

#nlpChatWidget .nlp-product-price {
    font-size: 12px;
    color: #CA0033;
    font-weight: 600;
}

#nlpChatWidget .nlp-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #EBECF0;
    flex: none;
}

#nlpChatWidget .nlp-chat-input-row input {
    flex: 1;
    border: 1px solid #EBECF0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
}

#nlpChatWidget .nlp-chat-input-row input:focus {
    border-color: #CA0033;
}

#nlpChatWidget .nlp-chat-send {
    border: none;
    background-color: #CA0033;
    color: #fff;
    border-radius: 20px;
    padding: 0 16px;
    font-size: 13px;
    cursor: pointer;
}

#nlpChatWidget .nlp-chat-send:disabled {
    background-color: #EBECF0;
    color: #999;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    #nlpChatWidget {
        right: 12px;
        bottom: 12px;
    }

    #nlpChatWidget .nlp-chat-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 140px);
    }
}
