/* LDRS: Helix for startup, Hourglass for in-app loading. Local assets.
 * SVGs retain the upstream motion; static variants support reduced motion.
 * See LICENSE for the original animation's MIT license.
 */
.aibs-helix,
.aibs-hourglass,
body .el-loading-spinner::before,
body .el-icon-loading::before,
body .eds-loading::before,
body .vxe-loading .vxe-loading--spinner,
body .vxe-button--loading-icon::before,
body .vxe-icon--refresh.roll::before,
body .el-spinner::before,
body .vjs-loading-spinner::before {
  display: inline-block;
  width: 48px;
  height: 48px;
  box-sizing: border-box;
  background: url("./hourglass.svg") center / contain no-repeat;
  vertical-align: middle;
  flex-shrink: 0;
}

.aibs-helix {
  background-image: url("./helix.svg");
}

.aibs-startup-loading {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #646d79;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.aibs-startup-loading > .aibs-helix {
  width: 64px;
  height: 64px;
}

.aibs-startup-loading > .aibs-startup-loading__text {
  margin: 20px 24px 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  text-align: center;
}

/* Keep the existing directive/service lifecycle; replace only its visual. */
body .el-loading-mask .el-loading-spinner {
  margin-top: 0;
  transform: translateY(-50%);
}

body .el-loading-mask .el-loading-spinner::before {
  content: "";
}

body .el-loading-mask .el-loading-spinner > .circular,
body .el-loading-mask .el-loading-spinner > i,
body .el-spinner > .el-spinner-inner {
  display: none !important;
}

body .el-loading-mask .el-loading-spinner > .el-loading-text,
body .el-loading-mask.is-fullscreen .el-loading-spinner > .el-loading-text {
  display: block;
  margin: 12px 16px 0;
  padding: 0;
  color: #646d79;
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}

body .el-loading-mask.is-fullscreen .el-loading-spinner {
  min-width: 144px;
  max-width: calc(100vw - 48px);
  padding: 24px 32px;
  margin: 0;
  transform: translate(-50%, -50%);
}

body .el-loading-mask.is-fullscreen .el-loading-spinner::before {
  width: 56px;
  height: 56px;
}

body .el-button .el-loading-mask .el-loading-spinner::before {
  width: 20px;
  height: 20px;
}

/* Button, tree, upload, pagination and custom icon loading states. */
body .el-icon-loading,
body .eds-loading,
body .vxe-button--loading-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  animation: none !important;
  vertical-align: -0.12em;
}

body .vxe-icon--refresh.roll,
body .vxe-button--loading-icon {
  border: 0;
  border-radius: 0;
  animation: none !important;
}

body .el-icon-loading::before,
body .eds-loading::before,
body .vxe-button--loading-icon::before,
body .vxe-icon--refresh.roll::before {
  content: "" !important;
  width: 1em;
  height: 1em;
  border: 0;
  border-radius: 0;
  position: static;
  transform: none;
  animation: none !important;
}

body .vxe-button--loading-icon::after,
body .vxe-icon--refresh.roll::after {
  content: none;
}

body .el-button .el-icon-loading,
body .vxe-button--loading-icon {
  width: 18px;
  height: 18px;
  font-size: 18px;
}

body .el-button--primary:not(.is-plain) .el-icon-loading::before,
body .el-button--success:not(.is-plain) .el-icon-loading::before,
body .el-button--warning:not(.is-plain) .el-icon-loading::before,
body .el-button--danger:not(.is-plain) .el-icon-loading::before,
body .el-button--info:not(.is-plain) .el-icon-loading::before,
body .vxe-button.type--button.theme--primary .vxe-button--loading-icon::before,
.aibs-loading--light {
  filter: brightness(0) invert(1);
}

/* VXE owns positioning and visibility, including mini/small table sizes. */
body .vxe-loading .vxe-loading--spinner::before,
body .vxe-loading .vxe-loading--spinner::after {
  content: none;
  animation: none;
}

body .el-spinner::before {
  content: "";
  width: 24px;
  height: 24px;
}

body .mce-throbber {
  background-image: url("./hourglass.svg") !important;
  background-size: 40px 40px !important;
}

/* The PDF preview is an iframe and includes this stylesheet itself. */
body .pdfViewer .page .loadingIcon {
  background-image: url("./hourglass.svg");
  background-size: 48px 48px;
}

body #findInput[data-status="pending"],
body .toolbarField.pageNumber.visiblePageIsLoading {
  background-image: url("./hourglass.svg");
  background-size: 16px 16px;
}

body .vjs-loading-spinner {
  border: 0;
  border-radius: 0;
}

body .vjs-loading-spinner::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  animation: none !important;
  filter: brightness(0) invert(1);
}

body .vjs-loading-spinner::after {
  content: none;
}

/* Background SVG documents do not consistently inherit the page's media
 * preferences, so use genuinely static assets instead of pausing them. */
@media (prefers-reduced-motion: reduce) {
  .aibs-hourglass,
  body .el-loading-spinner::before,
  body .el-icon-loading::before,
  body .eds-loading::before,
  body .vxe-loading .vxe-loading--spinner,
  body .vxe-button--loading-icon::before,
  body .vxe-icon--refresh.roll::before,
  body .el-spinner::before,
  body .vjs-loading-spinner::before,
  body .pdfViewer .page .loadingIcon,
  body #findInput[data-status="pending"],
  body .toolbarField.pageNumber.visiblePageIsLoading {
    background-image: url("./hourglass-static.svg");
  }

  body .mce-throbber {
    background-image: url("./hourglass-static.svg") !important;
  }

  .aibs-helix {
    background-image: url("./helix-static.svg");
  }
}
