/* ai-chat.css */
#chat-widget-wrapper {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999; /* Ensure the chat widget is above other content */
    width: 60vw;
    height: 80vh;
    min-width: 300px;
    min-height: 400px;
    resize: both;
}

#chat-widget-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    cursor: se-resize;
}

.chat-widget {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(11, 126, 157, 0.2);
    display: flex;
    flex-direction: column;
    font-size: 14px;
    overflow: hidden;
    background-color: #FFF;
}

#chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: #0B7E9D;
    color: #F9F6E5;
    cursor: move;
}

#chat-form-title {
    /* Ignore all mouse events */
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none; /* For Safari */
    -moz-user-select: none; /* For Firefox */
    -ms-user-select: none; /* For IE */
}

#chat-close-button {
    position: absolute;
    right: 10px;
    font-size: 24px;
    margin-top: auto;
    background-color: #0B7E9D;
    color: #F9F6E5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-area {
    flex-grow: 1;
    border: 1px solid #ccc;
    overflow-y: auto;
    padding: 10px;
}

.chat-input-area {
    padding: 10px;
    background-color: #FFF;
}

.chat-input-wrapper {
    display: flex;
    flex-direction: column;
    border: 1px solid #0B7E9D;
    border-radius: 20px;
    overflow: hidden;
}

.chat-textarea-container {
    padding: 10px 10px 0 10px;
}

#chat-user-input {
    width: 100%;
    height: 20px; /* 1 line */
    max-height: 120px; /* ~6 lines */
    padding: 0;
    border: none;
    box-shadow: none;
    font-size: 14px;
    line-height: 20px;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    background: transparent;
}

#chat-user-input:focus {
    outline: none;
}

.chat-bottom-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 5px 10px;
    background: transparent;
}

#chat-knowledge-base, #chat-summary-button {
    padding: 2px 5px;
    font-size: 12px;
    border: 1px solid #0B7E9D;
    border-radius: 10px;
    background-color: transparent;
    color: #0B7E9D;
    min-width: 120px;
    margin-top: 0;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 5px;
}

#chat-knowledge-base {
    display: none;
}

#chat-knowledge-base:disabled, #chat-summary-button:disabled {
    color: #999;
    border-color: #ccc;
    background-color: #f0f0f0;
}

#chat-send-button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-2px);
    margin-left: auto;
}

#chat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#chat-send-button svg {
    width: 20px;
    height: 20px;
    fill: #0B7E9D;
}

#chat-send-button:disabled svg {
    fill: #999;
}

#chat-knowledge-base, #chat-summary-button, #chat-send-button, #chat-user-input {
    transition: all 0.3s ease;
}

.chat-message {
    max-width: 70%;
    margin-bottom: 10px;
    padding: 8px 12px;
    font-size: 14px !important;
    border-radius: 15px;
    word-wrap: break-word;
    clear: both;
}

.chat-user-message {
    float: right;
    clear: both;
    background-color: rgba(11, 126, 157, 0.1) !important;
}

.chat-assistant-message {
    float: left;
    clear: both;
    background-color: #f0f0f0 !important;
}

.chat-message p {
    margin: 0;
    font-size: 14px;
    color: #0c0c0c !important;
}

.chat-message ul,
.chat-message ol {
    margin: 5px 0;
    padding-left: 2em !important;
}

.chat-message ul li {
    list-style-type: disc; /* 使用实心圆点 */
    list-style-position: outside; /* 确保符号在文字区块以外 */
    margin-bottom: 5px;
}

.chat-message ol li {
    list-style-type: decimal; /* 使用数字 */
    list-style-position: outside;
    margin-bottom: 5px;
}

.chat-message pre {
    background-color: rgba(249, 246, 229, 0.8);
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.chat-message code {
    background-color: rgba(215, 185, 161, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

.chat-message pre code {
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    white-space: pre-wrap !important;
    word-wrap: break-word;
    white-space: inherit;
}

.chat-widget-hidden {
    display: none;
}

.chat-area::after {
    content: "";
    display: table;
    clear: both;
}

@media (max-width: 768px) {
    #chat-user-input {
        height: 40px; /* 2 line */
    }

    #chat-widget-wrapper {
        width: 90vw;
    }
}