@keyframes gin-throbber {
  0% {
    transform: rotateZ(0);
  }
  100% {
    transform: rotateZ(360deg);
  }
}

// Normal Throbber
.ajax-progress {
  &__throbber {
    border: 3px solid var(--gin-color-primary);
    border-inline-end: 3px dotted transparent;
  }

  .ajax-progress__message {
    color: var(--gin-color-text);
  }

  &--fullscreen {
    [dir].gin--dark-mode & {
      background-color: var(--gin-color-primary);
      border-color: transparent;
      box-shadow: 0 2px 6px 0 var(--gin-bg-app);

      .ajax-progress__throbber {
        border: 3px solid var(--gin-bg-app);
        border-inline-end: 3px dotted transparent;
      }
    }
  }
}

// Media library Throbber
.media-library-widget {
  .ajax-progress__throbber {
    border: 2px solid var(--gin-color-primary);
    border-inline-end: 2px dotted transparent;
  }
}

// UI Dialog Throbber
.ui-dialog .ajax-progress-throbber {
  padding: var(--gin-spacing-xs);
  background: var(--gin-bg-app);
  border-radius: 50%;
  box-shadow: 0 2px 6px 0 rgba(34, 35, 48, 0.1);
  border: 1px solid rgba(216, 217, 224, 0.8);

  .gin--dark-mode & {
    background-color: var(--gin-color-primary);
    border-color: transparent;
    box-shadow: 0 2px 6px 0 var(--gin-bg-app);
  }
}

.ui-dialog .ajax-progress-throbber,
.contextual-links .ajax-progress-throbber {
  &::before {
    content: "";
    display: block;
    position: absolute;
    inset-block-start: var(--gin-spacing-xs);
    inset-inline-start: var(--gin-spacing-xs);
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid var(--gin-color-primary);
    border-inline-end: 2px dotted transparent;
    border-radius: 50%;
    @media (prefers-reduced-motion: no-preference) {
      animation: gin-throbber 0.75s linear infinite;
    }
  }
}

.ajax-progress__throbber--fullscreen,
.ui-dialog .ajax-progress__throbber,
.media-library-item .ajax-progress__throbber {
  @extend .ajax-progress__throbber;
}

// Darkmode background.
.ui-dialog .ajax-progress,
.media-library-item .ajax-progress.ajax-progress.ajax-progress {
  .gin--dark-mode & {
    background-color: var(--gin-bg-app);
    border-color: var(--gin-bg-app);
  }
}

.contextual-links {
  li {
    position: relative;
  }

  .ajax-progress-throbber {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: var(--gin-spacing-xxs);
    width: 24px;
    height: 24px;

    &::before {
      inset-block-start: 0;
      inset-inline-start: .25em;
    }
  }
}

.claro-autocomplete__message {
  color: var(--gin-color-primary);
}
