/**
 * 提示词 → 工具参数「意图提取」动画钩子
 * GSAP 可驱动：.is-highlight / .is-extracting / .is-extracted / #extract-overlay path
 */

/* 用户气泡内可高亮片段 */
.prompt-fragment {
  border-radius: 3px;
  padding: 0 2px;
  transition:
    background 0.35s ease,
    box-shadow 0.35s ease,
    color 0.25s ease;
}

.prompt-fragment.is-highlight {
  background: linear-gradient(120deg, #fef3c7 0%, #fde68a 55%, #bfdbfe 100%);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.45);
  color: #92400e;
}

.prompt-fragment.is-pulse {
  animation: fragment-pulse 0.9s ease infinite;
}

@keyframes fragment-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.15);
  }
}

/* Harness：意图提取桥接区 */
.extract-bridge {
  margin-bottom: 12px;
  padding: 10px;
  background: linear-gradient(135deg, #fffbeb 0%, #eff6ff 100%);
  border: 1px dashed rgba(21, 101, 192, 0.35);
  border-radius: 10px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.4s ease,
    max-height 0.5s ease,
    margin 0.4s ease;
}

.extract-bridge.is-visible {
  opacity: 1;
  max-height: 400px;
  margin-bottom: 12px;
}

.extract-bridge__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.extract-bridge__label .material-symbols-outlined {
  font-size: 16px;
}

.extract-bridge__prompt-echo {
  font-size: 12px;
  line-height: 1.55;
  color: var(--title-text);
  margin-bottom: 8px;
}

.extract-bridge__flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.extract-bridge__flow .arrow-beam {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  opacity: 0.3;
  transition: opacity 0.3s;
}

.extract-bridge.is-flowing .extract-bridge__flow .arrow-beam {
  opacity: 1;
  animation: beam-scan 1.2s ease infinite;
}

@keyframes beam-scan {
  0% {
    transform: scaleX(0.2);
    opacity: 0.3;
  }
  50% {
    transform: scaleX(1);
    opacity: 1;
  }
  100% {
    transform: scaleX(0.2);
    opacity: 0.3;
  }
}

/* 参数字段 — 提取态 */
.param-field[data-param-key] {
  position: relative;
  transition:
    border-color 0.3s,
    box-shadow 0.3s,
    background 0.3s;
}

.param-field[data-param-key] .param-field__val {
  min-height: 1.4em;
  transition:
    background 0.35s,
    color 0.25s;
}

.param-field__val:empty,
.param-field.is-extracting .param-field__val {
  color: #94a3b8;
}

.param-field.is-extracting {
  z-index: 2;
}

.param-field.is-extracting .param-field__key {
  color: var(--accent-blue);
}

.param-field.is-extracting .param-field__val {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.18);
  animation: param-fill-glow 0.8s ease;
}

.param-field.is-extracted .param-field__val {
  background: #f0fdf4;
  border-color: #86efac;
}

.param-field.is-extracted .param-field__key::after {
  content: " ✓";
  color: var(--success);
  font-size: 10px;
}

@keyframes param-fill-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.18);
  }
}

.param-field__source {
  display: none;
  margin-top: 4px;
  font-size: 10px;
  color: var(--accent-blue);
  font-style: italic;
}

.param-field.is-extracted .param-field__source,
.param-field.is-extracting .param-field__source {
  display: block;
}

body.promo-extracting #user-prompt-block {
  position: relative;
  z-index: 3;
}

body.promo-extracting .plan-block,
body.promo-extracting .msg-assistant[data-promo-reveal="2"] {
  opacity: 0.35;
  pointer-events: none;
}
.extract-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8000;
}

.extract-overlay path.extract-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 2;
  stroke-dasharray: 6 4;
  opacity: 0;
  transition: opacity 0.25s;
}

.extract-overlay path.extract-line.is-visible {
  opacity: 0.85;
  animation: dash-flow 0.6s linear infinite;
}

@keyframes dash-flow {
  to {
    stroke-dashoffset: -20;
  }
}

/* 工具调用卡整体高亮 */
.tool-call-card.is-extract-focus {
  box-shadow:
    0 0 0 2px rgba(37, 99, 235, 0.35),
    0 8px 24px rgba(37, 99, 235, 0.12);
}
