/* Preserve existing layouts; show feedback only for explicit application loading states. */
.pcba-async-feedback .pcba-async-spinner,
.pcba-async-spinner {
  box-sizing: border-box !important;
  border: 2px solid transparent !important;
  border-top-color: currentColor !important;
  border-right-color: currentColor !important;
  border-radius: 50% !important;
  background: transparent !important;
  animation: pcba-adapter-spin 900ms linear infinite, pcba-adapter-reveal 300ms ease 200ms both !important;
}
.pcba-async-spinner { width: 24px; height: 24px; flex: 0 0 24px; color: #252927; }
.pcba-async-feedback .pcba-async-spinner { width: 18px !important; height: 18px !important; flex-basis: 18px !important; color: inherit; }
.pcba-rfq-loading { cursor: wait; }

/* The language control exposes aria-busy only while its own locale work is in flight. */
#navigationLanguage { position: relative; }
#navigationLanguage .pcba-language-loading {
  position: absolute;
  left: 10px;
  top: calc(50% - 7px);
  width: 14px;
  height: 14px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}
#navigationLanguage .pcba-language-loading .pp-feedback-spinner {
  width: 14px !important;
  height: 14px !important;
  flex-basis: 14px !important;
  border-width: 1.5px !important;
  --pp-accent: currentColor;
}
#navigationLanguage.pcba-language-waiting .pcba-language-loading { visibility: visible; opacity: 1; }
#navigationLanguage.pcba-language-waiting .navigation-language-icon { visibility: hidden; }

/* Fixed-size, absolutely placed ornament leaves AI button text and geometry to the application. */
#ao-review { position: relative; padding-inline: 42px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#ao-review::after {
  content: "";
  position: absolute;
  inset-inline-end: 17px;
  top: calc(50% - 8px);
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 1.5px solid transparent;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}
body.pcba-ao-busy-visible #ao-review::after {
  border-top-color: currentColor;
  border-right-color: currentColor;
  opacity: 1;
  animation: pcba-adapter-spin 900ms linear infinite;
}
#ao-output > .ao-section-head { position: relative; }
.pcba-ao-complete {
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  width: 20px;
  height: 20px;
  color: #27814b;
  font-size: 18px;
  line-height: 20px;
  text-align: center;
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
}
#ao-output.pcba-ao-completed .pcba-ao-complete { opacity: 1; }
.pcba-ao-waiting {
  min-height: 32px;
  margin-top: 6px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 400ms ease;
}
.pcba-ao-waiting .pp-feedback-status { font-size: 12px; color: #626269; }
body.pcba-ao-busy-visible .pcba-ao-waiting { visibility: visible; opacity: 1; }

/* The original first-review copy retains its dimensions and margins under the placeholders. */
body.pcba-ao-busy-visible #ao-empty:not([hidden]) > p,
body.pcba-ao-busy-visible #ao-empty:not([hidden]) li {
  position: relative;
  color: transparent;
  overflow: hidden;
}
body.pcba-ao-busy-visible #ao-empty:not([hidden]) > p::before,
body.pcba-ao-busy-visible #ao-empty:not([hidden]) li::before {
  content: "";
  position: absolute;
  inset: 4px 0;
  border-radius: 8px;
  background: repeating-linear-gradient(to bottom, #e8e6de 0 10px, transparent 10px 1.65em);
  pointer-events: none;
}
body.pcba-ao-busy-visible #ao-empty:not([hidden]) li:nth-child(2)::before { inset-inline-end: 14%; }
body.pcba-ao-busy-visible #ao-empty:not([hidden]) li:nth-child(3)::before { inset-inline-end: 7%; }
body.pcba-ao-busy-visible #ao-empty:not([hidden]) > p::after,
body.pcba-ao-busy-visible #ao-empty:not([hidden]) li::after,
.pcba-media-loading::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60px;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  animation: pcba-adapter-shimmer 1500ms ease-in-out infinite;
  pointer-events: none;
}

/* Images already have a reserved area. Their original element, alt text and decode timing remain intact. */
.pcba-media-relative { position: relative; }
.pcba-media-loading, .pcba-media-error { background-color: #e8e6de !important; }
.pcba-media-loading { overflow: hidden; }
.pcba-media-loading::after { z-index: 1; }

@keyframes pcba-adapter-spin { to { transform: rotate(360deg); } }
@keyframes pcba-adapter-shimmer { to { left: 100%; } }
@keyframes pcba-adapter-reveal { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pcba-async-spinner,
  body.pcba-ao-busy-visible #ao-review::after,
  body.pcba-ao-busy-visible #ao-empty > p::after,
  body.pcba-ao-busy-visible #ao-empty li::after,
  .pcba-media-loading::after { animation: none !important; }
  .pcba-async-spinner { opacity: 1 !important; }
  body.pcba-ao-busy-visible #ao-empty > p::after,
  body.pcba-ao-busy-visible #ao-empty li::after,
  .pcba-media-loading::after { display: none; }
  .pcba-ao-waiting, .pcba-ao-complete, #navigationLanguage .pcba-language-loading { transition: none !important; }
}
@media print {
  .pcba-ao-waiting, .pcba-ao-complete { display: none !important; }
  #ao-review::after, .pcba-media-loading::after { display: none !important; }
}
