/* ═══════════════════════════════════════════════════════════════
   PIPELINE PROGRESS STEPPER + GATE RESULT STRIP
   File: static/css/pipeline-progress.css
   ═══════════════════════════════════════════════════════════════ */

.pipeline-strip {
  background: #161921;
  border: 1px solid #2a2d38;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  border-left: none;
  border-right: none;
}

/* --- Top Row: Stage Stepper --- */
.pipeline-stepper {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pipeline-stepper::-webkit-scrollbar { display: none; }

.pipeline-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #4a4e5c;
  margin-right: 8px;
  white-space: nowrap;
  user-select: none;
}

.stage-node {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.stage-node.clickable {
  cursor: pointer;
}
.stage-node.clickable:hover .stage-label {
  color: #7dd3a8;
}

.stage-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: relative;
}

/* Completed */
.stage-node.completed .stage-icon {
  background: #1a3a2a;
  border: 2px solid #34d399;
  color: #34d399;
}
.stage-node.completed .stage-label {
  color: #7dd3a8;
}

/* Active — pulsing */
.stage-node.active .stage-icon {
  background: #1a3a2a;
  border: 2px solid #34d399;
  color: #34d399;
  animation: pulse-glow 2s ease-in-out infinite;
}
.stage-node.active .stage-label {
  color: #34d399;
  font-weight: 600;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(52, 211, 153, 0.3);
  }
  50% {
    box-shadow: 0 0 14px rgba(52, 211, 153, 0.6), 0 0 24px rgba(52, 211, 153, 0.2);
  }
}

/* Upcoming */
.stage-node.upcoming .stage-icon {
  background: transparent;
  border: 2px solid #3a3d4a;
  color: #3a3d4a;
}
.stage-node.upcoming .stage-label {
  color: #4a4e5c;
}

/* Failed */
.stage-node.failed .stage-icon {
  background: #3a1a1a;
  border: 2px solid #ef4444;
  color: #ef4444;
}
.stage-node.failed .stage-label {
  color: #f87171;
}

/* Paused */
.stage-node.paused .stage-icon {
  background: #3a2a1a;
  border: 2px solid #f59e0b;
  color: #f59e0b;
  animation: pulse-warn 2.5s ease-in-out infinite;
}
.stage-node.paused .stage-label {
  color: #fbbf24;
}

@keyframes pulse-warn {
  0%, 100% { box-shadow: 0 0 4px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 12px rgba(245, 158, 11, 0.5); }
}

.stage-label {
  font-size: 12px;
  font-weight: 500;
  transition: color 0.2s ease;
  user-select: none;
}

.stage-connector {
  width: 16px;
  height: 2px;
  background: #2a2d38;
  flex-shrink: 0;
  border-radius: 1px;
  transition: background 0.3s ease;
}
.stage-connector.done {
  background: #34d399;
}

/* --- Bottom Row: Gate Result Strip --- */
.gate-strip {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 10px;
  border-top: 1px solid #2a2d38;
  background: #12141b;
  flex-wrap: wrap;
  min-height: 38px;
}

.gate-strip.hidden {
  display: none;
}

.gate-decision {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e2a22;
  border: 1px solid #2d4a35;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.gate-decision.fail {
  background: #2a1a1a;
  border-color: #4a2d2d;
  color: #ef4444;
}
.gate-decision.warn {
  background: #2a2a1a;
  border-color: #4a4a2d;
  color: #f59e0b;
}

.gate-confidence {
  font-size: 11px;
  font-weight: 600;
  color: #8b8fa3;
  background: #1c1f2a;
  border: 1px solid #2a2d38;
  border-radius: 4px;
  padding: 2px 8px;
  white-space: nowrap;
}

.gate-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  position: relative;
}

.tag-pill.approved {
  background: #1c2433;
  border: 1px solid #2d3a4d;
  color: #7da1c4;
}
.tag-pill.approved:hover {
  background: #243044;
  border-color: #3d5a7d;
  color: #a0c4e8;
}

.tag-pill.drift {
  background: #2a1a1a;
  border: 1px solid #5a2d2d;
  color: #f87171;
}
.tag-pill.drift::after {
  content: "⚠";
  font-size: 10px;
}
.tag-pill.drift:hover {
  background: #3a2020;
  border-color: #7a3d3d;
}

/* --- Tag Popover --- */
.tag-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1c1f2a;
  border: 1px solid #3a3d4a;
  border-radius: 8px;
  padding: 10px 14px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  width: 220px;
}
.tag-popover.visible {
  display: block;
  animation: popIn 0.15s ease-out;
}
@keyframes popIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.tag-popover-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #4a4e5c;
  margin-bottom: 8px;
}
.tag-popover-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tag-popover-item {
  font-size: 11px;
  color: #6b7082;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.1s ease;
}
.tag-popover-item.highlighted {
  background: #243044;
  color: #7da1c4;
  font-weight: 600;
}

/* --- Idle State --- */
.pipeline-idle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  color: #3a3d4a;
  font-size: 12px;
  font-style: italic;
  letter-spacing: 0.5px;
}

/* --- Viewing History Indicator --- */
.viewing-history {
  font-size: 10px;
  color: #f59e0b;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* --- Mobile --- */
@media (max-width: 640px) {
  .stage-label { display: none; }
  .stage-label-abbr { display: inline; }
  .pipeline-stepper { padding: 8px 10px; gap: 2px; }
  .stage-connector { width: 8px; }
  .gate-strip { padding: 6px 10px; }
  .tag-popover { left: 0; transform: translateX(0); }
}
@media (min-width: 641px) {
  .stage-label-abbr { display: none; }
}
