/* 每步卡片：底层为底色，叠一层左→右进度（见 exec-step-card__progress） */
.exec-step-card {
  position: relative;
  overflow: hidden;
}

.exec-step-card__body {
  position: relative;
  z-index: 1;
}

.exec-step-card__progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 0;
  width: 0;
  pointer-events: none;
  border-radius: inherit;
  /* 仅随轮询前进时过渡；done↔running 由 React key 拆节点，避免 100%→0% 回退动画 */
  transition: width 0.35s ease-out;
}

.exec-step-card__progress--run {
  background: linear-gradient(
    90deg,
    rgba(34, 211, 238, 0.32) 0%,
    rgba(34, 211, 238, 0.12) 100%
  );
}

.exec-step-card__progress--done {
  background: linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.22) 0%,
    rgba(34, 197, 94, 0.10) 100%
  );
}

.exec-step-card__progress--indeterminate {
  width: 38% !important;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(34, 211, 238, 0.28) 50%,
    transparent 100%
  );
  animation: ntq-exec-step-progress-slide 1.2s ease-in-out infinite;
}

@keyframes ntq-exec-step-progress-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .exec-step-card__progress--indeterminate {
    animation: none;
    opacity: 0.85;
    transform: translateX(0);
  }
}

.exec-step-card.is-pending {
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.12);
}

.ntq-exec-step-grid {
  display: grid;
  grid-template-columns: minmax(148px, 220px) minmax(0, 1fr) minmax(148px, 176px);
  column-gap: 14px;
  row-gap: 8px;
  align-items: center;
}

.ntq-exec-step-lead {
  min-width: 0;
}

.ntq-exec-step-lead-main {
  min-width: 0;
  flex: 1;

  /* 与标题旁 help 图标拉开，避免与可点击运行钮贴在一起 */
  .ntq-exec-step-run-btn {
    margin-left: 12px;
  }
}

.ntq-exec-step-no {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--ntq-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ntq-text);
  background: transparent;
}

/* 执行钮：旋转色带仅出现在圆环描边 + 20px 图标（mask 裁剪），中心与其它区域不露色 */
$ntq-exec-run-mask-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath fill='%23000' d='M340-236.16v-487.68L723.07-480 340-236.16Z'/%3E%3C/svg%3E");
$ntq-exec-run-mask-refresh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath fill='%23000' d='M483.08-200q-117.25 0-198.63-81.34-81.37-81.34-81.37-198.54 0-117.2 81.37-198.66Q365.83-760 483.08-760q71.3 0 133.54 33.88 62.23 33.89 100.3 94.58V-760h40v209.23H547.69v-40h148q-31.23-59.85-87.88-94.54Q551.15-720 483.08-720q-100 0-170 70t-70 170q0 100 70 170t170 70q77 0 139-44t87-116h42.46Q725.08-310.15 651-255.08 576.92-200 483.08-200Z'/%3E%3C/svg%3E");
$ntq-exec-run-ring-width: 1px;
$ntq-exec-run-aurora: conic-gradient(
  from 0deg,
  var(--ntq-violet) 0deg,
  var(--ntq-cyan) 120deg,
  var(--ntq-green) 240deg,
  var(--ntq-violet) 360deg
);

@keyframes ntq-exec-run-aurora-spin {
  to {
    transform: rotate(360deg);
  }
}

.ntq-exec-step-run-btn {
  position: relative;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0 !important;
  border: none;
  border-radius: 999px;
  background: rgba(6, 6, 18, 0.55);
  overflow: hidden;
  transition:
    background 140ms ease,
    transform 140ms ease;

  &:hover:not(.Mui-disabled) {
    background: rgba(6, 6, 18, 0.65) !important;
    transform: scale(1.04);
  }

  &.Mui-disabled {
    opacity: 0.42;

    .ntq-exec-step-run-btn__ring,
    .ntq-exec-step-run-btn__glyph-aurora {
      animation: none;
    }
  }
}

/* 圆环：padding = 描边宽 + mask-composite，避免 radial-gradient 的 50% 按对角线算导致过粗 */
.ntq-exec-step-run-btn__ring {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  border-radius: 50%;
  padding: $ntq-exec-run-ring-width;
  background: $ntq-exec-run-aurora;
  transform-origin: center center;
  animation: ntq-exec-run-aurora-spin 3.6s linear infinite;
  pointer-events: none;
  z-index: 0;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.ntq-exec-step-run-btn__glyph {
  position: relative;
  z-index: 1;
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 20px 20px;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 20px 20px;
}

.ntq-exec-step-run-btn__glyph--play {
  -webkit-mask-image: $ntq-exec-run-mask-play;
  mask-image: $ntq-exec-run-mask-play;
}

.ntq-exec-step-run-btn__glyph--refresh {
  -webkit-mask-image: $ntq-exec-run-mask-refresh;
  mask-image: $ntq-exec-run-mask-refresh;
}

.ntq-exec-step-run-btn__glyph-aurora {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  background: $ntq-exec-run-aurora;
  transform-origin: center center;
  animation: ntq-exec-run-aurora-spin 3.6s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .ntq-exec-step-run-btn__ring,
  .ntq-exec-step-run-btn__glyph-aurora {
    animation: none;
  }

  .ntq-exec-step-run-btn:hover:not(.Mui-disabled) {
    transform: none;
  }
}

.ntq-exec-compare-divider {
  display: inline-block;
  align-self: stretch;
  flex-shrink: 0;
  width: 1px;
  min-height: 1.125rem;
  margin: 0 2px;
  background: var(--ntq-white-12);
}

/* 有对比列时运行中即占位，避免 done 后 Select 撑高行高导致闪动 */
.exec-step-card--has-compare {
  .ntq-exec-compare-slot {
    min-height: 40px;
  }
}

.ntq-exec-compare {
  padding-right: 4px;
}

.ntq-exec-compare__placeholder {
  flex-shrink: 0;
  width: 168px;
  max-width: 100%;
  height: 40px;
}

.ntq-exec-compare__select {
  min-width: 168px;
}
