/* ==========================================
   ANOMALY DETECTION - WARNING STYLES
   ========================================== */

/* Warning Section */
.anomaly-warning-section {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Main Warning Container */
.anomaly-warning {
    background: var(--bg-card, #1a1a2e);
    border-radius: 16px;
    border: 1px solid var(--border-color, #2a2a4a);
    padding: 0;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out;
    margin-bottom: 20px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Severity-based styling */
.anomaly-warning.severity-high {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15);
}

.anomaly-warning.severity-medium {
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

.anomaly-warning.severity-low {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
}

/* Header Section */
.anomaly-warning-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.1) 0%, 
        rgba(239, 68, 68, 0.02) 100%);
}

.severity-high .anomaly-warning-header {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.15) 0%, 
        rgba(239, 68, 68, 0.03) 100%);
}

.severity-medium .anomaly-warning-header {
    background: linear-gradient(135deg, 
        rgba(245, 158, 11, 0.15) 0%, 
        rgba(245, 158, 11, 0.03) 100%);
}

.severity-low .anomaly-warning-header {
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.15) 0%, 
        rgba(59, 130, 246, 0.03) 100%);
}

/* Warning Icon */
.anomaly-warning-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    flex-shrink: 0;
}

.severity-high .anomaly-warning-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.severity-medium .anomaly-warning-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.severity-low .anomaly-warning-icon {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

/* Warning Content */
.anomaly-warning-content {
    flex: 1;
}

.anomaly-warning-title {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    margin: 0 0 6px;
}

.anomaly-warning-message {
    font-size: 0.95em;
    color: var(--text-secondary, #a0a0a0);
    margin: 0;
    line-height: 1.5;
}

/* Score Circle */
.anomaly-warning-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.score-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(
        var(--score-color, #ef4444) calc(var(--score, 0) * 1%),
        rgba(255, 255, 255, 0.1) 0
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.score-circle.high {
    --score-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.score-circle.medium {
    --score-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.score-circle.low {
    --score-color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}

.score-value {
    font-size: 1.5em;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.score-circle.high .score-value { color: #ef4444; }
.score-circle.medium .score-value { color: #f59e0b; }
.score-circle.low .score-value { color: #3b82f6; }

.score-label {
    font-size: 0.75em;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toggle Button */
.anomaly-toggle-details {
    width: 100%;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: none;
    border-top: 1px solid var(--border-color, #2a2a4a);
    color: var(--text-secondary, #a0a0a0);
    font-size: 0.9em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.anomaly-toggle-details:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #ffffff);
}

.anomaly-toggle-details i {
    transition: transform 0.3s ease;
}

/* Details Section */
.anomaly-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.3s ease;
    padding: 0 24px;
}

.anomaly-details.expanded {
    max-height: 800px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color, #2a2a4a);
}

/* Summary Stats */
.anomaly-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color, #2a2a4a);
}

.anomaly-stat {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: var(--bg-tertiary, #12121a);
    border-radius: 12px;
    border: 1px solid var(--border-color, #2a2a4a);
}

.anomaly-stat .stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

.anomaly-stat .stat-value.high { color: #ef4444; }
.anomaly-stat .stat-value.medium { color: #f59e0b; }
.anomaly-stat .stat-value.low { color: #3b82f6; }

.anomaly-stat .stat-label {
    display: block;
    font-size: 0.8em;
    color: var(--text-muted, #666);
    margin-top: 6px;
}

/* Anomaly List */
.anomaly-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Anomaly Item */
.anomaly-item {
    padding: 16px;
    background: var(--bg-tertiary, #12121a);
    border-radius: 12px;
    border: 1px solid var(--border-color, #2a2a4a);
    transition: all 0.3s ease;
}

.anomaly-item:hover {
    border-color: var(--border-hover, #3a3a5a);
    transform: translateX(5px);
}

.anomaly-item.severity-high {
    border-left: 3px solid #ef4444;
}

.anomaly-item.severity-medium {
    border-left: 3px solid #f59e0b;
}

.anomaly-item.severity-low {
    border-left: 3px solid #3b82f6;
}

.anomaly-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.anomaly-type-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.anomaly-type-badge.spike {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.anomaly-type-badge.unrealistic_growth {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.anomaly-type-badge.round_number {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.anomaly-type-badge.drop_recover {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.anomaly-type-badge.stagnation {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.anomaly-date {
    font-size: 0.85em;
    color: var(--text-muted, #666);
    font-family: 'JetBrains Mono', monospace;
}

.anomaly-confidence {
    font-size: 0.85em;
    color: var(--text-secondary, #a0a0a0);
    margin-left: auto;
    font-weight: 500;
}

.anomaly-message {
    font-size: 0.95em;
    color: var(--text-primary, #ffffff);
    line-height: 1.5;
}

/* Disclaimer */
.anomaly-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 24px;
    background: rgba(59, 130, 246, 0.08);
    border-top: 1px solid var(--border-color, #2a2a4a);
    font-size: 0.85em;
    color: var(--text-secondary, #a0a0a0);
    line-height: 1.5;
}

.anomaly-disclaimer i {
    color: #3b82f6;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .anomaly-warning-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .anomaly-warning-content {
        text-align: center;
    }
    
    .anomaly-summary {
        flex-direction: column;
        gap: 12px;
    }
    
    .anomaly-item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .anomaly-confidence {
        margin-left: 0;
    }
}

@media screen and (max-width: 480px) {
    .anomaly-warning-section {
        padding: 0 10px;
    }
    
    .anomaly-warning-header {
        padding: 20px;
    }
    
    .anomaly-warning-icon {
        width: 48px;
        height: 48px;
        font-size: 1.3em;
    }
    
    .score-circle {
        width: 60px;
        height: 60px;
    }
    
    .score-value {
        font-size: 1.3em;
    }
    
    .anomaly-toggle-details,
    .anomaly-details.expanded {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .anomaly-disclaimer {
        padding: 12px 16px;
    }
}

/* Inline Warning for Charts */
.platform-chart-section .anomaly-warning {
    margin: 15px 0 0;
    border-radius: 12px;
}

.platform-chart-section .anomaly-warning-header {
    padding: 16px;
}

.platform-chart-section .anomaly-warning-icon {
    width: 44px;
    height: 44px;
    font-size: 1.2em;
}

.platform-chart-section .anomaly-warning-title {
    font-size: 1em;
}

.platform-chart-section .score-circle {
    width: 55px;
    height: 55px;
}

.platform-chart-section .score-value {
    font-size: 1.2em;
}

/* Compact mode for multiple warnings */
.anomaly-warning.compact {
    border-radius: 10px;
}

.anomaly-warning.compact .anomaly-warning-header {
    padding: 14px 18px;
}

.anomaly-warning.compact .anomaly-warning-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1em;
    border-radius: 10px;
}

.anomaly-warning.compact .anomaly-warning-title {
    font-size: 0.95em;
}

.anomaly-warning.compact .anomaly-warning-message {
    font-size: 0.85em;
}

.anomaly-warning.compact .score-circle {
    width: 50px;
    height: 50px;
}

.anomaly-warning.compact .score-value {
    font-size: 1.1em;
}

/* Animation for score circle */
.score-circle {
    --score: 0;
    animation: fillScore 1s ease-out forwards;
}

@keyframes fillScore {
    from {
        --score: 0;
    }
}

/* Pulse animation for high severity */
.anomaly-warning.severity-high .anomaly-warning-icon {
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* =====================================================
   VIRAL / CONTENT EXPLAINED STYLES
   ===================================================== */

/* Severity Viral - für durch Content erklärte Anomalien */
.anomaly-warning.severity-viral {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
}

.severity-viral .anomaly-warning-header {
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.15) 0%, 
        rgba(16, 185, 129, 0.03) 100%);
}

.severity-viral .anomaly-warning-icon {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.severity-viral .anomaly-warning-title {
    color: #10b981;
}

.severity-viral .score-circle {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.severity-viral .score-value {
    color: #10b981;
}

.score-circle.viral {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.score-circle.viral .score-value {
    color: #10b981;
}

/* Content-Explained Badge in Anomalie-Items */
.content-explained-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: auto;
}

.content-explained-badge i {
    font-size: 0.65rem;
}

/* Anomaly Item wenn durch Content erklärt */
.anomaly-item.content-explained {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
    opacity: 0.85;
}

.anomaly-item.content-explained:hover {
    opacity: 1;
}

.anomaly-item.content-explained .anomaly-type-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
