/* AI Assistant Proxy Styles */

.ai-assistant-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.ai-assistant-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-assistant-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.ai-assistant-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.ai-chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.ai-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.ai-message.user {
    align-items: flex-end;
}

.ai-message.ai {
    align-items: flex-start;
}

.ai-message.system {
    align-items: center;
}

.ai-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.ai-message.user .ai-message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 5px;
}

.ai-message.ai .ai-message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
}

.ai-message.system .ai-message-content {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    font-size: 12px;
    max-width: 90%;
    text-align: center;
}

.ai-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 16px;
}

.ai-chat-input {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-input-field {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s;
}

.ai-input-field:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.ai-send-button {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 16px;
}

.ai-send-button:hover:not(:disabled) {
    background: #5a67d8;
}

.ai-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    font-size: 14px;
    padding: 10px 20px;
}

.ai-loading-dots {
    display: inline-block;
}

.ai-loading-dots:after {
    content: '';
    animation: loading-dots 1.5s linear infinite;
}

@keyframes loading-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-assistant-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .ai-message-content {
        max-width: 90%;
    }
    
    .ai-chat-input {
        padding: 10px 15px;
    }
    
    .ai-input-field {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 深色主题 */
.ai-assistant-container.dark-theme {
    background: #2d2d2d;
    border-color: #404040;
}

.ai-assistant-container.dark-theme .ai-chat-messages {
    background: #1e1e1e;
}

.ai-assistant-container.dark-theme .ai-message.ai .ai-message-content {
    background: #3d3d3d;
    color: #fff;
    border-color: #555;
}

.ai-assistant-container.dark-theme .ai-chat-input {
    background: #2d2d2d;
    border-color: #404040;
}

.ai-assistant-container.dark-theme .ai-input-field {
    background: #3d3d3d;
    color: #fff;
    border-color: #555;
}

/* 错误状态 */
.ai-error-message {
    background: #fee;
    color: #c53030;
    border: 1px solid #fed7d7;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 20px;
    font-size: 14px;
}

/* 成功状态 */
.ai-success-message {
    background: #f0fff4;
    color: #38a169;
    border: 1px solid #c6f6d5;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 20px;
    font-size: 14px;
}

/* 代码块样式 */
.ai-message-content pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
    border: 1px solid #e0e0e0;
}

.ai-message-content code {
    background: #f1f3f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 85%;
    font-family: 'Courier New', monospace;
}

/* 列表样式 */
.ai-message-content ul,
.ai-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message-content li {
    margin-bottom: 4px;
}

/* 链接样式 */
.ai-message-content a {
    color: #667eea;
    text-decoration: none;
}

.ai-message-content a:hover {
    text-decoration: underline;
}