/* 浮动按钮 */
.ollama-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ollama-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.ollama-chat-toggle .chat-icon {
    font-size: 28px;
}

/* 聊天窗口 */
.ollama-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ollama-chat-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* 头部 */
.ollama-chat-header {
    display: flex;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ollama-chat-header h3 {
    margin: 0;
    flex-grow: 1;
    font-size: 16px;
    font-weight: 600;
}

.ollama-model-select {
    margin-left: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 12px;
    cursor: pointer;
    max-width: 100px;
}

.ollama-model-select option {
    color: #333;
}

.ollama-chat-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 0 0 12px;
    line-height: 1;
}

/* 消息区域 */
.ollama-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.ollama-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.ollama-message-user {
    align-items: flex-end;
}

.ollama-message-assistant {
    align-items: flex-start;
}

.ollama-message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.ollama-message-user .ollama-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.ollama-message-assistant .ollama-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* 欢迎消息 */
.ollama-welcome {
    text-align: center;
    padding: 20px;
    color: #666;
}

.ollama-welcome .bot-name {
    font-weight: bold;
    color: #667eea;
}

/* Markdown样式 */
.ollama-message-content pre {
    background: #f4f4f4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.ollama-message-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.ollama-message-content pre code {
    background: transparent;
    padding: 0;
}

.ollama-message-content ul,
.ollama-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ollama-message-content p {
    margin: 8px 0;
}

.ollama-message-content p:first-child {
    margin-top: 0;
}

.ollama-message-content p:last-child {
    margin-bottom: 0;
}

/* 输入区域 */
.ollama-chat-input-area {
    display: flex;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #eee;
    gap: 8px;
}

#ollama-chat-input {
    flex-grow: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    max-height: 120px;
    line-height: 1.4;
}

#ollama-chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.ollama-chat-send {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.ollama-chat-send:hover {
    transform: scale(1.05);
}

.ollama-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 打字指示器 */
.ollama-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ollama-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.ollama-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ollama-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* 错误消息 */
.ollama-error {
    color: #e74c3c;
    font-size: 12px;
    padding: 8px;
    text-align: center;
}

/* 响应式 */
@media (max-width: 480px) {
    .ollama-chat-window {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .ollama-chat-toggle {
        bottom: 16px;
        right: 16px;
    }
}