/**
 * AJAX (throbber) styling.
 */

@import 'settings';

// @todo This should probably be it's own mixin/component?
@keyframes glyphicon-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(359deg); }
}

.glyphicon-spin {
  display: inline-block;
  animation: glyphicon-spin 1s infinite linear;
}

a .glyphicon-spin {
  display: inline-block;
  text-decoration: none;
  vertical-align: middle;

  &:before {
    position: static;
    display: block;
  }
}

html.js {
  .btn .ajax-throbber {
    margin: -1px 0 0 .5em;
  }

  .input-group-addon {
    .glyphicon {
      color: $gray-light;
      opacity: .5;
      transition: 150ms color, 150ms opacity;

      &.glyphicon-spin {
        opacity: 1;
      }

    }

  }

  // Hide empty wrappers from AJAX/Field APIs.
  .ajax-new-content:empty {
    display: none !important;
  }
}

// For position progress bar.
.form-type-managed-file {

  label {
    display: block;
  }

}

.form-managed-file {
  position: relative;

  .form-submit[data-drupal-selector*='upload-button'] {
    font-size: 0;
    color: transparent;
  }

  .js-hide.form-submit[disabled] {
    position: relative;
    display: inline-block !important;
    width: 40px;
    height: 40px;
    top: 0;
    right: 0;
    padding: 0;

    .ajax-throbber {
      position: absolute;
      top: 10px;
      left: 10px;


      &:before {
        top: 0;
      }

    }

  }

}
