/* ChatGPT风格样式 - 清淡配色版本 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f7f7f8;
    color: #374151;
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
}

/* 主布局 */
.chatgpt-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* 左侧边栏 */
.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: #10a37f;
    border: 1px solid #10a37f;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.new-chat-btn:hover {
    background: #0d8a6f;
    border-color: #0d8a6f;
    transform: translateY(-1px);
}

.new-chat-btn i {
    font-size: 16px;
}

/* 侧边栏内容 */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #ffffff;
}

.history-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
    padding: 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.empty-history {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
}

.empty-history i {
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-history p {
    font-size: 14px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
    text-decoration: none;
    border: 1px solid transparent;
}

.history-item:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    transform: translateX(2px);
}

/* 查看更多历史记录按钮样式 */
.view-more-history {
    text-align: center;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    color: #007cba;
    border: 1px solid #bbdefb;
    font-weight: 500;
}

.view-more-history:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #e1bee7 100%);
    border-color: #90caf9;
    transform: translateX(2px);
}

.view-more-history .history-icon {
    color: #007cba;
}

.view-more-history .history-title {
    color: #007cba;
    font-weight: 600;
}

.history-icon {
    width: 16px;
    height: 16px;
    color: #9ca3af;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-time {
    font-size: 12px;
    color: #9ca3af;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 14px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.footer-link:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #10a37f;
    transform: translateY(-1px);
}

/* 主聊天区域 */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
}

/* 聊天头部 */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.chat-title i {
    font-size: 18px;
    color: #10a37f;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #6b7280;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10a37f;
}

.status-dot.offline {
    background: #ef4444;
}

.status-dot.busy {
    background: #f59e0b;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #ffffff;
}

.message {
    display: flex;
    padding: 20px 0;
    border-bottom: 1px solid #f3f4f6;
}

.message:last-child {
    border-bottom: none;
}

.message.user {
    background: #ffffff;
    flex-direction: row-reverse;
}

.message.assistant {
    background: #f9fafb;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 16px 0 24px;
    flex-shrink: 0;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message.user .message-avatar {
    background: #10a37f;
    color: white;
    margin: 0 24px 0 16px;
}

.message.assistant .message-avatar {
    background: #6366f1;
    color: white;
}

/* AI头像图片样式 */
.ai-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #6366f1;
    display: block;
}

/* 用户头像图片样式 */
.user-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #10a37f;
    display: block;
}

/* 确保AI头像容器正确显示图片 */
.message.assistant .message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* 确保用户头像容器正确显示图片 */
.message.user .message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.message-content {
    flex: 1;
    padding: 0 24px 0 0;
    min-width: 0;
}

.message.user .message-content {
    padding: 0 0 0 24px;
    text-align: right;
}

.message-text {
    font-size: 16px;
    line-height: 1.6;
    color: #374151;
    word-wrap: break-word;
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 12px;
    display: inline-block;
    max-width: 80%;
}

.message.user .message-text {
    background: #10a37f;
    color: white;
    text-align: left;
}

.message.assistant .message-text {
    background: #f3f4f6;
    color: #374151;
}

/* 输入区域 */
.chat-input-container {
    padding: 20px 24px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
}

.input-wrapper {
    max-width: 768px;
    margin: 0 auto;
    position: relative;
}

.input-box {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.input-box:focus-within {
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

#questionInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #374151;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    font-family: inherit;
}

#questionInput::placeholder {
    color: #9ca3af;
}

.send-btn {
    width: 36px;
    height: 36px;
    background: #10a37f;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: #0d8a6f;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.send-btn i {
    font-size: 14px;
}

.input-footer {
    margin-top: 8px;
    text-align: center;
}

.input-tip {
    font-size: 12px;
    color: #9ca3af;
}

/* 加载指示器 */
.loading-indicator {
    display: none;
    padding: 20px 0;
    text-align: center;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.loading-dots {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 8px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10a37f;
    animation: loading 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loading {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-text {
    font-size: 14px;
    color: #6b7280;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .main-chat {
        width: 100%;
        /* 调整主聊天区域高度，为输入框留出更多空间 */
        height: 100vh;
        display: flex;
        flex-direction: column;
        position: relative;
    }
    
    .chat-header {
        padding: 12px 16px;
        flex-shrink: 0;
        position: relative;
        z-index: 10;
    }
    
    .chat-messages {
        flex: 1;
        overflow-y: auto;
        /* 增加底部内边距，确保输入框不被遮挡 */
        padding-bottom: 80px;
        position: relative;
        z-index: 1;
    }
    
    .chat-input-container {
        padding: 16px;
        /* 确保输入框在移动端完全显示 */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: #ffffff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .message-avatar {
        margin: 0 12px 0 16px;
    }
    
    .message.user .message-avatar {
        margin: 0 16px 0 12px;
    }
    
    .message-content {
        padding-right: 16px;
    }
    
    .message.user .message-content {
        padding-left: 16px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-messages {
        /* 在小屏幕上增加底部内边距 */
        padding-bottom: 100px;
    }
    
    .chat-input-container {
        padding: 12px;
        /* 确保输入框在小屏幕设备上完全显示 */
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: #ffffff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .input-box {
        padding: 10px 12px;
    }
    
    .message-avatar {
        margin: 0 8px 0 12px;
        width: 28px;
        height: 28px;
    }
    
    .message.user .message-avatar {
        margin: 0 12px 0 8px;
    }
    
    .message-content {
        padding-right: 12px;
    }
    
    .message.user .message-content {
        padding-left: 12px;
    }
    
    .message-text {
        font-size: 14px;
        max-width: 90%;
    }
} 