/* 湖银 · AI 聊天助手浮窗（LobeChat 风格） */
#huyin-chat-widget {
    font-family: "PingFang SC", "Microsoft YaHei", "Inter", sans-serif;
    position: fixed;
    z-index: 99998;
    bottom: 24px;
    right: 24px;
}

/* 悬浮按钮：使用公司 logo */
#huyin-chat-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    background: #0a0a0a;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
#huyin-chat-fab img {
    width: 168%;
    height: 168%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}
#huyin-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
#huyin-chat-fab:active {
    transform: scale(0.98);
}

/* 抽屉面板：默认半屏 · 玻璃底 */
#huyin-chat-drawer {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 50vh;
    min-height: 320px;
    max-height: min(100vh, 100dvh);
    background: rgba(20, 18, 16, 0.72);
    color: #f3efe8;
    backdrop-filter: blur(28px) saturate(1.25);
    -webkit-backdrop-filter: blur(28px) saturate(1.25);
    border: 1px solid rgba(246, 243, 238, 0.1);
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.38);
    display: none;
    flex-direction: column;
    border-radius: 22px 22px 0 0;
    overflow: hidden;
    transition: height 0.25s ease, top 0.25s ease, bottom 0.25s ease;
}
#huyin-chat-drawer.open {
    display: flex;
    animation: huyin-drawer-in 0.25s ease-out;
}
/* 全屏模式 */
#huyin-chat-drawer.fullscreen {
    top: 0;
    bottom: auto;
    height: 100vh;
    max-height: 100vh;
    border-radius: 22px 0 0 22px;
}
@keyframes huyin-drawer-in {
    from { transform: translateX(100%); opacity: 0.8; }
    to { transform: translateX(0); opacity: 1; }
}

/* 头部 */
#huyin-chat-header {
    padding: 14px 14px 8px 18px;
    background: transparent;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#huyin-chat-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}
#huyin-chat-title img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: #f3eee6;
    box-shadow: 0 0 0 1px rgba(212, 165, 116, 0.28);
}
.huyin-chat-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}
#huyin-chat-close,
#huyin-chat-expand {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: rgba(243, 239, 232, 0.58);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}
#huyin-chat-close:hover,
#huyin-chat-expand:hover {
    background: rgba(246, 243, 238, 0.08);
    color: #f6f3ee;
}
#huyin-chat-close svg,
#huyin-chat-expand svg,
#huyin-chat-send svg {
    display: block;
    pointer-events: none;
}

/* 消息区域 */
#huyin-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}
#huyin-chat-messages .msg {
    max-width: 88%;
    padding: 11px 16px;
    border-radius: 18px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
}
#huyin-chat-messages .msg.user {
    align-self: flex-end;
    background: rgba(212, 165, 116, 0.22);
    color: #f6f3ee;
    border: 1px solid rgba(212, 165, 116, 0.22);
    border-bottom-right-radius: 6px;
}
#huyin-chat-messages .msg.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    border-bottom-left-radius: 6px;
}
#huyin-chat-messages .msg.assistant.streaming {
    background: rgba(212, 165, 116, 0.08);
}
#huyin-chat-messages .msg.error {
    align-self: flex-start;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* 输入区 · 一条胶囊 */
#huyin-chat-input-wrap {
    padding: 8px 14px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    background: transparent;
    border-top: none;
    flex-shrink: 0;
}
#huyin-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 6px 6px 6px 16px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(246, 243, 238, 0.1);
    transition: border-color 0.2s, background 0.2s;
}
#huyin-chat-input-row:focus-within {
    border-color: rgba(212, 165, 116, 0.45);
    background: rgba(255, 255, 255, 0.08);
}
#huyin-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 8px 0;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #f3efe8;
    font-size: 14px;
    resize: none;
    font-family: inherit;
}
#huyin-chat-input::placeholder {
    color: rgba(243, 239, 232, 0.38);
}
#huyin-chat-input:focus {
    outline: none;
    border-color: transparent;
}
#huyin-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(160deg, #ead3b0 0%, #d4a574 100%);
    color: #1c1814;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.2s;
}
#huyin-chat-send:hover:not(:disabled) {
    opacity: 0.95;
    transform: scale(1.04);
}
#huyin-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 遮罩 */
#huyin-chat-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99997;
    display: none;
}
#huyin-chat-backdrop.show {
    display: block;
    animation: huyin-fade-in 0.2s ease-out;
}
@keyframes huyin-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 480px) {
    #huyin-chat-drawer {
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        min-height: 280px;
    }
    #huyin-chat-drawer.fullscreen {
        border-radius: 0;
    }
    #huyin-chat-widget { bottom: 16px; right: 16px; }
}
