/**
 * OpenRouter AI Assistant - 样式文件
 */

/* 小工具样式 */
.ai-assistant-widget-content {
    text-align: center;
}

.ai-assistant-link {
    margin-bottom: 20px;
}

.ai-assistant-button {
    display: inline-block;
    background: #4299e1;
    color: white !important;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none !important;
    font-weight: 600;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}

.ai-assistant-button:hover {
    background: #3182ce;
    color: white !important;
}

.ai-assistant-description {
    font-size: 14px;
    color: #718096;
    margin-top: 10px;
    font-style: italic;
}

.ai-assistant-embedded-chat {
    margin-top: 20px;
}

/* 浮动按钮样式 */
.ai-assistant-floating-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #4299e1;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    transition: all 0.3s ease;
    border: none;
}

.ai-assistant-floating-button:hover {
    background: #3182ce;
    transform: scale(1.1);
}

/* 浮动聊天窗口 */
.ai-assistant-floating-chat {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ai-assistant-floating-chat.active {
    display: flex;
}

.ai-assistant-chat-header {
    background: #4299e1;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-assistant-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-assistant-close-button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-assistant-close-button:hover {
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
}

/* 原有样式保持不变 */
.openrouter-ai-chat {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 深色主题 */
.openrouter-ai-chat[data-theme="dark"] {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

/* 聊天头部 */
.chat-header {
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.openrouter-ai-chat[data-theme="dark"] .chat-header {
    background: #1a202c;
    border-bottom-color: #4a5568;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
}

.openrouter-ai-chat[data-theme="dark"] .chat-header h3 {
    color: #e2e8f0;
}

.clear-chat {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.clear-chat:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

.openrouter-ai-chat[data-theme="dark"] .clear-chat:hover {
    background: rgba(255,255,255,0.1);
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

.openrouter-ai-chat[data-theme="dark"] .chat-messages {
    background: #2d3748;
}

.message {
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.role {
    font-weight: 600;
    color: #4a5568;
}

.openrouter-ai-chat[data-theme="dark"] .role {
    color: #a0aec0;
}

.timestamp {
    color: #a0aec0;
    font-size: 11px;
}

.openrouter-ai-chat[data-theme="dark"] .timestamp {
    color: #718096;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* 用户消息 */
.user-message .message-content {
    background: #4299e1;
    color: white;
    margin-left: 20%;
    text-align: right;
}

.openrouter-ai-chat[data-theme="dark"] .user-message .message-content {
    background: #3182ce;
}

.user-message .role {
    color: #4299e1;
    text-align: right;
}

.openrouter-ai-chat[data-theme="dark"] .user-message .role {
    color: #63b3ed;
}

/* AI消息 */
.assistant-message .message-content {
    background: #edf2f7;
    color: #2d3748;
    margin-right: 20%;
    border: 1px solid #e2e8f0;
}

.openrouter-ai-chat[data-theme="dark"] .assistant-message .message-content {
    background: #4a5568;
    color: #e2e8f0;
    border-color: #718096;
}

.assistant-message .role {
    color: #38a169;
}

.openrouter-ai-chat[data-theme="dark"] .assistant-message .role {
    color: #68d391;
}

/* 搜索消息 */
.search-message .message-content {
    background: #e6f3ff;
    color: #0066cc;
    border: 1px solid #b3d9ff;
    font-style: italic;
    margin-right: 15%;
    margin-left: 15%;
}

.openrouter-ai-chat[data-theme="dark"] .search-message .message-content {
    background: #1a365d;
    color: #63b3ed;
    border-color: #2c5aa0;
}

.search-message .role {
    color: #0066cc;
}

.openrouter-ai-chat[data-theme="dark"] .search-message .role {
    color: #63b3ed;
}

/* 错误消息 */
.error-message .message-content {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.openrouter-ai-chat[data-theme="dark"] .error-message .message-content {
    background: #742a2a;
    color: #fc8181;
    border-color: #e53e3e;
}

/* 临时消息（思考中） */
.temporary {
    opacity: 0.7;
}

.temporary .message-content {
    font-style: italic;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 输入区域 */
.chat-input-area {
    border-top: 1px solid #e2e8f0;
    padding: 20px;
    background: #fff;
}

.openrouter-ai-chat[data-theme="dark"] .chat-input-area {
    border-top-color: #4a5568;
    background: #1a202c;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 45px;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
}

#chat-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.openrouter-ai-chat[data-theme="dark"] #chat-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.openrouter-ai-chat[data-theme="dark"] #chat-input:focus {
    border-color: #63b3ed;
    box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
}

.send-btn {
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.send-btn:hover:not(:disabled) {
    background: #3182ce;
}

.send-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.openrouter-ai-chat[data-theme="dark"] .send-btn {
    background: #3182ce;
}

.openrouter-ai-chat[data-theme="dark"] .send-btn:hover:not(:disabled) {
    background: #2c5aa0;
}

/* 状态区域 */
.chat-status {
    padding: 8px 20px;
    font-size: 12px;
    color: #718096;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    min-height: 16px;
}

.openrouter-ai-chat[data-theme="dark"] .chat-status {
    background: #1a202c;
    border-top-color: #4a5568;
    color: #a0aec0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .openrouter-ai-chat {
        height: 400px !important;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .chat-input-area {
        padding: 15px;
    }
    
    .message-content {
        margin-left: 10% !important;
        margin-right: 10% !important;
    }
    
    .input-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .send-btn {
        align-self: stretch;
    }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.openrouter-ai-chat[data-theme="dark"] .chat-messages::-webkit-scrollbar-track {
    background: #4a5568;
}

.openrouter-ai-chat[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb {
    background: #718096;
}

.openrouter-ai-chat[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* 代码样式 */
.message-content code {
    background: rgba(0,0,0,0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.openrouter-ai-chat[data-theme="dark"] .message-content code {
    background: rgba(255,255,255,0.1);
}

/* 强调文本 */
.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

/* 链接样式 */
.message-content a {
    color: #4299e1;
    text-decoration: underline;
    word-break: break-all;
}

.message-content a:hover {
    color: #3182ce;
}

.openrouter-ai-chat[data-theme="dark"] .message-content a {
    color: #63b3ed;
}

.openrouter-ai-chat[data-theme="dark"] .message-content a:hover {
    color: #90cdf4;
}
