/* ========== AI 弹窗对话框样式 ========== */

.ai-modal-container {
    width: 90vw;
    max-width: 600px;
    height: 70vh;
    max-height: 700px;
    background: var(--card-bg, white);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 头部 */
.ai-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.ai-modal-icon {
    font-size: 1.5rem;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(10deg); }
}

.ai-modal-actions {
    display: flex;
    gap: 8px;
}

.ai-modal-actions .btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
}

.ai-modal-actions .btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 消息区域 */
.ai-modal-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg, #f9fafb);
    scroll-behavior: smooth;
}

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

.ai-modal-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* 欢迎语 */
.ai-welcome {
    text-align: center;
    padding: 60px 20px;
    animation: fadeIn 0.6s ease;
}

.ai-welcome-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.ai-welcome h3 {
    font-size: 1.5rem;
    color: var(--text, #111827);
    margin-bottom: 8px;
}

.ai-welcome p {
    color: var(--text-sub, #6b7280);
}

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

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

/* 消息气泡 */
.ai-modal-message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    opacity: 0;
    animation: messageSlideIn 0.4s ease forwards;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ai-modal-message.user {
    flex-direction: row-reverse;
    animation: messageSlideIn 0.4s ease forwards;
}

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

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

.ai-modal-message.user .message-avatar {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
}

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

/* 加载动画 */
.ai-loading {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ai-loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* 输入区域 */
.ai-modal-input-container {
    padding: 16px 24px 20px;
    background: var(--card-bg, white);
    border-top: 1px solid var(--border, #e5e7eb);
}

.ai-modal-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: var(--bg, #f9fafb);
    border: 2px solid var(--border, #e5e7eb);
    border-radius: 20px;
    padding: 10px 12px;
    transition: all 0.3s ease;
}

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

.ai-modal-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text, #111827);
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
}

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

.ai-modal-send-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.send-icon {
    font-size: 1.1rem;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ai-modal-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .message-content {
        max-width: 80%;
    }
}
