/* AI 助手悬浮按钮和聊天窗口 */
.ai-assistant-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899, #f97316);
    color: white;
    border: none;
    cursor: grab;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(236,72,153,0.3);
    transition: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.ai-assistant-trigger:active {
    cursor: grabbing;
}

.ai-assistant-trigger svg {
    width: 28px;
    height: 28px;
    display: block;
}

.ai-assistant-trigger:hover {
    box-shadow: 0 6px 28px rgba(236,72,153,0.5);
}

.ai-assistant-trigger .trigger-tooltip {
    position: absolute;
    right: 64px;
    background: white;
    color: #1e293b;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8125rem;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.ai-assistant-trigger:hover .trigger-tooltip {
    opacity: 1;
}

/* 聊天窗口 */
.ai-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    height: 520px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s ease;
}

.ai-chat-window.open {
    display: flex;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 聊天头部 */
.ai-chat-header {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ai-chat-header .avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-header .avatar svg {
    width: 22px;
    height: 22px;
    display: block;
}

.ai-chat-header .header-info {
    flex: 1;
}

.ai-chat-header .header-info h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.ai-chat-header .header-info .status {
    font-size: 0.75rem;
    opacity: 0.8;
}

.ai-lang-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    margin-right: 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.ai-lang-option {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s;
}

.ai-lang-option:hover {
    color: rgba(255,255,255,0.85);
}

.ai-lang-option.lang-active {
    color: #fff;
    background: rgba(255,255,255,0.2);
}

.ai-lang-divider {
    color: rgba(255,255,255,0.3);
    font-weight: 400;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px;
}

.ai-chat-close:hover {
    opacity: 1;
}

/* 聊天消息区 */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.ai-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: msgIn 0.3s ease;
}

.ai-message.ai {
    align-self: flex-start;
}

.ai-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-message .bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.ai-message.ai .bubble {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.ai-message.user .bubble {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message .msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.ai-message.ai .msg-avatar {
    background: transparent;
    overflow: hidden;
}

.ai-message.ai .msg-avatar::before {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: url('../images/lucky-funemoji.svg') center/cover no-repeat;
    border-radius: 50%;
}

.ai-message.user .msg-avatar {
    background: #e2e8f0;
    color: #64748b;
}

/* 快捷回复 */
.ai-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border-top: 1px solid #f1f5f9;
}

.quick-reply-btn {
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.8125rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* 输入区 */
.ai-chat-input {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    background: white;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.ai-chat-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input input:focus {
    border-color: #2563eb;
}

.ai-chat-input button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-input button:hover {
    opacity: 0.9;
}

/* 打字动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 移动端适配 */
@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 16px);
        height: 60vh;
    }
}
