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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏样式 */
.navbar {
    background-color: #4a6fa5;
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo {
    font-size: 2rem;
    margin-bottom: 5px;
    font-weight: bold;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    padding: 20px 0;
    height: calc(100vh - 140px); /* 减去导航栏和页脚高度 */
}

/* 左侧历史对话栏样式 */
.history-sidebar {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    margin: 0;
    color: #4a6fa5;
    font-size: 1.2rem;
}

.new-chat-button {
    padding: 8px 16px;
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.new-chat-button:hover {
    background-color: #3a5a85;
}

.chat-sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-session-item {
    padding: 15px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.chat-session-item:hover {
    background-color: #e9ecef;
    transform: translateX(2px);
}

.chat-session-item.active {
    background-color: #e3f2fd;
    border-left-color: #4a6fa5;
}

.chat-session-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
}

.chat-session-time {
    font-size: 0.8rem;
    color: #6c757d;
}

/* 右侧聊天区域样式 */
.chat-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 聊天容器样式 */
.chat-container {
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex: 1;
}

.chat-history {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

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

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

.ai-message .message-avatar,
.user-message .message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.ai-message .message-avatar {
    background-color: #4a6fa5;
    color: white;
    margin-right: 15px;
}

.user-message .message-avatar {
    background-color: #5cb85c;
    color: white;
    margin-left: 15px;
}

.message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 18px;
    word-wrap: break-word;
}

.ai-message .message-content {
    background-color: #f0f0f0;
    border-bottom-left-radius: 5px;
}

.user-message .message-content {
    background-color: #4a6fa5;
    color: white;
    border-bottom-right-radius: 5px;
    text-align: right;
}

/* 输入区域样式 */
.input-container {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clear-button {
    padding: 10px 20px;
    background-color: #f0ad4e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.clear-button:hover {
    background-color: #ec971f;
}

.clear-button:active {
    transform: translateY(1px);
}

#user-input {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
}

#user-input:focus {
    outline: none;
    border-color: #4a6fa5;
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

.send-button {
    padding: 15px 30px;
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.send-button:hover {
    background-color: #3a5a85;
}

.send-button:active {
    transform: translateY(1px);
}

/* 提示信息区域 */
.tips-section {
    background-color: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tips-section h3 {
    margin-bottom: 15px;
    color: #4a6fa5;
    font-size: 1.3rem;
}

.tips-section ul {
    list-style-type: none;
}

.tips-section li {
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
}

.tips-section li:before {
    content: "•";
    color: #4a6fa5;
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -5px;
}

/* 页脚样式 */
.footer {
    background-color: #333;
    color: white;
    padding: 20px 0;
    margin-top: auto;
}

.footer .container {
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .tips-section {
        grid-row: 1;
    }
}

@media (max-width: 768px) {
    .logo {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .chat-history {
        padding: 20px;
    }
    
    .input-container {
        padding: 15px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .chat-container {
        border-radius: 0;
    }
    
    .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .send-button {
        align-self: center;
        width: 100%;
    }
}