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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
}

.config-panel, .results-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.config-panel {
    position: sticky;
    top: 20px;
}

.config-panel h2, .results-panel h2 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

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

.param-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.param-group input[type="number"],
.param-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.param-group input[type="number"]:focus,
.param-group select:focus {
    outline: none;
    border-color: #667eea;
}

.param-group input[type="range"] {
    width: 100%;
    margin: 10px 0;
}

.range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.metrics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.chart-panel {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.chart-panel h3 {
    margin-bottom: 15px;
    color: #333;
}

.chart-panel canvas {
    max-height: 400px;
}

.suggestions-panel {
    background: #f0f8f0;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #28a745;
}

.suggestions-panel h3 {
    color: #28a745;
    margin-bottom: 15px;
}

.suggestion-item {
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid #28a745;
}

.suggestion-item strong {
    color: #28a745;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .config-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .metrics-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .range-inputs {
        grid-template-columns: 1fr;
    }
}

/* 数值显示样式 */
.metric-value.positive {
    color: #28a745;
}

.metric-value.negative {
    color: #dc3545;
}

.metric-value.neutral {
    color: #6c757d;
}

/* 滑块样式优化 */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* 网格预览样式 */
.grid-preview {
    background: #f0f8ff;
    border: 1px solid #667eea;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.grid-preview h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 16px;
}

.preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-label {
    font-weight: 500;
    color: #555;
}

.preview-value {
    font-weight: 600;
    color: #667eea;
}

/* 手续费提示样式 */
.fee-hint {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* 利润分解样式 */
.profit-breakdown {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.profit-breakdown h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.profit-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.profit-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid transparent;
}

.profit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.profit-card.grid-profit {
    border-left-color: #28a745;
}

.profit-card.holding-profit {
    border-left-color: #17a2b8;
}

.profit-card.total-profit {
    border-left-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.profit-header h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
}

.profit-card.total-profit .profit-header h4 {
    color: white;
}

.profit-description {
    font-size: 12px;
    color: #666;
    display: block;
}

.profit-card.total-profit .profit-description {
    color: rgba(255,255,255,0.8);
}

.profit-amount {
    font-size: 24px;
    font-weight: 700;
    margin: 15px 0 5px 0;
    color: #333;
}

.profit-card.total-profit .profit-amount {
    color: white;
}

.profit-percentage {
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.profit-card.total-profit .profit-percentage {
    color: rgba(255,255,255,0.9);
}

.profit-amount.positive {
    color: #28a745;
}

.profit-amount.negative {
    color: #dc3545;
}

.profit-card.total-profit .profit-amount.positive {
    color: #90EE90;
}

.profit-card.total-profit .profit-amount.negative {
    color: #FFB6C1;
}

/* 测试相关样式 */
.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-secondary:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

.test-results-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.test-summary-cards {
    margin-bottom: 20px;
}

.test-card {
    border-radius: 12px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.test-card.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
}

.test-card.failure {
    background: linear-gradient(135deg, #f8d7da 0%, #f1c0c7 100%);
    border-color: #dc3545;
}

.test-card h4 {
    margin-bottom: 15px;
    font-size: 18px;
}

.test-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
}

.success-text {
    color: #28a745;
}

.failure-text {
    color: #dc3545;
}

.warning-text {
    color: #ffc107;
}

.test-failures {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.failure-item {
    background: white;
    border-left: 4px solid #dc3545;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
}

.failure-item strong {
    color: #dc3545;
    display: block;
    margin-bottom: 5px;
}

.test-success {
    text-align: center;
    padding: 20px;
}

.test-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.category-item {
    background: #e8f5e8;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.test-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    color: #721c24;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

