/* 自定义预测公式样式 */
.formula-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.formula-dialog {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.formula-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.formula-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.formula-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.formula-close:active {
    transform: scale(0.95);
    background: #e5e7eb;
}

.formula-body {
    padding: 20px;
}

.formula-section {
    margin-bottom: 20px;
}

.formula-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.formula-input,
.formula-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s;
}

.formula-input:focus,
.formula-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.formula-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.play-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.play-type-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.play-type-item:has(input:checked) {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-color: #667eea;
}

.play-type-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.play-type-item span {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.weight-grid {
    display: grid;
    gap: 16px;
    margin-top: 12px;
}

.weight-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weight-item label {
    flex: 0 0 100px;
    font-size: 13px;
    color: #374151;
}

.weight-item input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

.weight-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.weight-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.weight-value {
    flex: 0 0 40px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
}

.result-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stats-item {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.stats-label {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 6px;
}

.stats-value {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.debug-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.debug-group {
    background: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.debug-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.debug-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.debug-item {
    font-size: 12px;
    color: #6b7280;
    padding: 4px 8px;
    background: white;
    border-radius: 4px;
}

.formula-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    position: sticky;
    bottom: 0;
    background: #fff;
}

.formula-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.formula-btn-secondary {
    flex: 0 0 auto;
    background: #f3f4f6;
    color: #374151;
}

.formula-btn-secondary:active {
    transform: scale(0.98);
    background: #e5e7eb;
}

.formula-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.formula-btn-primary:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.btn-icon {
    font-size: 16px;
}

.formula-progress {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}

.formula-result {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
}

.result-header h4 {
    margin: 0 0 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: #10b981;
}

.result-section {
    margin-bottom: 24px;
}

.result-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-value.success {
    color: #10b981;
}

.stat-value.warning {
    color: #f59e0b;
}

.stat-value.danger {
    color: #ef4444;
}

.prediction-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.prediction-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px;
    border-radius: 12px;
    color: #fff;
    text-align: center;
}

.prediction-card.full-width {
    grid-column: 1 / -1;
}

.prediction-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.prediction-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.prediction-confidence {
    font-size: 11px;
    opacity: 0.8;
}

.prediction-sums {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.sum-badge {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
}

.backtest-list {
    max-height: 300px;
    overflow-y: auto;
}

.backtest-list-full {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
}

.stat-detail {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

.backtest-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    align-items: center;
}

.backtest-item.hit {
    background: #d1fae5;
    border-left: 3px solid #10b981;
}

.backtest-item.miss {
    background: #fee2e2;
    border-left: 3px solid #ef4444;
}

.backtest-issue {
    font-weight: 600;
    color: #374151;
}

.backtest-pred,
.backtest-actual {
    color: #6b7280;
}

.backtest-status {
    font-weight: 600;
    text-align: right;
}

.backtest-item.hit .backtest-status {
    color: #10b981;
}

.backtest-item.miss .backtest-status {
    color: #ef4444;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
