:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --dark-color: #2d3436;
    --light-color: #f5f6fa;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --text-color: #2d3436;
    --text-light: #636e72;
    --border-color: #dfe6e9;
    --user-message-bg: #e3f2fd;
    --assistant-message-bg: #f5f5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f8f9fa;
    color: var(--text-color);
    line-height: 1.6;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 260px;
    background-color: white;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.new-chat-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: #5649d1;
}

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

.conversation-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.conversation-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    text-decoration: none;
}

.conversation-item:hover {
    background-color: var(--light-color);
}

.conversation-item.active {
    background-color: var(--secondary-color);
    color: white;
}

.conversation-item.active a {
    color: white;
}

.conversation-item i {
    font-size: 0.9rem;
}

.sidebar-footer {
    padding: 15px 20px;
    font-size: 0.8rem;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: white;
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px);
    background-size: 10px 10px;
}

.welcome-message {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.welcome-message h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.welcome-message p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: var(--text-light);
}

.example-prompts {
    margin-top: 40px;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.example-prompts h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.example-prompts ul {
    list-style-type: none;
}

.example-prompts li {
    padding: 10px 15px;
    margin-bottom: 10px;
    background-color: var(--light-color);
    border-radius: 5px;
    border-left: 3px solid var(--primary-color);
}

/* 消息样式 */
.message {
    max-width: 800px;
    margin: 0 auto 20px;
    display: flex;
}

.message-content {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
}

.user-message {
    justify-content: flex-end;
}

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

.assistant-message {
    justify-content: flex-start;
}

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

.message-text {
    margin-bottom: 10px;
    line-height: 1.5;
}

.message-image {
    margin-top: 10px;
}

.message-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message-image img:hover {
    transform: scale(1.02);
}

/* 输入区域样式 */
.input-area {
    padding: 15px 20px;
    background-color: white;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.text-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#prompt-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    resize: none;
    max-height: 150px;
    outline: none;
    transition: border-color 0.2s;
}

#prompt-input:focus {
    border-color: var(--primary-color);
}

#send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-button:hover {
    background-color: #5649d1;
}

.file-upload-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.file-upload-label {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--light-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.file-upload-label:hover {
    background-color: var(--secondary-color);
    color: white;
}

.uploaded-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.uploaded-file {
    background-color: var(--light-color);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.uploaded-file .remove-file {
    color: var(--danger-color);
    cursor: pointer;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: auto;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    display: block;
    margin: 50px auto;
    max-width: 80%;
    max-height: 80%;
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--danger-color);
}

.caption {
    text-align: center;
    color: white;
    padding: 10px;
    margin-top: 10px;
}

/* 加载动画 */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    justify-content: center;
    align-items: center;
}

.loading-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--light-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-container {
    margin-top: 20px;
    width: 100%;
    background-color: var(--light-color);
    border-radius: 5px;
    height: 10px;
    position: relative;
}

.progress-bar {
    height: 100%;
    border-radius: 5px;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 0.8rem;
    color: var(--text-light);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .conversation-list {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        white-space: nowrap;
    }
    
    .conversation-item {
        display: inline-block;
        min-width: 120px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 70%;
    }
}

@media (max-width: 480px) {
    .welcome-message h1 {
        font-size: 1.8rem;
    }
    
    .input-area {
        padding: 10px;
    }
    
    #prompt-input {
        padding: 10px;
    }
    
    #send-button, .file-upload-label {
        width: 36px;
        height: 36px;
    }
}

/* 在原有样式基础上添加以下内容 */

.clear-history-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    transition: background-color 0.2s;
}

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

.sidebar-footer p {
    margin: 5px 0;
    font-size: 0.8rem;
}

#storage-status {
    color: var(--success-color);
    font-weight: bold;
}

/* 移动端适配调整 */
@media (max-width: 768px) {
    .sidebar-header {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .new-chat-btn, .clear-history-btn {
        width: calc(50% - 5px);
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .new-chat-btn, .clear-history-btn {
        width: 100%;
    }
}