:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6e9cd2;
    --background-color: #f5f7fa;
    --card-color: #ffffff;
    --text-color: #333333;
    --light-text: #666666;
    --border-color: #e1e5eb;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --danger-color: #dc3545;
    --sidebar-width: 280px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 应用容器 */
.app-container {
    display: flex;
    width: 95%;
    max-width: 1280px;
    height: 85vh;
    background-color: var(--card-color);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background-color: #f8f9fa;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.new-chat-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.2s;
}

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

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

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

.sidebar-btn {
    width: 100%;
    padding: 8px 12px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.sidebar-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sidebar-btn i {
    font-size: 0.8rem;
}

#delete-chat-btn {
    color: var(--danger-color);
}

#delete-chat-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

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

.conversation-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.conversation-item.active {
    background-color: rgba(74, 111, 165, 0.1);
    border-left: 3px solid var(--primary-color);
}

.conversation-info {
    flex: 1;
    overflow: hidden;
    cursor: pointer;
}

.conversation-title {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.conversation-date {
    font-size: 0.7rem;
    color: var(--light-text);
    margin-top: 3px;
}

.conversation-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

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

.conversation-action-btn {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 3px;
    border-radius: 3px;
    transition: all 0.2s;
}

.conversation-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

.rename-btn:hover {
    color: var(--info-color);
}

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

.modal-input-container {
    margin: 8px 0;
}

.modal-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background-color: white;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.1);
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 5;
    display: block;
}

/* 在小屏幕上隐藏侧边栏 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        height: 100%;
        z-index: 10;
        transform: translateX(-100%);
        width: 80%;
        max-width: var(--sidebar-width);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .app-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        overflow: hidden;
        position: relative;
    }
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 30px;
    height: 30px;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    display: none;
}

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

.action-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* 在小屏幕上显示侧边栏切换按钮 */
@media (max-width: 768px) {
    .toggle-sidebar-btn {
        display: block;
    }
}

.chat-header h2 {
    margin: 0;
    font-weight: 600;
    font-size: 1.5rem;
}

/* 确认对话框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 20px;
    box-sizing: border-box;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    margin-bottom: 20vh;
}

.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--light-text);
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background-color: #f8f9fa;
}

.modal-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.cancel-btn {
    background-color: #f1f3f5;
    color: var(--text-color);
}

.cancel-btn:hover {
    background-color: #e9ecef;
}

.confirm-btn {
    background-color: var(--danger-color);
    color: white;
}

.confirm-btn:hover {
    background-color: #c82333;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease-out;
    margin-bottom: 24px;
}

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

.chat-message.user {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.bot {
    min-width: 200px;
    align-self: flex-start;
    background-color: var(--background-color);
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    animation: fadeIn 0.3s ease;
    line-height: 1.5;
}

/* Markdown 内容样式优化 */
.chat-message.bot .message-content {
    font-size: 14px;
    line-height: 1.6;
}

.chat-message.bot .message-content h1 {
    font-size: 1.6em;
    margin: 0.8em 0;
}

.chat-message.bot .message-content h2 {
    font-size: 1.4em;
    margin: 0.7em 0;
}

.chat-message.bot .message-content h3 {
    font-size: 1.2em;
    margin: 0.6em 0;
}

.chat-message.bot .message-content p {
    margin: 0.5em 0;
}

.chat-message.bot .message-content ul,
.chat-message.bot .message-content ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}

.chat-message.bot .message-content li {
    margin: 0.3em 0;
}

.chat-message.bot pre {
    background-color: #f6f8fa;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.4;
    margin: 0.7em 0;
}

.message-time {
    font-size: 0.7rem;
    position: absolute;
    bottom: -18px;
}

.chat-message.user .message-time {
    color: var(--light-text);
    left: 8px;
}

.chat-message.bot .message-time {
    color: var(--light-text);
    right: 8px;
}

.chat-message.bot code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}

.chat-input-container {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background-color: white;
}

.chat-input {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* 新增的控制区域样式 */
.input-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
}

.model-selector select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    font-size: 13px;
    color: var(--text-color);
    cursor: pointer;
    height: 32px;
}

.web-toggle-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.web-toggle-container i {
    color: var(--light-text);
    font-size: 0.9rem;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--success-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.chat-input textarea {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    min-height: 24px;
    max-height: 150px;
    transition: height 0.2s;
    overflow-y: auto;
    height: 24px;
}

.chat-input textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.input-buttons {
    display: flex;
    gap: 8px;
}

.send-btn {
    height: 40px;
    width: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-btn {
    background-color: var(--primary-color);
    color: white;
}

.send-btn:hover {
    background-color: var(--secondary-color);
}

.send-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    background-color: #f1f3f5;
    border-radius: 12px;
    align-self: flex-start;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--light-text);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--light-text);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

.model-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    background-color: var(--info-color);
    color: white;
    border-radius: 10px;
    margin-left: 8px;
    display: inline-block;
}

/* 左上角模型标识样式 */
.model-badge-top {
    position: absolute;
    top: -8px;
    left: 10px;
    z-index: 1;
    margin-left: 0;
    font-size: 0.65rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-container {
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .chat-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 4;
    }
    
    .chat-body {
        flex: 1;
        margin-top: 60px;
        margin-bottom: 120px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        z-index: 4;
        border-top: 1px solid var(--border-color);
        max-height: 140px;
    }
    
    .chat-message {
        max-width: 85%;
        margin-bottom: 28px;
    }
    
    .message-time {
        font-size: 0.65rem;
        bottom: -20px;
    }
    
    .chat-input {
        gap: 8px;
    }
    
    .input-controls {
        justify-content: space-between;
    }
    
    .model-selector select {
        max-width: 150px;
        font-size: 13px;
    }
    
    .chat-header h2 {
        font-size: 1.2rem;
    }

    .chat-message.bot .message-content {
        font-size: 14px;
        line-height: 1.5;
    }

    .chat-message.bot .message-content h1 {
        font-size: 1.4em;
    }

    .chat-message.bot .message-content h2 {
        font-size: 1.3em;
    }

    .chat-message.bot .message-content h3 {
        font-size: 1.1em;
    }

    .chat-message.bot pre {
        font-size: 12px;
        padding: 10px;
        line-height: 1.3;
    }

    .chat-message.bot .message-content ul,
    .chat-message.bot .message-content ol {
        padding-left: 1.2em;
    }

    .chat-input textarea {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .chat-message.user {
        font-size: 14px;
        line-height: 1.5;
        max-width: 85%;
    }
}

/* 代码高亮样式 */
.hljs {
    background: #2d2d2d;
    color: #f8f8f2;
    border-radius: 6px;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link {
    color: #8be9fd;
}

.hljs-function .hljs-keyword {
    color: #ff79c6;
}

.hljs-subst {
    color: #f8f8f2;
}

.hljs-string,
.hljs-title,
.hljs-name,
.hljs-type,
.hljs-attribute,
.hljs-symbol,
.hljs-bullet,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
    color: #f1fa8c;
}

.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta {
    color: #6272a4;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-title,
.hljs-section,
.hljs-doctag,
.hljs-type,
.hljs-name,
.hljs-strong {
    font-weight: bold;
}

.hljs-emphasis {
    font-style: italic;
}

/* 禁用状态的样式 */
.conversation-info.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.conversation-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* 输入框禁用状态 */
#user-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* 模型选择禁用状态 */
#model-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 联网功能切换禁用状态 */
#web-toggle:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 移动端弹窗优化 */
@media (max-width: 768px) {
    .modal {
        align-items: flex-start;
        padding-top: 10vh;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        margin: 0;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 12px 14px;
    }
    
    .modal-body {
        padding: 14px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }
    
    .modal-footer {
        padding: 12px 14px;
    }
    
    .modal-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 56px;
    }
    
    .modal-input {
        padding: 8px 10px;
    }
}

/* 思考过程容器样式 */
.reasoning-container {
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
}

.reasoning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #edf2f7;
    border-bottom: 1px solid var(--border-color);
}

.reasoning-header span {
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 500;
}

.toggle-reasoning {
    background: none;
    border: none;
    padding: 4px 8px;
    font-size: 0.8rem;
    color: var(--primary-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.toggle-reasoning:hover {
    background-color: rgba(74, 111, 165, 0.1);
}

.reasoning-content {
    padding: 12px;
    font-size: 0.9rem;
    color: var(--light-text);
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .reasoning-container {
        margin-bottom: 12px;
    }
    
    .reasoning-header {
        padding: 6px 10px;
    }
    
    .reasoning-content {
        padding: 10px;
        font-size: 0.85rem;
    }
} 