/* Training Animations CSS */

/* Training Curve Canvas Container */
.training-curve-container {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin: 1.5rem 0;
    overflow: hidden;
}

.training-curve-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.training-curve-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.training-curve-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

#training-curve-canvas {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    background: var(--bg-primary);
}

/* Enhanced Progress Bar with Pulse Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scaleY(1);
    }
    50% {
        opacity: 0.8;
        transform: scaleY(1.05);
    }
}

.training-progress-fill.near-complete {
    animation: pulse 0.5s ease-in-out infinite, progressGlow 1s ease-in-out infinite;
    background: linear-gradient(90deg, var(--accent-success), #00ff88, var(--accent-success));
    background-size: 200% 100%;
    animation: progressStripes 0.3s linear infinite, progressGlow 1s ease-in-out infinite, gradientFlow 1s linear infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Particle Canvas for Celebrations */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

/* Training Metrics Display */
.training-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.metric-card {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 255, 245, 0.2);
    transform: translateY(-2px);
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent-primary);
    font-family: 'Courier New', monospace;
}

.metric-unit {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: normal;
    margin-left: 0.25rem;
}

/* Real-time Update Animation */
.metric-value.updating {
    animation: metricUpdate 0.3s ease;
}

@keyframes metricUpdate {
    0% {
        transform: scale(1);
        color: var(--accent-primary);
    }
    50% {
        transform: scale(1.1);
        color: var(--accent-success);
    }
    100% {
        transform: scale(1);
        color: var(--accent-primary);
    }
}

/* Training Phase Indicators */
.training-phases {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.phase-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    flex: 1;
}

.phase-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -50%;
    top: 15px;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.phase-item.active:not(:last-child)::after {
    background: linear-gradient(90deg, var(--accent-primary), var(--border-color));
}

.phase-item.completed:not(:last-child)::after {
    background: var(--accent-success);
}

.phase-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 1;
    transition: all 0.3s;
}

.phase-item.active .phase-icon {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 15px rgba(0, 255, 245, 0.6);
    animation: phasePulse 1.5s ease-in-out infinite;
}

.phase-item.completed .phase-icon {
    border-color: var(--accent-success);
    background: var(--accent-success);
    color: var(--bg-primary);
}

@keyframes phasePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.phase-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.phase-item.active .phase-label {
    color: var(--accent-primary);
    font-weight: bold;
}

.phase-item.completed .phase-label {
    color: var(--accent-success);
}

/* Accuracy Milestone Markers */
.milestone-markers {
    position: relative;
    margin: 1.5rem 0;
}

.milestone {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    transform: translateX(-50%);
}

.milestone-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--bg-secondary);
    transition: all 0.3s;
}

.milestone.reached .milestone-marker {
    background: var(--accent-success);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
    animation: milestoneReached 0.6s ease;
}

@keyframes milestoneReached {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
}

.milestone-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.milestone.reached .milestone-label {
    color: var(--accent-success);
    font-weight: bold;
}

/* Training Speed Indicator */
.speed-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.speed-value {
    font-weight: bold;
    color: var(--accent-primary);
}

.speed-indicator.fast {
    border-color: var(--accent-success);
}

.speed-indicator.fast .speed-value {
    color: var(--accent-success);
    animation: speedPulse 1s ease-in-out infinite;
}

@keyframes speedPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Loss/Accuracy Graph Split View */
.split-graph-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}

.graph-panel {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
}

.graph-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.graph-canvas {
    width: 100%;
    height: 150px;
    border-radius: 8px;
    background: var(--bg-primary);
}

/* Training Complete Banner */
.training-complete-banner {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 212, 255, 0.2));
    border: 2px solid var(--accent-success);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin: 1.5rem 0;
    animation: bannerAppear 0.5s ease;
}

@keyframes bannerAppear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.banner-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: celebrateIcon 1s ease infinite;
}

@keyframes celebrateIcon {
    0%, 100% {
        transform: rotate(-5deg) scale(1);
    }
    50% {
        transform: rotate(5deg) scale(1.1);
    }
}

.banner-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-success);
    margin-bottom: 0.5rem;
}

.banner-message {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.banner-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

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

.banner-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.banner-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-primary);
}

/* Responsive Design for Animations */
@media (max-width: 768px) {
    .split-graph-container {
        grid-template-columns: 1fr;
    }
    
    .training-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .training-phases {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .phase-item:not(:last-child)::after {
        display: none;
    }
    
    .banner-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .training-curve-container {
        padding: 0.75rem;
    }
    
    #training-curve-canvas {
        height: 150px;
    }
}

/* Smooth Transitions for Dynamic Content */
.training-stat-value,
.metric-value,
.training-time-remaining {
    transition: color 0.3s ease;
}

/* Highlight on Value Change */
.value-increased {
    animation: valueIncrease 0.5s ease;
}

@keyframes valueIncrease {
    0% {
        color: var(--accent-primary);
    }
    50% {
        color: var(--accent-success);
        transform: scale(1.05);
    }
    100% {
        color: var(--accent-primary);
        transform: scale(1);
    }
}