/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

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

/* 顶部导航栏 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.logo .logo-icon {
    margin-right: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* 按钮样式 */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-outline {
    background: transparent;
    color: #007bff;
    border: 2px solid #007bff;
}

.btn-outline:hover {
    background: #007bff;
    color: white;
}

.btn-outline.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧控制面板 */
.control-panel {
    width: 400px;
    min-width: 250px;
    max-width: 600px;
    background: white;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 可拖动的分界条 */
.resizer {
    width: 6px;
    background: #e9ecef;
    cursor: col-resize;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}

.resizer:hover {
    background: #007bff;
    width: 8px;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.resizer:active,
.resizer.resizing {
    background: #0056b3;
    width: 8px;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
}

.resizer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    right: -4px;
    bottom: 0;
    z-index: 10;
}

.resizer::after {
    content: '⋮⋮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #6c757d;
    font-size: 12px;
    line-height: 8px;
    letter-spacing: -2px;
    transition: color 0.2s ease;
    pointer-events: none;
}

.resizer:hover::after {
    color: white;
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    align-items: center;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.function-count {
    font-size: 0.9rem;
    color: #6c757d;
    margin-left: auto;
}

.functions-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.panel-footer {
    padding: 1rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

/* 函数输入区域 */
.function-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.function-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.function-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.function-title {
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #dee2e6;
}

.function-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.function-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s ease;
}

.function-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.function-input.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* MathLive数学输入容器样式 */
.math-input-container {
    display: flex;
    align-items: center;
    margin: 0.25rem 0;
    padding-left: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: white;
    transition: all 0.2s ease;
    min-height: 4rem;
}

.math-input-container:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.math-label {
    font-size: 1.5rem;
    font-weight: 500;
    color: #495057;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.math-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.4rem;
    min-height: 3rem;
}

/* MathLive特定样式覆盖 */
math-field {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-size: 1.4rem !important;
    min-height: 3rem !important;
    padding: 0.5rem !important;
    display: block;
}

math-field:focus {
    border: none !important;
    outline: none !important;
}

math-field .ML__text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 1.4rem !important;
    color: #333 !important;
}

math-field .ML__caret {
    border-left: 1px solid #007bff !important;
}

math-field .ML__selection {
    background: rgba(0, 123, 255, 0.2) !important;
}

/* 隐藏MathLive菜单切换按钮 */
.ML__menu-toggle {
    display: none !important;
}

/* 使用正确的Shadow DOM选择器隐藏MathLive菜单按钮 */
math-field::part(menu-toggle) {
    display: none;
}

/* 函数输入容器样式 */
.function-input-container {
    display: flex;
    align-items: center;
    margin: 0.25rem 0 0.5rem 0;
    min-height: 2.5rem;
}



.function-label {
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    margin-right: 0.75rem;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

.function-input-container .function-input {
    flex: 1;
    outline: none;
    background: transparent;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    font-family: 'Courier New', 'Monaco', monospace;
    color: #2c3e50;
}

.function-input-container .function-input::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* 错误状态样式 */
.function-input-container.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.function-input.error {
    color: #dc3545;
}

/* 定义域配置样式 */
.domain-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
    min-height: 2.5rem;
}

.domain-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
    min-width: 4rem;
}

.domain-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.domain-input {
    width: 5rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
}

.domain-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25);
}

.domain-separator {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    white-space: nowrap;
}

.domain-reset-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid #6c757d;
    border-radius: 4px;
    background: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.domain-reset-btn:hover {
    background: #6c757d;
    color: white;
}

/* 快速示例按钮样式 */
.quick-examples {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.example-btn {
    padding: 0.2rem 0.4rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    color: #495057;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
}

.example-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.example-btn:active {
    background: #dee2e6;
    transform: translateY(1px);
}

.example-btn.function-ref {
    background: #e7f3ff;
    color: #0066cc;
    border-color: #0066cc;
    font-weight: 500;
}

.example-btn.function-ref:hover {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

/* 参数滑块 */
.parameter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    width: 100%;
}

.parameter-label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
    min-width: 20px;
    flex-shrink: 0;
}

.parameter-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.parameter-input {
    width: 80px;
    padding: 0.25rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
    font-family: 'Courier New', monospace;
    background: white;
    flex-shrink: 0;
}

.parameter-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.1rem rgba(0, 123, 255, 0.25);
}

/* 参数容器 - 垂直布局确保每个参数组占用一行 */
.parameter-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.parameter-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.parameter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.parameter-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 右侧绘图区域 */
.graph-container {
    flex: 1;
    background: white;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 坐标轴控制面板 */
.axis-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.axis-control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.axis-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    min-width: 32px;
}

.axis-toggle {
    display: flex;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.axis-toggle:hover {
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.15);
}

.axis-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: white;
    color: #6c757d;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.axis-btn:hover {
    background: #f8f9fa;
    color: #495057;
    transform: scale(1.02);
}

.axis-btn.active {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    transform: scale(0.98);
}

.axis-btn + .axis-btn {
    border-left: 1px solid #dee2e6;
}

.axis-btn.active + .axis-btn {
    border-left-color: #007bff;
}

.axis-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.axis-btn:hover::before {
    opacity: 1;
}

/* 控制提示 */
.control-tips {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* 对数坐标轴提示文案 */
.log-axis-tip {
    color: #666;
    font-size: 0.85rem;
    font-weight: 400;
    display: flex;
    align-items: center;
}

.log-axis-tip .tip-text {
    white-space: nowrap;
}

/* .tips-text 已移除 */

/* 对数坐标通知 */
.log-scale-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
}

.log-scale-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.log-scale-notification::before {
    content: '📊';
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

#graphCanvas {
    flex: 1;
    display: block;
    background: white;
    cursor: crosshair;
    margin-left: 40px;
}

.graph-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.coordinates {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    pointer-events: none;
}

/* 错误消息 */
.error-message {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .control-panel {
        width: 100%;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .resizer {
        display: none;
    }
    
    .header-content {
        padding: 0 1rem;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .axis-controls {
        gap: 1rem;
        padding: 0.5rem;
        flex-wrap: wrap;
    }
}

/* 滚动条样式 */
.functions-container::-webkit-scrollbar {
    width: 6px;
}

.functions-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.functions-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

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

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.function-item {
    animation: fadeIn 0.3s ease-out;
}

/* 图标样式 */
.icon {
    font-size: 1.2rem;
    line-height: 1;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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