/**
 * Animations
 * --------------------------------------------------
 * The animations in this file are "simple" - not too complex
 * and pretty easy on performance. They can be overidden
 * and enhanced easily.
 */

// Animation Mixins
// --------------------------------------------------

@mixin animation($animation) {
 -webkit-animation: $animation;
    -moz-animation: $animation;
         animation: $animation;
}
@mixin animation-duration($duration) {
 -webkit-animation-duration: $duration;
    -moz-animation-duration: $duration;
         animation-duration: $duration;
}
@mixin animation-timing-function($animation-timing) {
 -webkit-animation-timing-function: $animation-timing;
    -moz-animation-timing-function: $animation-timing;
         animation-timing-function: $animation-timing;
}
@mixin animation-fill-mode($fill-mode) {
 -webkit-animation-fill-mode: $fill-mode;
    -moz-animation-fill-mode: $fill-mode;
         animation-fill-mode: $fill-mode;
}
@mixin animation-name($name) {
 -webkit-animation-name: $name;
    -moz-animation-name: $name;
         animation-name: $name;
}
@mixin animation-iteration-count($count) {
 -webkit-animation-iteration-count: $count;
    -moz-animation-iteration-count: $count;
         animation-iteration-count: $count;
 }

/**
 * Keyframes
 * --------------------------------------------------
 */

$slide-in-up-function: cubic-bezier(.1, .7, .1, 1);
@-webkit-keyframes slideInUp {
  0% {
    @include translate3d(0, 100%, 0);
    opacity: 0;
  }
  100% {
    @include translate3d(0, 0, 0);
    opacity: 1;
  }
}
@-webkit-keyframes slideOutUp {
  0% {
    @include translate3d(0, 0, 0);
    opacity: 1;
  }
  100% {
    @include translate3d(0, 100%, 0);
    opacity: 0;
  }
}

.slide-in-up {
  // Start it down low
  @include translate3d(0, 0, 0);
  opacity: 1;

  &.ng-enter, .ng-enter {
    // Start it down low
    @include translate3d(0, 100%, 0);

    @include animation-duration(400ms);
    @include animation-timing-function($slide-in-up-function);
    @include animation-fill-mode(both);
    // Start hidden
    opacity: 0;
  }

  &.ng-enter-active, .ng-enter-active {
    @include animation-name(slideInUp);
  }

  &.ng-leave, .ng-leave {
    @include animation-duration(400ms);
    @include animation-timing-function($slide-in-up-function);
    @include animation-fill-mode(both);
  }

  &.ng-leave-active, .ng-leave {
    @include animation-name(slideOutUp);
  }
}

.slide-in-up-add {
  @include animation-duration(400ms);
  @include animation-timing-function($slide-in-up-function);
  @include animation-fill-mode(forwards);
}
.slide-in-up-add-active {
  @include animation-name(slideInUp);
}

.slide-in-up-remove {
  @include animation-duration(400ms);
  @include animation-timing-function($slide-in-up-function);
  @include animation-fill-mode(forwards);
}
.slide-in-up-remove-active {
  @include animation-name(slideOutUp);
}

.fade-in {
  @include animation(fadeOut 0.3s);
  &.active {
    @include animation(fadeIn 0.3s);
  }
}

.fade-in-not-out {
  &.ng-enter, .ng-enter {
    @include animation(fadeIn 0.3s);
    position: relative;
  }
  &.ng-leave, .ng-leave {
    display: none;
  }
}
