/* AI智能咨询组件样式 */

.ai-chat-widget {
    position: fixed;
    z-index: 9999;
}

/* 浮动按钮 - 优化版 */
.ai-chat-button {
    position: fixed;
    right: 30px;
    bottom: 150px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #f4d9a8 0%, #e6bf88 50%, #d4a574 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 8px 32px rgba(230, 191, 136, 0.5), 0 0 0 0 rgba(230, 191, 136, 0.4);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #1a1a1a;
    user-select: none;
    z-index: 9998;
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: buttonFloat 3s ease-in-out infinite;
    touch-action: none; /* 允许JavaScript完全控制触摸行为 */
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

.ai-chat-button::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(135deg, #f4d9a8, #e6bf88, #d4a574);
    border-radius: 50%;
    opacity: 0;
    filter: blur(12px);
    z-index: -1;
    transition: opacity 0.4s ease;
}

.ai-chat-button:hover::before {
    opacity: 0.8;
}

@keyframes buttonFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

.ai-chat-button-text {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.ai-chat-button:active {
    cursor: grabbing;
    animation: none;
}

.ai-chat-button:hover {
    transform: scale(1.15) translateY(-4px);
    box-shadow: 0 16px 48px rgba(230, 191, 136, 0.8), 0 0 60px rgba(230, 191, 136, 0.4);
}

.ai-chat-button.active {
    transform: scale(0.95);
    animation: none;
}

.ai-chat-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ef4444 100%);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    z-index: 2;
}

/* 聊天面板 */
.ai-chat-panel {
    position: fixed;
    right: 30px;
    bottom: 230px;
    width: 400px;
    height: 620px;
    max-height: calc(100vh - 270px);
    background: linear-gradient(180deg, #1f1f1f 0%, #1a1a1a 100%);
    border: 1px solid rgba(230, 191, 136, 0.3);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(230, 191, 136, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    z-index: 9998;
    backdrop-filter: blur(20px);
}

.ai-chat-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: radial-gradient(circle at 50% 0%, rgba(230, 191, 136, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.ai-chat-panel.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 头部 */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(230, 191, 136, 0.12) 0%, rgba(212, 165, 116, 0.06) 100%);
    border-bottom: 1px solid rgba(230, 191, 136, 0.15);
    position: relative;
    z-index: 1;
}

.ai-chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 24px;
    right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(230, 191, 136, 0.3) 50%, transparent 100%);
}

.ai-chat-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ai-chat-avatar {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #f4d9a8 0%, #e6bf88 50%, #d4a574 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    font-size: 20px;
    font-weight: 700;
    box-shadow: 
        0 4px 16px rgba(230, 191, 136, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.ai-chat-avatar::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 15%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(2px);
}

.ai-chat-title {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ai-chat-status {
    color: #4ade80;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.ai-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #999;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: rotate(90deg);
}

/* 消息区域 */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(230, 191, 136, 0.3);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(230, 191, 136, 0.5);
}

/* 欢迎消息 */
.ai-chat-welcome {
    text-align: center;
    padding: 40px 20px;
}

.ai-chat-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ai-chat-welcome h3 {
    color: #fff;
    font-size: 18px;
    margin-bottom: 8px;
}

.ai-chat-welcome p {
    color: #999;
    font-size: 14px;
    margin-bottom: 24px;
}

.ai-chat-quick-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-question {
    background: linear-gradient(135deg, rgba(230, 191, 136, 0.08) 0%, rgba(212, 165, 116, 0.05) 100%);
    border: 1px solid rgba(230, 191, 136, 0.25);
    color: #e6bf88;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.quick-question::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(230, 191, 136, 0.2), transparent);
    transition: left 0.5s;
}

.quick-question:hover::before {
    left: 100%;
}

.quick-question:hover {
    background: linear-gradient(135deg, rgba(230, 191, 136, 0.15) 0%, rgba(212, 165, 116, 0.1) 100%);
    border-color: rgba(230, 191, 136, 0.5);
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 4px 16px rgba(230, 191, 136, 0.2);
}

/* 消息气泡 */
.ai-chat-message {
    display: flex;
    gap: 12px;
    animation: messageSlideIn 0.3s ease;
}

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

.ai-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.ai-chat-message-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.ai-chat-message-user {
    flex-direction: row-reverse;
}

.ai-chat-message-user .ai-chat-message-content {
    background: linear-gradient(135deg, #e6bf88 0%, #d4a574 100%);
    color: #1a1a1a;
    border-bottom-right-radius: 4px;
}

.ai-chat-message-ai .ai-chat-message-content {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-bottom-left-radius: 4px;
}

/* 输入中状态 */
.ai-chat-typing {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ai-chat-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.ai-chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: #e6bf88;
    border-radius: 50%;
    animation: typingDot 1.4s ease-in-out infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 输入区域 */
.ai-chat-input-area {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(230, 191, 136, 0.1);
}

.ai-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: all 0.2s;
}

.ai-chat-input:focus {
    outline: none;
    border-color: rgba(230, 191, 136, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.ai-chat-input::placeholder {
    color: #666;
}

.ai-chat-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #e6bf88 0%, #d4a574 100%);
    border: none;
    border-radius: 12px;
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(230, 191, 136, 0.4);
}

.ai-chat-send:active {
    transform: scale(0.95);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-chat-panel {
        right: 10px;
        bottom: 140px;
        width: calc(100vw - 20px);
        max-width: 380px;
        height: calc(100vh - 180px);
        max-height: 600px;
    }
    
    .ai-chat-button {
        right: 20px;
        bottom: 80px;
        width: 56px;
        height: 56px;
    }
}
