/* ==================== AI助手样式 ==================== */

.ai-assistant {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 3000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 浮动按钮 */
.ai-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: aiPulse 2s infinite;
}

.ai-button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

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

.ai-button i {
    font-size: 1.5rem;
}

/* 未读标记 */
.ai-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    background: #f5576c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 3px solid var(--dark);
    animation: badgeBounce 0.6s ease-in-out infinite alternate;
}

@keyframes aiPulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 8px 36px rgba(102, 126, 234, 0.6);
    }
}

@keyframes badgeBounce {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.1);
    }
}

/* 主面板 */
.ai-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 420px;
    height: 650px;
    background: var(--dark-light);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(102, 126, 234, 0.3);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-panel.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* 头部 */
.ai-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 20px 20px 0 0;
}

.ai-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ai-info {
    flex: 1;
}

.ai-info h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
}

.ai-status {
    margin: 0.2rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #43e97b;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.ai-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* 快捷功能 */
.ai-shortcuts {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.ai-shortcut {
    flex: 1;
    min-width: 100px;
    padding: 0.6rem 0.8rem;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    color: #667eea;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
}

.ai-shortcut:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.ai-shortcut i {
    font-size: 1.2rem;
}

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

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

.ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.ai-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* 消息 */
.ai-message {
    display: flex;
    gap: 0.8rem;
    animation: messageSlide 0.3s ease-out;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.message-avatar.user-avatar {
    background: linear-gradient(135deg, #43e97b 0%, #38d39f 100%);
}

.message-content {
    flex: 1;
    max-width: 80%;
}

.message-text {
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.1);
    color: var(--text);
    line-height: 1.6;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 消息按钮 */
.message-buttons {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.msg-button {
    padding: 0.7rem 1rem;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.msg-button:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateX(4px);
}

.msg-button i {
    font-size: 0.9rem;
}

/* 提示 */
.message-tips {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: rgba(67, 233, 123, 0.1);
    border-left: 3px solid #43e97b;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.tip-item i {
    color: #43e97b;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

/* 输入区域 */
.ai-input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.8rem;
    align-items: center;
    background: var(--dark-lighter);
    border-radius: 0 0 20px 20px;
}

.ai-input {
    flex: 1;
    padding: 0.8rem 1rem;
    background: var(--dark-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.ai-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-input::placeholder {
    color: var(--text-muted);
}

.ai-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-send:active {
    transform: translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
    .ai-assistant {
        bottom: 1rem;
        right: 1rem;
    }
    
    .ai-button {
        width: 56px;
        height: 56px;
    }
    
    .ai-panel {
        width: calc(100vw - 2rem);
        height: calc(100vh - 2rem);
        bottom: 1rem;
        right: 1rem;
        max-width: 400px;
    }
}

/* 特殊消息样式 */
.message-text strong {
    color: #667eea;
    font-weight: 600;
}

.message-text em {
    color: #43e97b;
    font-style: normal;
}

/* 代码样式 */
.message-text code {
    padding: 0.2rem 0.4rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}
