/* 湖银 · 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: #fff;
    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: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#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: #1a1a1e;
    color: #e4e4e7;
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    border-radius: 16px 16px 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: 16px 0 0 16px;
}
@keyframes huyin-drawer-in {
    from { transform: translateX(100%); opacity: 0.8; }
    to { transform: translateX(0); opacity: 1; }
}

/* 头部 */
#huyin-chat-header {
    padding: 16px 20px;
    background: rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#huyin-chat-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
#huyin-chat-title img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
#huyin-chat-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: #a1a1aa;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
#huyin-chat-close:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
/* 半屏/全屏切换按钮 */
#huyin-chat-expand {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: #a1a1aa;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    transition: background 0.2s, color 0.2s;
}
#huyin-chat-expand:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* 消息区域 */
#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: 10px 14px;
    border-radius: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
}
#huyin-chat-messages .msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #07d96c 0%, #05b858 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
#huyin-chat-messages .msg.assistant {
    align-self: flex-start;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-bottom-left-radius: 4px;
}
#huyin-chat-messages .msg.assistant.streaming {
    border-color: rgba(7, 217, 108, 0.3);
}
#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: 12px 16px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
#huyin-chat-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
#huyin-chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #e4e4e7;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
#huyin-chat-input::placeholder {
    color: #71717a;
}
#huyin-chat-input:focus {
    outline: none;
    border-color: #07d96c;
}
#huyin-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #07d96c 0%, #05b858 100%);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    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.02);
}
#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; }
}
