/* Trading Mode Selector and Replay UI Styles */

.trading-mode-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    color: white;
}

.trading-mode-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trading-mode-selector {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    user-select: none;
}

.mode-option:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.mode-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: white;
}

.mode-option label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
}

.mode-option input[type="radio"]:checked + label {
    font-weight: 600;
}

/* Replay Mode Container */
.backtest-mode-container,
.replay-mode-container {
    display: none;
}

.backtest-mode-container.active,
.replay-mode-container.active {
    display: block;
}

.backtest-controls,
.replay-controls {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.backtest-controls h4,
.replay-controls h4 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.backtest-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.backtest-button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-run-backtest {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-run-backtest:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-run-backtest:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-clear-backtest {
    padding: 0.75rem 2rem;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-clear-backtest:hover {
    background: #f5f7ff;
}

/* Replay Progress and Results */
.backtest-progress,
.replay-progress {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    display: none;
}

.backtest-progress.active,
.replay-progress.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.backtest-results,
.replay-results {
    display: none;
    margin-top: 2rem;
}

.backtest-results.active,
.replay-results.active {
    display: block;
}

.results-header {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.results-header h5 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.result-card.success {
    border-color: #4caf50;
    background: #f1f8f4;
}

.result-card.warning {
    border-color: #ff9800;
    background: #fff3f0;
}

.result-card.error {
    border-color: #f44336;
    background: #ffebee;
}

.result-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.result-card.success .result-value {
    color: #4caf50;
}

.result-card.warning .result-value {
    color: #ff9800;
}

.result-card.error .result-value {
    color: #f44336;
}

.results-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.results-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.results-table th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.results-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.results-table tbody tr:hover {
    background: #f8f9fa;
}

.results-empty {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
}

/* Replay Status Messages */
.backtest-status,
.replay-status {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: none;
    font-weight: 500;
}

.backtest-status.active,
.replay-status.active {
    display: block;
}

.backtest-status.success,
.replay-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.backtest-status.error,
.replay-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.backtest-status.info,
.replay-status.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Live Mode Container */
.live-mode-container {
    display: none;
}

.live-mode-container.active {
    display: block;
}

.live-status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #4caf50;
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.live-controls {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .trading-mode-section {
        padding: 1.5rem;
    }

    .trading-mode-selector {
        gap: 1rem;
    }

    .mode-option {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .backtest-form-grid {
        grid-template-columns: 1fr;
    }

    .backtest-button-group {
        gap: 0.5rem;
    }

    .btn-run-backtest,
    .btn-clear-backtest {
        flex: 1;
        min-width: 150px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Spinner */
.backtest-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Disabled State */
.trading-mode-section.disabled,
.backtest-controls.disabled {
    opacity: 0.6;
    pointer-events: none;
}

