/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

:root {
    /* 浅色主题变量 */
    --bg-color: #f5f7fa;
    --sidebar-bg: #fff;
    --sidebar-border: #e8e8e8;
    --primary-color: #1890ff;
    --primary-hover: #40a9ff;
    --text-color: #333;
    --text-secondary: #8c8c8c;
    --message-bg: #fff;
    --message-user-bg: #f5f7fa;
    --message-border: #e8e8e8;
    --input-area-bg: #fff;
    --hover-bg: #f0f2f5;
    --active-bg: #e6f7ff;
    --avatar-bg: #1890ff;
    --avatar-user-bg: #722ed1;
    --scrollbar-track: #f1f1f1;
    --scrollbar-thumb: #c1c1c1;
    --scrollbar-hover: #a8a8a8;
    --box-shadow: rgba(0, 0, 0, 0.08);
}

.dark-theme {
    /* 深色主题变量 */
    --bg-color: #1f1f1f;
    --sidebar-bg: #2d2d2d;
    --sidebar-border: #3a3a3a;
    --primary-color: #177ddc;
    --primary-hover: #3c9ae8;
    --text-color: #e0e0e0;
    --text-secondary: #aaaaaa;
    --message-bg: #2d2d2d;
    --message-user-bg: #363636;
    --message-border: #404040;
    --input-area-bg: #363636;
    --hover-bg: #404040;
    --active-bg: #1a365d;
    --avatar-bg: #177ddc;
    --avatar-user-bg: #722ed1;
    --scrollbar-track: #2d2d2d;
    --scrollbar-thumb: #555555;
    --scrollbar-hover: #777777;
    --box-shadow: rgba(0, 0, 0, 0.2);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* 主容器样式 */
.main-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* 左侧边栏样式 */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--sidebar-border);
    position: relative;
}

.sidebar-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.new-chat-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: background-color 0.3s;
}

.new-chat-btn:hover {
    background-color: var(--primary-hover);
}

.plus-icon {
    margin-right: 8px;
    font-size: 16px;
    font-weight: bold;
}

/* 主题切换按钮 */
.theme-toggle {
    position: absolute;
    right: 16px;
    top: 16px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--hover-bg);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: var(--text-secondary);
}

/* 历史对话列表样式 */
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    max-height: calc(100vh - 90px);
}

.history-section {
    margin-bottom: 16px;
}

.time-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 5px 10px;
    margin-bottom: 5px;
}

.history-item {
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background-color: var(--hover-bg);
}

.history-item.active {
    background-color: var(--active-bg);
    border-left: 3px solid var(--primary-color);
}

.history-title {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    color: var(--text-color);
}

.delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.5;
    transition: opacity 0.2s;
    color: red;
}

.delete-btn:hover {
    opacity: 1;
}

.delete-btn svg {
    display: block;
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 聊天包装器样式 - 新增 */
.chat-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: var(--bg-color);
    padding: 0;
    position: relative;
    height: 100vh;
    overflow: hidden;
}

/* 聊天容器样式 */
.chat-container {
    width: 900px;
    max-width: 95%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    overflow: hidden;
    position: relative;
    padding-bottom: 80px; /* 为底部输入框留出空间 */
}

/* 聊天头部样式 */
.chat-header {
    padding: 15px 20px;
    background-color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8e8e8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.current-chat-info {
    display: flex;
    align-items: center;
}

.current-chat-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 50%;
}

.status.online::before {
    background-color: #52c41a;
}

.clear-btn {
    padding: 6px 12px;
    background-color: #f0f0f0;
    color: #595959;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.clear-btn:hover {
    background-color: #e0e0e0;
}

/* 消息区域样式 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--bg-color);
    height: calc(100vh - 80px);
}

/* 单条消息样式 */
.message {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-start;
}

/* 用户消息 */
.user-message {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--avatar-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    margin: 0 10px;
}

.user-message .avatar {
    background-color: var(--avatar-user-bg);
}

.message .content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px var(--box-shadow);
}

.ai-message .content {
    background-color: var(--message-bg);
    border-top-left-radius: 0;
}

.user-message .content {
    background-color: var(--message-user-bg);
    border: 1px solid var(--message-border);
    color: var(--text-color);
    border-top-right-radius: 0;
}

.content p {
    white-space: pre-wrap;
    word-break: break-word;
}

/* 输入区域样式 */
.input-area {
    display: flex;
    padding: 8px 10px;
    background-color: var(--input-area-bg);
    align-items: center;
    position: absolute;
    bottom: 30px;
    left: 20px;
    right: 20px;
    width: calc(100% - 40px);
    z-index: 10;
    box-shadow: 0 1px 8px var(--box-shadow);
    border-radius: 15px;
    border-top: none;
}

#user-input {
    flex: 1;
    padding: 8px 10px;
    border: none;
    border-radius: 0;
    resize: none;
    outline: none;
    height: 70px;
    max-height: 150px;
    background-color: transparent;
    transition: all 0.3s;
    margin-right: 8px;
    line-height: 20px;
    box-shadow: none;
    overflow-y: auto;
    color: var(--text-color);
}

#user-input:focus {
    box-shadow: none;
}

#user-input::placeholder {
    color: var(--text-secondary);
}

.send-btn, .stop-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
}

.send-btn:hover, .stop-btn:hover {
    background-color: var(--primary-hover);
}

.stop-btn {
    background-color: #ff4d4f;
}

.stop-btn:hover {
    background-color: #ff7875;
}

.stop-icon {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* 打字指示器样式 */
.typing-indicator {
    padding: 5px 10px;
    display: inline-block;
    position: relative;
    min-height: 20px;
}

.typing-indicator::after {
    content: "...";
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 100% { content: "."; }
    33% { content: ".."; }
    66% { content: "..."; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        left: -280px;
        height: 100vh;
        z-index: 10;
        transition: left 0.3s;
    }
    
    .sidebar.visible {
        left: 0;
    }
    
    .chat-wrapper {
        padding: 10px;
    }
    
    .chat-container {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .message .content {
        max-width: 85%;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-hover);
}

/* 动画效果 */
.message {
    animation: fadeIn 0.3s ease-out;
}

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