/* ============================================
   P1 VALIDATION PIPELINE - STYLES
   All scoped under #p1-pipeline to avoid conflicts
   ============================================ */

#p1-pipeline .pipeline-container {
    width: 100%;
    max-width: 900px;
    height: 580px;
    background: linear-gradient(145deg, #080510 0%, #12082a 40%, #0a0d14 100%);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    font-family: 'Rajdhani', sans-serif;
    border: 1px solid rgba(139, 92, 246, 0.25);
    box-shadow: 
        0 0 60px rgba(139, 92, 246, 0.12),
        0 0 100px rgba(6, 182, 212, 0.08),
        inset 0 0 80px rgba(0, 0, 0, 0.6);
}

#p1-pipeline .pipeline-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        linear-gradient(rgba(139, 92, 246, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 92, 246, 0.02) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
}

#p1-pipeline .p1-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 12px 18px;
    background: linear-gradient(180deg, rgba(8, 5, 16, 0.98) 0%, transparent 100%);
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#p1-pipeline .title-block h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 2.5px;
}

#p1-pipeline .title-block .subtitle {
    font-size: 9px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 1.5px;
    margin-top: 2px;
}

#p1-pipeline .header-metrics {
    display: flex;
    gap: 16px;
}

#p1-pipeline .h-metric { text-align: right; }

#p1-pipeline .h-metric .val {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    color: #10b981;
    font-weight: 700;
}

#p1-pipeline .h-metric .lbl {
    font-size: 7px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#p1-pipeline .main-area {
    position: absolute;
    top: 55px;
    left: 0;
    right: 0;
    bottom: 65px;
    display: flex;
}

#p1-pipeline .left-panel {
    width: 105px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid rgba(139, 92, 246, 0.1);
}

#p1-pipeline .section-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

#p1-pipeline .stage-list { flex: 1; }

#p1-pipeline .stage {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    opacity: 0.35;
    transition: all 0.3s ease;
}

#p1-pipeline .stage.active {
    opacity: 1;
    transform: translateX(4px);
}

#p1-pipeline .stage-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    flex-shrink: 0;
    transition: all 0.3s;
}

#p1-pipeline .stage.active .stage-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b, 0 0 16px rgba(245, 158, 11, 0.4);
}

#p1-pipeline .stage-text .name {
    font-size: 9px;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
}

#p1-pipeline .stage-text .time {
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    color: rgba(255,255,255,0.35);
}

#p1-pipeline .center-panel {
    flex: 1;
    position: relative;
}

#p1-pipeline #kernel-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

#p1-pipeline .buffer-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: none;
}

#p1-pipeline .buffer-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px dashed;
}

#p1-pipeline .buffer-ring.integrity { width: 280px; height: 280px; border-color: rgba(16, 185, 129, 0.35); }
#p1-pipeline .buffer-ring.reflection { width: 240px; height: 240px; border-color: rgba(6, 182, 212, 0.35); }
#p1-pipeline .buffer-ring.operational { width: 200px; height: 200px; border-color: rgba(139, 92, 246, 0.35); }

#p1-pipeline .buffer-tag {
    position: absolute;
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

#p1-pipeline .buffer-tag.integrity {
    top: -145px; left: 50%; transform: translateX(-50%);
    color: #10b981; background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.25);
}

#p1-pipeline .buffer-tag.reflection {
    top: 50%; left: -160px; transform: translateY(-50%);
    color: #06b6d4; background: rgba(6, 182, 212, 0.12); border: 1px solid rgba(6, 182, 212, 0.25);
}

#p1-pipeline .buffer-tag.operational {
    bottom: -145px; left: 50%; transform: translateX(-50%);
    color: #8b5cf6; background: rgba(139, 92, 246, 0.12); border: 1px solid rgba(139, 92, 246, 0.25);
}

#p1-pipeline .kernel-label {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 3;
    pointer-events: none;
}

#p1-pipeline .kernel-badge {
    font-family: 'Orbitron', sans-serif;
    font-size: 9px; color: #f59e0b; letter-spacing: 1.5px;
    background: rgba(245, 158, 11, 0.12);
    padding: 4px 10px; border-radius: 4px;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

#p1-pipeline .kernel-sub {
    font-size: 8px; color: rgba(255,255,255,0.45); margin-top: 3px;
}

#p1-pipeline .io-indicator {
    position: absolute;
    left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 8px; letter-spacing: 1px;
    padding: 5px 12px; border-radius: 5px; z-index: 10;
}

#p1-pipeline .io-indicator.input {
    top: 8px; color: #f59e0b;
    background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3);
}

#p1-pipeline .io-indicator.output {
    bottom: 8px; color: #10b981;
    background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3);
}

#p1-pipeline .data-icon {
    width: 14px; height: 14px;
    display: flex; align-items: center; justify-content: center;
}

#p1-pipeline .data-icon.raw {
    background: rgba(245, 158, 11, 0.6);
    border-radius: 3px; border: 1px solid rgba(245, 158, 11, 0.8);
}

#p1-pipeline .data-icon.fractal svg { width: 14px; height: 14px; }

#p1-pipeline .right-panel {
    width: 115px; padding: 8px 10px;
    display: flex; flex-direction: column; justify-content: center;
    border-left: 1px solid rgba(139, 92, 246, 0.1);
}

#p1-pipeline .catch-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 8px; color: #f59e0b; letter-spacing: 1px;
    text-align: center; margin-bottom: 10px;
}

#p1-pipeline .catch-phase {
    padding: 7px 8px; border-radius: 5px; margin-bottom: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    opacity: 0.4; transition: all 0.3s ease;
}

#p1-pipeline .catch-phase.active { opacity: 1; transform: scale(1.02); }
#p1-pipeline .catch-phase.p1 { border-color: rgba(139, 92, 246, 0.35); }
#p1-pipeline .catch-phase.p2 { border-color: rgba(6, 182, 212, 0.35); }
#p1-pipeline .catch-phase.p3 { border-color: rgba(16, 185, 129, 0.35); }
#p1-pipeline .catch-phase.p1.active { background: rgba(139, 92, 246, 0.1); }
#p1-pipeline .catch-phase.p2.active { background: rgba(6, 182, 212, 0.1); }
#p1-pipeline .catch-phase.p3.active { background: rgba(16, 185, 129, 0.1); }

#p1-pipeline .catch-header {
    display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px;
}

#p1-pipeline .catch-name {
    font-family: 'Orbitron', sans-serif; font-size: 7px; color: rgba(255,255,255,0.6);
}

#p1-pipeline .catch-rate {
    font-family: 'Orbitron', sans-serif; font-size: 11px; font-weight: 700;
}

#p1-pipeline .catch-phase.p1 .catch-rate { color: #8b5cf6; }
#p1-pipeline .catch-phase.p2 .catch-rate { color: #06b6d4; }
#p1-pipeline .catch-phase.p3 .catch-rate { color: #10b981; }

#p1-pipeline .catch-details {
    display: flex; justify-content: space-between;
    font-size: 7px; color: rgba(255,255,255,0.35);
}

#p1-pipeline .catch-threshold,
#p1-pipeline .catch-survival { font-family: 'Orbitron', sans-serif; }
#p1-pipeline .catch-phase.p1 .catch-survival { color: rgba(139, 92, 246, 0.7); }
#p1-pipeline .catch-phase.p2 .catch-survival { color: rgba(6, 182, 212, 0.7); }
#p1-pipeline .catch-phase.p3 .catch-survival { color: rgba(16, 185, 129, 0.7); }

#p1-pipeline .p1-footer {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 10px 18px;
    background: linear-gradient(0deg, rgba(8, 5, 16, 0.98) 0%, transparent 100%);
    display: flex; justify-content: space-between; align-items: flex-end;
    z-index: 20;
}

#p1-pipeline .checkpoint-grid { display: flex; gap: 14px; }
#p1-pipeline .cp-item { text-align: center; }
#p1-pipeline .cp-item .val {
    font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700; color: #fff;
}
#p1-pipeline .cp-item .val.highlight { color: #f59e0b; }
#p1-pipeline .cp-item .lbl {
    font-size: 7px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.5px;
}

#p1-pipeline .result-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 8px; padding: 8px 14px; text-align: center;
}

#p1-pipeline .result-badge .val {
    font-family: 'Orbitron', sans-serif; font-size: 16px; font-weight: 900; color: #10b981;
}

#p1-pipeline .result-badge .lbl {
    font-size: 7px; color: rgba(16, 185, 129, 0.8); text-transform: uppercase; letter-spacing: 0.5px;
}

/* Animated particles */
#p1-pipeline .particle-container {
    position: absolute;
    top: 0; left: 50%; width: 2px; height: 100%;
    transform: translateX(-50%);
    z-index: 5; pointer-events: none; overflow: visible;
}

#p1-pipeline .particle {
    position: absolute; left: 50%; transform: translateX(-50%);
    opacity: 0; animation: p1FlowParticle 5s ease-in-out infinite;
}

#p1-pipeline .particle:nth-child(1) { animation-delay: 0s; }
#p1-pipeline .particle:nth-child(2) { animation-delay: 1.25s; }
#p1-pipeline .particle:nth-child(3) { animation-delay: 2.5s; }
#p1-pipeline .particle:nth-child(4) { animation-delay: 3.75s; }

#p1-pipeline .particle .raw-shape {
    width: 8px; height: 8px;
    background: #f59e0b; border-radius: 2px;
    box-shadow: 0 0 12px #f59e0b;
    position: absolute; left: 50%; transform: translateX(-50%);
    animation: p1RawFade 5s ease-in-out infinite;
}

#p1-pipeline .particle .fractal-shape {
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 9px solid #10b981;
    filter: drop-shadow(0 0 8px #10b981);
    position: absolute; left: 50%; transform: translateX(-50%);
    opacity: 0;
    animation: p1FractalFade 5s ease-in-out infinite;
}

#p1-pipeline .particle:nth-child(1) .raw-shape,
#p1-pipeline .particle:nth-child(1) .fractal-shape { animation-delay: 0s; }
#p1-pipeline .particle:nth-child(2) .raw-shape,
#p1-pipeline .particle:nth-child(2) .fractal-shape { animation-delay: 1.25s; }
#p1-pipeline .particle:nth-child(3) .raw-shape,
#p1-pipeline .particle:nth-child(3) .fractal-shape { animation-delay: 2.5s; }
#p1-pipeline .particle:nth-child(4) .raw-shape,
#p1-pipeline .particle:nth-child(4) .fractal-shape { animation-delay: 3.75s; }

@keyframes p1FlowParticle {
    0% { top: 0%; opacity: 0; }
    5% { opacity: 1; }
    48% { top: 48%; }
    50% { top: 50%; }
    52% { top: 52%; }
    95% { top: 100%; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

@keyframes p1RawFade {
    0%, 48% { opacity: 1; }
    52%, 100% { opacity: 0; }
}

@keyframes p1FractalFade {
    0%, 48% { opacity: 0; }
    52%, 100% { opacity: 1; }
}

/* Corner accents */
#p1-pipeline .corner {
    position: absolute; width: 16px; height: 16px;
    border: 1px solid rgba(139, 92, 246, 0.25); z-index: 15;
}
#p1-pipeline .corner.tl { top: 6px; left: 6px; border-right: none; border-bottom: none; }
#p1-pipeline .corner.tr { top: 6px; right: 6px; border-left: none; border-bottom: none; }
#p1-pipeline .corner.bl { bottom: 6px; left: 6px; border-right: none; border-top: none; }
#p1-pipeline .corner.br { bottom: 6px; right: 6px; border-left: none; border-top: none; }

/* Explainer button */
#p1-pipeline .explainer-btn {
    position: absolute; top: 12px; right: 160px;
    font-family: 'Orbitron', sans-serif; font-size: 8px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 4px; padding: 5px 10px;
    cursor: pointer; z-index: 25; transition: all 0.3s;
    display: flex; align-items: center; gap: 5px;
}

#p1-pipeline .explainer-btn:hover {
    background: rgba(139, 92, 246, 0.25); color: #fff;
    border-color: rgba(139, 92, 246, 0.6);
}

#p1-pipeline .explainer-btn .icon { font-size: 10px; }

/* Explainer Modal */
#p1-pipeline .explainer-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 3, 8, 0.92); z-index: 100;
    display: none; justify-content: center; align-items: center; padding: 20px;
}

#p1-pipeline .explainer-overlay.active { display: flex; }

#p1-pipeline .explainer-modal {
    background: linear-gradient(145deg, #12082a 0%, #0a0d14 100%);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 12px; max-width: 640px; max-height: 85%; overflow-y: auto;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.2);
}

#p1-pipeline .explainer-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    display: flex; justify-content: space-between; align-items: center;
}

#p1-pipeline .explainer-title {
    font-family: 'Orbitron', sans-serif; font-size: 12px; color: #f59e0b; letter-spacing: 2px;
}

#p1-pipeline .explainer-close {
    font-size: 18px; color: rgba(255, 255, 255, 0.5);
    cursor: pointer; transition: color 0.3s;
    background: none; border: none; padding: 0; line-height: 1;
}

#p1-pipeline .explainer-close:hover { color: #ef4444; }

#p1-pipeline .explainer-content { padding: 20px; }

#p1-pipeline .explainer-section { margin-bottom: 20px; }
#p1-pipeline .explainer-section:last-child { margin-bottom: 0; }

#p1-pipeline .explainer-section h3 {
    font-family: 'Orbitron', sans-serif; font-size: 10px; color: #8b5cf6;
    letter-spacing: 1.5px; margin-bottom: 10px; text-transform: uppercase;
}

#p1-pipeline .explainer-section p {
    font-size: 12px; color: rgba(255, 255, 255, 0.75);
    line-height: 1.7; margin-bottom: 10px;
}

#p1-pipeline .explainer-section p:last-child { margin-bottom: 0; }

#p1-pipeline .explainer-highlight { color: #f59e0b; font-weight: 600; }
#p1-pipeline .explainer-cyan { color: #06b6d4; }
#p1-pipeline .explainer-green { color: #10b981; }
#p1-pipeline .explainer-purple { color: #8b5cf6; }

#p1-pipeline .explainer-diagram {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px; padding: 15px; margin: 12px 0;
    font-family: 'Rajdhani', monospace; font-size: 11px;
    color: rgba(255, 255, 255, 0.6); line-height: 1.5;
}

#p1-pipeline .explainer-list {
    list-style: none; padding: 0; margin: 10px 0;
}

#p1-pipeline .explainer-list li {
    font-size: 11px; color: rgba(255, 255, 255, 0.7);
    padding: 6px 0; padding-left: 18px; position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#p1-pipeline .explainer-list li:last-child { border-bottom: none; }

#p1-pipeline .explainer-list li::before {
    content: '◆'; position: absolute; left: 0; color: #f59e0b; font-size: 8px;
}

/* Fractalization indicator */
#p1-pipeline .fractal-indicator {
    position: absolute; bottom: 75px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px;
    font-size: 8px; color: rgba(255,255,255,0.6);
    z-index: 10; opacity: 0; transition: opacity 0.3s;
}

#p1-pipeline .fractal-indicator.active { opacity: 1; }
#p1-pipeline .fractal-indicator .arrow { color: #f59e0b; }

#p1-pipeline .fractal-indicator .label {
    font-family: 'Orbitron', sans-serif; font-size: 7px; color: #f59e0b; letter-spacing: 1px;
}

#p1-pipeline .mini-raw {
    width: 10px; height: 10px;
    background: rgba(245, 158, 11, 0.7); border-radius: 2px; border: 1px solid #f59e0b;
}

#p1-pipeline .mini-fractal {
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #10b981;
    position: relative;
}

#p1-pipeline .mini-fractal::before {
    content: '';
    position: absolute; top: 4px; left: -3px;
    width: 0; height: 0;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-bottom: 5px solid rgba(8, 5, 16, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
    #p1-pipeline .pipeline-container {
        height: 480px;
        max-width: 100%;
    }
    #p1-pipeline .left-panel { width: 80px; }
    #p1-pipeline .right-panel { width: 90px; }
    #p1-pipeline .buffer-ring.integrity { width: 200px; height: 200px; }
    #p1-pipeline .buffer-ring.reflection { width: 170px; height: 170px; }
    #p1-pipeline .buffer-ring.operational { width: 140px; height: 140px; }
    #p1-pipeline .buffer-tag.integrity { top: -105px; }
    #p1-pipeline .buffer-tag.reflection { left: -120px; }
    #p1-pipeline .buffer-tag.operational { bottom: -105px; }
    #p1-pipeline .explainer-btn { right: 100px; }
}

@media (max-width: 480px) {
    #p1-pipeline .pipeline-container { height: 420px; }
    #p1-pipeline .left-panel { display: none; }
    #p1-pipeline .right-panel { display: none; }
    #p1-pipeline .explainer-btn { right: 10px; }
}
