* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* 侧边栏样式 */
.sidebar {
    width: 280px;
    background: #202123;
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #4d4d4f;
}

.sidebar-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    margin-bottom: 20px;
}

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

.conversation-item {
    padding: 12px 15px;
    margin: 5px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-item:hover {
    background: #343541;
}

.conversation-item.active {
    background: #40414f;
}

.conversation-item .title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item .delete-btn {
    opacity: 0;
    transition: opacity 0.3s;
}

.conversation-item:hover .delete-btn {
    opacity: 0.7;
}

.conversation-item:hover .delete-btn:hover {
    opacity: 1;
    color: #ef4444;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #4d4d4f;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

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

.header-actions {
    display: flex;
    gap: 10px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f7f8;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.welcome-message h3 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #374151;
}

.welcome-message p {
    font-size: 16px;
    margin-bottom: 30px;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

.suggestion-btn {
    padding: 12px 20px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.suggestion-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.message {
    margin-bottom: 20px;
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
}

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

.message.user {
    margin-left: auto;
}

.message-content {
    padding: 16px 20px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #f3f4f6;
    color: #374151;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 5px;
    text-align: right;
}

.message.assistant .message-time {
    text-align: left;
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#message-input {
    flex: 1;
    padding: 15px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 16px;
    resize: none;
    max-height: 120px;
    min-height: 56px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

#message-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #6b7280;
}

.input-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* 知识库面板 */
.knowledge-panel {
    width: 350px;
    background: white;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s;
}

.knowledge-panel.active {
    transform: translateX(0);
}

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

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.knowledge-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.knowledge-search input {
    flex: 1;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.knowledge-item {
    padding: 15px;
    margin-bottom: 15px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.knowledge-item h4 {
    margin-bottom: 8px;
    color: #374151;
}

.knowledge-item p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.knowledge-item .keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.keyword {
    background: #e0e7ff;
    color: #3730a3;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.knowledge-item .actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.knowledge-item:hover .actions {
    opacity: 1;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

/* 文件上传区域 */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
}

.upload-area i {
    font-size: 48px;
    color: #9ca3af;
    margin-bottom: 10px;
}

.upload-area p {
    color: #6b7280;
    margin-bottom: 5px;
}

.upload-hint {
    font-size: 12px;
    color: #9ca3af;
}

#file-input {
    display: none;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: 95vh;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
    }
    
    .knowledge-panel {
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        width: 100%;
        z-index: 100;
    }
    
    .message {
        max-width: 95%;
    }
}