/**
 * AI智能助手样式
 */

/* AI助手弹框 */
.ai-assistant-modal {
    display: none;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ai-assistant-container {
    width: 380px;
    height: 100%;
    background: #fff;
    box-shadow: -5px 0 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-assistant-header {
    background: linear-gradient(180deg, #e6f7ff 0%, #ffffff 100%);
    color: #444;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-header-title {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
}

.ai-header-title .ai-header-icon {
    margin-right: 8px;
}

.ai-close-btn {
    background: none;
    border: none;
    color: #333;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-close-btn:hover {
    opacity: 1;
}

.ai-assistant-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fff;
}

/* AI助手滚动条样式 */
.ai-assistant-body::-webkit-scrollbar {
    width: 4px;
}

.ai-assistant-body::-webkit-scrollbar-track {
    background: transparent;
}

.ai-assistant-body::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 2px;
}

.ai-assistant-body::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

.ai-message {
    display: flex;
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-message-bot {
    flex-direction: row;
    justify-content: flex-start;
}

.ai-message-user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.ai-content {
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
}

/* Markdown样式 */
.ai-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 12px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.ai-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: #444;
    margin: 10px 0 6px 0;
}

.ai-content strong {
    font-weight: 600;
    color: #1890ff;
}

.ai-content em {
    font-style: italic;
    color: #666;
}

.ai-content ol ul, .ai-content ol {
    margin: 8px 0;
    padding-left: 1.2em;
}

.ai-content ol {
    list-style-type: decimal;
}
.ai-content ul {
    list-style-type: disc;
	padding-inline-start: 18px;
}


.ai-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.ai-content blockquote {
    margin: 10px 0;
    padding: 8px 12px;
    background: #f5f7fa;
    border-left: 3px solid #667eea;
    color: #666;
    font-size: 13px;
}

.ai-content pre {
    margin: 10px 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    overflow-x: auto;
}

.ai-content code {
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}

.ai-content .inline-code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    color: #e83e8c;
}

.ai-message-bot .ai-content {
    background: #f5f7fb;
    border-radius: 0px 12px 12px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ai-message-user .ai-content {
    background: linear-gradient(45deg, #eaf6ff 0% 20%, #cecae3 100%);
    color: #333;
    border-radius: 12px 0px 12px 12px;
}

.ai-content p {
    margin: 0 0 8px 0;
}

.ai-content p:last-child {
    margin-bottom: 0;
}

.ai-tips {
    color: #666;
    font-size: 13px;
}

.ai-quick-questions {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
	padding-inline-start:0 !important;
}

.ai-quick-questions li {
    display: inline-block;
    background: #fff;
    color: #1890ff;
    padding: 6px 12px;
    border-radius: 15px;
    margin: 4px 4px 4px 0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-quick-questions li:hover {
    background: #1890ff;
    color: #fff;
}

.ai-assistant-footer {
    padding: 15px;
    background: #fff;
}

.ai-input-wrapper {
    display: flex;
    align-items: center;
    background: #f5f7fb;
    border-radius: 25px;
    padding: 5px 5px 5px 15px;
}

.ai-input-wrapper input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    padding: 8px 0;
}

.ai-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #00adeb 100%);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.ai-typing {
    display: flex;
    align-items: center;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1s infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* 加载文字样式 */
.ai-loading-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-loading-text {
    color: #667eea;
    font-size: 13px;
    font-weight: 500;
    opacity: 0.8;
    white-space: nowrap;
    transition: opacity 0.3s ease-in-out;
}

/* 移动端适配 - 全屏样式 */
@media (max-width: 768px) {
    .ai-assistant-modal {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .ai-assistant-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
    }
    
    .ai-assistant-header {
        padding: 12px 15px;
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    
    .ai-assistant-footer {
        padding: 10px 15px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }
    
    .ai-assistant-body {
        padding: 10px;
    }
    
    .ai-content {
        font-size: 15px;
    }
    
    .ai-input-wrapper input {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
}

/* AI按钮样式 */
#ai-assistant-btn {
    position: relative;
}

#ai-assistant-btn img {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#ai-assistant-btn em {
    display: none;
}

#ai-assistant-btn:hover img {
    display: none;
}

#ai-assistant-btn:hover em {
    display: block;
}
