* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    padding: 20px;
    overflow: hidden;
}

.container {
    display: flex;
    gap: 20px;
    height: 100%;
    max-width: 1800px;
    margin: 0 auto;
}

/* 左侧面板 - 函数软件 */
.left-panel {
    flex: 1.2;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* 右侧面板 - 聊天 */
.right-panel {
    flex: 0.8;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.panel-header h2 {
    color: #333;
    font-size: 24px;
}

/* 函数控制区 */
.function-controls {
    margin-bottom: 20px;
}

.function-controls h3 {
    color: #555;
    margin-bottom: 15px;
    font-size: 18px;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    color: #666;
    font-weight: 500;
    margin-bottom: 5px;
}

.control-group select,
.control-group input[type="text"],
.control-group input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.control-group input[type="number"] {
    width: 100px;
    display: inline-block;
    margin: 0 5px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #667eea;
}

.control-group small {
    display: block;
    color: #999;
    margin-top: 5px;
    font-size: 12px;
}

.parameters-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.parameter-input {
    margin-bottom: 10px;
}

.parameter-input label {
    display: inline-block;
    width: 80px;
    color: #555;
    font-weight: 500;
}

.parameter-input input {
    width: 120px;
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

/* 按钮 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    background: #f0f0f0;
    color: #666;
}

.btn-small:hover {
    background: #e0e0e0;
}

/* Canvas 绘图区 */
.canvas-container {
    margin: 20px 0;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

#functionCanvas {
    display: block;
    width: 100%;
    height: auto;
}

/* 操作记录 */
.operations-log {
    margin-top: 20px;
}

.operations-log h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 16px;
}

#operationsList {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 13px;
    color: #666;
}

.operation-item {
    padding: 8px;
    margin-bottom: 5px;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

/* 聊天区域 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
}

.welcome-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.welcome-message p {
    margin-bottom: 10px;
}

.welcome-message ul {
    margin-left: 20px;
    margin-top: 10px;
}

.welcome-message li {
    margin-bottom: 5px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 10px;
    max-width: 85%;
    word-wrap: break-word;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: #667eea;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.ai {
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
}

.message.system {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
    text-align: center;
    margin: 10px auto;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
}

/* 聊天输入区 */
.chat-input-container {
    display: flex;
    gap: 10px;
}

#userInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    transition: border-color 0.3s;
}

#userInput:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-container .btn {
    width: 100px;
    flex: none;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 展开/折叠功能 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    cursor: pointer;
    user-select: none;
}

.section-header h3 {
    margin: 0;
}

.toggle-btn {
    background: transparent;
    border: 2px solid #667eea;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
}

.toggle-btn:hover {
    background: #667eea;
    transform: scale(1.1);
}

.toggle-btn:hover .toggle-icon {
    color: white;
}

.toggle-icon {
    color: #667eea;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.3s;
    display: inline-block;
}

.toggle-btn.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease-in, opacity 0.3s ease-in;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }

    .left-panel,
    .right-panel {
        width: 100%;
    }
}
