/* Amazon one-click bundle modal - AI analyzing overlay, spinner choreography, keyframes, and reduced-motion. */

/* 「开始 AI 分析」生成中遮罩：覆盖整个弹窗（含 header/footer），分析通常
   1-2 分钟，必须比底部一行状态文字更明显。转环 + 阶段文案轮播 + 扫光进度条
   + 每秒用时计数；关闭按钮被遮罩盖住，与 JS 在分析期间拦截关闭的行为一致。 */
.amazon-bundle-analyzing {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8,10,12,.72);
  backdrop-filter: blur(6px);
  animation: amazon-bundle-fade-in .25s ease;
}

.amazon-bundle-analyzing[hidden] { display: none; }

.amazon-bundle-analyzing-card {
  position: relative;
  overflow: hidden;
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 34px 30px 28px;
  border: 1px solid var(--amazon-line);
  border-radius: 10px;
  background: var(--amazon-surface);
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  text-align: center;
}

/* 卡片表面周期性扫光：一道斜向高光从左到右掠过，让整块面板「活着」。 */
.amazon-bundle-analyzing-card::before {
  content: "";
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -45%;
  width: 42%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.07), transparent);
  transform: skewX(-14deg);
  animation: amazon-bundle-sheen 3.2s ease-in-out infinite;
  pointer-events: none;
}

.amazon-bundle-analyzing-orbit {
  position: relative;
  width: 64px;
  height: 64px;
}

.amazon-bundle-analyzing-orbit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255,255,255,0) 0deg, rgba(255,255,255,.85) 140deg, rgba(255,255,255,0) 260deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: amazon-bundle-spin 1.1s linear infinite;
}

.amazon-bundle-analyzing-orbit::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
}

.amazon-bundle-analyzing-spark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--amazon-text);
  animation: amazon-bundle-pulse 1.6s ease-in-out infinite;
}

.amazon-bundle-analyzing-spark svg { width: 22px; height: 22px; }

/* 外圈呼吸光晕 + 反向慢速虚线环：与主转环反向运动，转动感更明显。 */
.amazon-bundle-analyzing-glow {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.16), transparent 66%);
  animation: amazon-bundle-breathe 2.2s ease-in-out infinite;
}

.amazon-bundle-analyzing-ring2 {
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,.3);
  animation: amazon-bundle-spin 5.5s linear infinite reverse;
}

/* 跳动圆点：替代静态「…」，标题与阶段文案后各一组，错峰起伏。 */
.amazon-bundle-analyzing-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 3px;
  vertical-align: 2px;
}

.amazon-bundle-analyzing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amazon-muted);
  animation: amazon-bundle-blink 1.2s ease-in-out infinite;
}

.amazon-bundle-analyzing-dots i:nth-child(2) { animation-delay: .18s; }
.amazon-bundle-analyzing-dots i:nth-child(3) { animation-delay: .36s; }

/* 三段阶段进度：随阶段文案推进逐段点亮，当前段呼吸闪烁。 */
.amazon-bundle-analyzing-steps { display: flex; gap: 6px; }

.amazon-bundle-analyzing-steps i {
  width: 46px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  transition: background .5s ease, box-shadow .5s ease;
}

.amazon-bundle-analyzing-steps i.is-done { background: rgba(255,255,255,.34); }

.amazon-bundle-analyzing-steps i.is-active {
  background: rgba(255,255,255,.88);
  box-shadow: 0 0 12px rgba(255,255,255,.4);
  animation: amazon-bundle-step-pulse 1.4s ease-in-out infinite;
}

.amazon-bundle-analyzing-title {
  color: var(--amazon-text);
  font-size: 15px;
  font-weight: 760;
}

.amazon-bundle-analyzing-stage {
  min-height: 18px;
  margin: 0;
  color: var(--amazon-muted);
  font-size: 12px;
  line-height: 1.5;
}

.amazon-bundle-analyzing-stage.is-swap { animation: amazon-bundle-rise .45s ease; }

.amazon-bundle-analyzing-bar {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.amazon-bundle-analyzing-bar i {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
  animation: amazon-bundle-sweep 1.4s ease-in-out infinite;
}

.amazon-bundle-analyzing-elapsed { color: var(--amazon-dim); font-size: 11px; }

/* 提交按钮内的小转环：分析期间替换 sparkles 图标，按钮文案切「AI 分析中…」。 */
.amazon-bundle-submit-spinner {
  display: none;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: amazon-bundle-spin .8s linear infinite;
}

.amazon-bundle-submit.is-busy .amazon-bundle-submit-spinner { display: inline-block; }
.amazon-bundle-submit.is-busy > [data-ui-icon] { display: none; }

@keyframes amazon-bundle-spin { to { transform: rotate(360deg); } }
@keyframes amazon-bundle-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes amazon-bundle-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes amazon-bundle-sweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(330%); } }
@keyframes amazon-bundle-pulse { 0%,100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes amazon-bundle-sheen { 0% { left: -45%; } 55%,100% { left: 118%; } }
@keyframes amazon-bundle-breathe { 0%,100% { opacity: .35; transform: scale(.82); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes amazon-bundle-blink { 0%,100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes amazon-bundle-step-pulse { 0%,100% { opacity: .65; } 50% { opacity: 1; } }

/* 系统开启减弱动效时不能把「生成中」指示做成全静止——转环/扫光就是
   「还在跑」的功能信号。这里只放慢并去掉位移动画，保留运动本身。 */
@media (prefers-reduced-motion: reduce) {
  .amazon-bundle-analyzing-card::before { display: none; }
  .amazon-bundle-analyzing-stage.is-swap { animation: none; }
  .amazon-bundle-analyzing-dots i { animation: none; opacity: .8; }
  .amazon-bundle-analyzing-orbit::before { animation-duration: 2.6s; }
  .amazon-bundle-analyzing-ring2 { animation-duration: 12s; }
  .amazon-bundle-analyzing-bar i { animation-duration: 2.8s; }
  .amazon-bundle-submit-spinner { animation-duration: 1.6s; }
}

