/* ===========================================
   NEURAL PIPELINE FLOW - Edge-AI System Visualization
   An animated flowchart showing data flowing through
   the prediction system stages with glitch reveal effects
   =========================================== */

.neural-pipeline-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-xxl);
    margin-bottom: var(--spacing-xxl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* Subtle grid background for tech feel */
.neural-pipeline-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

/* Section Header */
.pipeline-header {
    text-align: center;
    margin-bottom: var(--spacing-xxl);
    position: relative;
    z-index: 1;
}

.pipeline-header h2 {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-sm);
}

.pipeline-header .lead {
    color: var(--text-secondary);
}

/* Pipeline Container */
.pipeline-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--spacing-xl) 0;
}

/* Connection Lines - SVG */
.pipeline-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.pipeline-connections path {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 2;
    stroke-dasharray: 8 4;
    transition: stroke 0.5s ease;
}

.pipeline-connections path.active {
    stroke: var(--cta-primary);
    stroke-dasharray: none;
}

/* Data Particles Animation */
.data-particle {
    fill: var(--cta-primary);
    opacity: 0;
    filter: drop-shadow(0 0 6px var(--cta-primary));
}

.data-particle.flowing {
    opacity: 1;
}

@keyframes flowAlongPath {
    0% { offset-distance: 0%; opacity: 0; }
    5% { opacity: 1; }
    95% { opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
}

/* Pipeline Nodes Grid */
.pipeline-nodes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    position: relative;
    z-index: 1;
}

/* Individual Pipeline Node */
.pipeline-node {
    position: relative;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    transition: all 0.4s ease;
    cursor: pointer;
    /* Start fully visible - animation is optional enhancement */
    opacity: 1;
    transform: translateY(0);
}

/* Explicit solid backgrounds for both themes */
[data-theme="light"] .pipeline-node {
    background: #ffffff;
}

[data-theme="dark"] .pipeline-node {
    background: #1a1a2e;
}

.pipeline-node.revealed {
    opacity: 1;
    transform: translateY(0);
}

.pipeline-node.active {
    border-color: var(--cta-primary);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.pipeline-node:hover {
    transform: translateY(-5px);
    border-color: var(--cta-primary);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
}

/* Node Step Number */
.node-step {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--cta-primary), #0ea5e9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-weight-bold);
    font-size: 0.9rem;
    border: 3px solid var(--bg-primary);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Node Icon */
.node-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto var(--spacing-md);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(14, 165, 233, 0.1));
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.node-icon i {
    font-size: 2rem;
    color: var(--cta-primary);
    transition: transform 0.3s ease;
}

.pipeline-node:hover .node-icon i {
    transform: scale(1.1);
}

/* Pulsing glow effect */
.node-icon::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: var(--border-radius-md);
    background: linear-gradient(135deg, var(--cta-primary), #0ea5e9);
    opacity: 0;
    z-index: -1;
    filter: blur(10px);
    transition: opacity 0.3s ease;
}

.pipeline-node.active .node-icon::after {
    opacity: 0.3;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.1); }
}

/* Node Title - Terminal Style */
.node-title {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    letter-spacing: 0.5px;
    position: relative;
}

/* Terminal cursor for title during reveal */
.node-title.typing::after {
    content: '█';
    animation: cursor-blink 0.5s step-end infinite;
    color: var(--cta-primary);
    margin-left: 2px;
}

/* Node Subtitle */
.node-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

/* Node Stats */
.node-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.node-stat {
    text-align: center;
}

.node-stat-value {
    font-family: 'SF Mono', monospace;
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    color: var(--cta-primary);
    display: block;
}

.node-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Terminal Status Bar */
.pipeline-status {
    margin-top: var(--spacing-xl);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    font-family: 'SF Mono', monospace;
    font-size: 0.85rem;
    position: relative;
    z-index: 1;
}

.status-line {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
}

.status-prompt {
    color: var(--cta-primary);
}

.status-text {
    color: var(--text-primary);
}

.status-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--cta-primary);
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Mobile Arrow Indicators (visible on mobile) */
.mobile-flow-arrow {
    display: none;
    text-align: center;
    padding: var(--spacing-md) 0;
    color: var(--cta-primary);
    font-size: 1.5rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    .pipeline-nodes {
        grid-template-columns: repeat(2, 1fr);
    }

    .pipeline-connections {
        display: none;
    }

    .mobile-flow-arrow {
        display: block;
    }

    .mobile-flow-arrow.horizontal {
        display: none;
    }
}

@media (max-width: 576px) {
    .pipeline-nodes {
        grid-template-columns: 1fr;
    }

    .neural-pipeline-section {
        padding: var(--spacing-xl);
    }

    .node-stats {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .neural-pipeline-section::before {
    background-image:
        linear-gradient(rgba(16, 185, 129, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 0.05) 1px, transparent 1px);
}

[data-theme="dark"] .pipeline-status {
    background: rgba(0, 0, 0, 0.5);
}
