/* iModel Chat Integration - CSS */

/* 聊天窗口容器 */
.imodel-chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* 聊天按钮 */
.imodel-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #2c3e50;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.imodel-chat-button:hover {
    background-color: #34495e;
    transform: scale(1.05);
}

/* 聊天窗口 */
.imodel-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    max-width: 90vw;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: none;
    animation: slideUp 0.3s ease;
}

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

/* 聊天窗口头部 */
.imodel-chat-header {
    background-color: #2c3e50;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.imodel-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.imodel-chat-close {
    background: none;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.imodel-chat-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 聊天窗口内容 */
.imodel-chat-content {
    padding: 20px;
}

/* 表单样式 */
.imodel-chat-form .form-group {
    margin-bottom: 16px;
}

.imodel-chat-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.imodel-chat-form input,
.imodel-chat-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.imodel-chat-form input:focus,
.imodel-chat-form textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.imodel-chat-form textarea {
    min-height: 100px;
    resize: vertical;
}

/* 提交按钮 */
.imodel-chat-submit {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.imodel-chat-submit:hover {
    background-color: #2980b9;
}

.imodel-chat-submit:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* 消息提示 */
.imodel-chat-message {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    display: none;
}

.imodel-chat-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.imodel-chat-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Markdown 样式 */
.imodel-chat-messages h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 10px 0 5px 0;
    color: #333;
}

.imodel-chat-messages h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 8px 0 4px 0;
    color: #333;
}

.imodel-chat-messages ul,
.imodel-chat-messages ol {
    margin: 5px 0 5px 20px;
    padding-left: 10px;
}

.imodel-chat-messages li {
    margin: 3px 0;
}

.imodel-chat-messages code {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.imodel-chat-messages pre {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 5px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.imodel-chat-messages blockquote {
    border-left: 3px solid #3498db;
    padding-left: 10px;
    margin: 5px 0;
    color: #666;
}

.imodel-chat-messages p {
    margin: 5px 0;
}

/* 消息项样式 */
.imodel-chat-message-item {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
}

/* 用户消息 */
.imodel-chat-message-item.user-message {
    justify-content: flex-end;
}

/* AI消息 */
.imodel-chat-message-item.ai-message {
    justify-content: flex-start;
}

/* 头像样式 */
.imodel-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 8px;
    background-color: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

/* 用户消息气泡 */
.imodel-chat-message-item.user-message .imodel-message-bubble {
    background-color: #2c3e50;
    color: white;
    padding: 10px 14px;
    border-radius: 18px 18px 4px 18px;
    max-width: 75%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* AI消息气泡 */
.imodel-chat-message-item.ai-message .imodel-message-bubble {
    background-color: #f0f0f0;
    color: #333;
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    max-width: 75%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 消息内容 */
.imodel-message-content {
    font-size: 14px;
    line-height: 1.4;
}

/* 按钮容器 */
.imodel-top-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

/* 顶部按钮 - 胶囊状 */
.imodel-chat-input-area .imodel-top-buttons .imodel-top-button {
    padding: 3px 10px !important;
    border-radius: 16px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: 1px solid #d0d0d0 !important;
    background-color: transparent !important;
    color: #333 !important;
    white-space: nowrap !important;
    font-weight: 500 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.imodel-chat-input-area .imodel-top-buttons .imodel-top-button:hover {
    border-color: #999999 !important;
    color: #333 !important;
    background-color: transparent !important;
}

/* 输入区域容器 */
.imodel-input-container {
    position: relative;
    margin-bottom: 10px;
}

/* 输入框 */
#imodel-ai-message {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    resize: none;
    min-height: 40px;
    box-sizing: border-box;
    font-size: 14px;
    outline: none;
    background-color: #f5f5f5;
    transition: all 0.3s ease;
}

#imodel-ai-message:focus {
    border-color: #3498db;
    background-color: white;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

/* 发送按钮 */
.imodel-input-container .imodel-ai-submit {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 20px !important;
    height: 20px !important;
    background: none !important;
    border: none !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: none !important;
    color: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-shadow: none !important;
}

.imodel-input-container .imodel-ai-submit:hover {
    color: #000 !important;
    transform: translateY(-50%) !important;
}

.imodel-input-container .imodel-ai-submit:disabled {
    color: #bdc3c7 !important;
    cursor: not-allowed !important;
    transform: translateY(-50%) !important;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .imodel-chat-container {
        bottom: 20px;
        right: 20px;
    }
    
    .imodel-chat-window {
        width: 300px;
    }
    
    .imodel-top-buttons {
        flex-wrap: wrap;
    }
    
    .imodel-input-container {
        flex-wrap: wrap;
    }
    
    .imodel-ai-submit {
        width: 20px !important;
        margin-top: 0 !important;
        position: absolute !important;
        right: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
}