/* ===== 问问何老师 对话组件 ===== */
#he-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--font-cn, "Noto Serif SC", "PingFang SC", "Microsoft YaHei", serif);
}

#he-chat-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #c9a96e;
    border: none;
    color: #0a0a0a;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(201,169,110,0.4);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#he-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(201,169,110,0.5);
}

#he-chat-window {
    position: fixed;
    top: 80px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

#he-chat-window.open {
    display: flex;
}

#he-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0a0a0a;
}

#he-chat-header .title {
    font-size: 15px;
    letter-spacing: 2px;
    color: #c9a96e;
}

#he-chat-header .subtitle {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

#he-chat-close {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

#he-chat-close:hover { color: #c9a96e; }

#he-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#he-chat-messages::-webkit-scrollbar { width: 4px; }
#he-chat-messages::-webkit-scrollbar-track { background: transparent; }
#he-chat-messages::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.he-message {
    max-width: 85%;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.8;
    word-break: break-word;
}

.he-message.user {
    align-self: flex-end;
    background: #c9a96e;
    color: #0a0a0a;
}

.he-message.bot {
    align-self: flex-start;
    background: #1a1a1a;
    color: #aaa;
    border: 1px solid #2a2a2a;
}

.he-message.bot a { color: #c9a96e; text-decoration: none; }
.he-message.bot strong { color: #ddd; font-weight: 400; }

.he-message .sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #2a2a2a;
    font-size: 11px;
    color: #666;
}

.he-message .sources a {
    color: #c9a96e;
    text-decoration: none;
    margin-right: 8px;
}

.he-message .typing {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 20px;
}

.he-message .typing span {
    width: 6px;
    height: 6px;
    background: #c9a96e;
    border-radius: 50%;
    animation: heTyping 1.4s infinite ease-in-out both;
}

.he-message .typing span:nth-child(1) { animation-delay: 0s; }
.he-message .typing span:nth-child(2) { animation-delay: 0.2s; }
.he-message .typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes heTyping {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

#he-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #2a2a2a;
    display: flex;
    gap: 8px;
    background: #0a0a0a;
}

#he-chat-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    padding: 10px 14px;
    color: #e8e8e8;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    resize: none;
    height: 40px;
    line-height: 1.5;
}

#he-chat-input::placeholder { color: #555; }
#he-chat-input:focus { border-color: #c9a96e; }

#he-chat-send {
    background: #c9a96e;
    border: none;
    border-radius: 4px;
    color: #0a0a0a;
    padding: 0 16px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: opacity 0.3s;
}

#he-chat-send:hover { opacity: 0.9; }
#he-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 480px) {
    #he-chat-window {
        width: 100vw;
        max-width: 100vw;
        right: 0;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}
