/**
 * ML System Integration Styles
 * Phase 15.2: Advanced Pattern Detection & Backtesting - ML Optimization
 */

/* ML System Status Indicator */
.ml-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 500;
    margin: 4px 0;
    transition: all 0.3s ease;
}

.ml-status-indicator.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.ml-status-indicator.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.ml-status-indicator.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.ml-status-indicator.loading {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
    animation: pulse 2s infinite;
}

.ml-status-indicator .status-icon {
    font-size: 1.1em;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* ML Enhancement Section */
.ml-enhancement-section {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.ml-enhancement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}

.ml-enhancement-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.4em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ml-processing-time {
    background: #475569;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

/* ML Metrics Grid */
.ml-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.ml-metric {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ml-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.metric-label {
    font-size: 0.9em;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.6em;
    font-weight: 700;
    line-height: 1.2;
}

/* Metric Value Colors */
.metric-value.probability {
    color: #059669;
}

.metric-value.quality {
    color: #7c3aed;
}

.metric-value.quality.grade-a {
    color: #059669;
}

.metric-value.quality.grade-b {
    color: #0ea5e9;
}

.metric-value.quality.grade-c {
    color: #f59e0b;
}

.metric-value.quality.grade-d {
    color: #ef4444;
}

.metric-value.quality.grade-f {
    color: #dc2626;
}

.metric-value.recommendation.strong-buy {
    color: #059669;
}

.metric-value.recommendation.buy {
    color: #0ea5e9;
}

.metric-value.recommendation.weak-buy {
    color: #06b6d4;
}

.metric-value.recommendation.hold {
    color: #f59e0b;
}

.metric-value.recommendation.avoid {
    color: #ef4444;
}

.metric-value.position-size {
    color: #7c3aed;
}

/* ML Risk Section */
.ml-risk-section {
    margin: 16px 0;
}

.ml-risk-section h4 {
    margin: 0 0 12px 0;
    color: #1e293b;
    font-size: 1.2em;
    font-weight: 600;
}

.risk-status {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    display: inline-block;
}

.risk-status.low {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.risk-factors {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-factor {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid;
}

.risk-factor.high {
    background: #fef2f2;
    border-left-color: #dc2626;
}

.risk-factor.medium {
    background: #fefbeb;
    border-left-color: #f59e0b;
}

.risk-factor.low {
    background: #f0fdf4;
    border-left-color: #22c55e;
}

.risk-type {
    font-weight: 600;
    text-transform: capitalize;
    min-width: 120px;
}

.risk-description {
    color: #475569;
    flex: 1;
}

/* ML Recommendations Section */
.ml-recommendations-section {
    margin: 16px 0;
}

.ml-recommendations-section h4 {
    margin: 0 0 12px 0;
    color: #1e293b;
    font-size: 1.2em;
    font-weight: 600;
}

.recommendations-list {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.recommendation-item {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    line-height: 1.5;
    position: relative;
    padding-left: 20px;
}

.recommendation-item:before {
    content: "💡";
    position: absolute;
    left: 0;
    top: 8px;
}

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

.ml-timing {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    color: #475569;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ml-metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .ml-enhancement-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ml-enhancement-header h3 {
        font-size: 1.2em;
    }
    
    .risk-factor {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .risk-type {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .ml-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .ml-metric {
        padding: 12px;
    }
    
    .metric-value {
        font-size: 1.4em;
    }
}

/* Animation for ML loading states */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes mlGlow {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
    }
}

/* ML Enhancement Badge */
.ml-enhanced-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
    animation: mlGlow 3s infinite;
}

/* Dark theme support */
[data-theme="dark"] .ml-enhancement-section {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-color: #334155;
}

[data-theme="dark"] .ml-enhancement-header h3 {
    color: #f1f5f9;
}

[data-theme="dark"] .ml-enhancement-header {
    border-bottom-color: #334155;
}

[data-theme="dark"] .ml-metric {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .metric-label {
    color: #94a3b8;
}

[data-theme="dark"] .recommendations-list {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .recommendation-item {
    border-bottom-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .ml-timing {
    background: #0f172a;
    color: #cbd5e1;
}

[data-theme="dark"] .risk-factor.high {
    background: #450a0a;
}

[data-theme="dark"] .risk-factor.medium {
    background: #451a03;
}

[data-theme="dark"] .risk-factor.low {
    background: #052e16;
}

[data-theme="dark"] .risk-status.low {
    background: #052e16;
    color: #bbf7d0;
    border-color: #166534;
}