$ios7-timing-function: cubic-bezier(.1, .7, .1, 1);

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

.noop-animation {
  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
    @include transition(all cubic-bezier(0.250, 0.460, 0.450, 0.940) 250ms);
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    left:0;
  }
}

.slide-left-right {
  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
    @include transition(all cubic-bezier(0.250, 0.460, 0.450, 0.940) 250ms);
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    left:0;
  }
  > .ng-enter, &.ng-enter {
    @include translate3d(100%, 0, 0);
  }
  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
    @include translate3d(0, 0, 0);
  }
  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
    @include translate3d(-100%, 0, 0);
  }

  &.reverse {
    > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
      @include transition(all cubic-bezier(0.250, 0.460, 0.450, 0.940) 250ms);
      position:absolute;
      top:0;
      right:0;
      bottom:0;
      left:0;
    }
    > .ng-enter, &.ng-enter {
      @include translate3d(-100%, 0, 0);
    }
    > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
      @include translate3d(0, 0, 0);
    }
    > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
      @include translate3d(100%, 0, 0);
    }
  }
}
.slide-left-right-ios7 {
  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
    @include transition(all 250ms);
    @include transition-timing-function($ios7-timing-function);
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    left:0;
    box-shadow: $menu-side-shadow;
  }
  > .ng-enter, &.ng-enter {
    @include translate3d(100%, 0, 0);
  }
  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
    @include translate3d(0, 0, 0);
  }
  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
    @include translate3d(-20%, 0, 0);
  }
  
  &.reverse {
    > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
      @include transition(all cubic-bezier(0.250, 0.460, 0.450, 0.940) 250ms);
      @include transition-timing-function($ios7-timing-function);
      position:absolute;
      top:0;
      right:0;
      bottom:0;
      left:0;
    }
    > .ng-enter, &.ng-enter {
      @include translate3d(-20%, 0, 0);
    }
    > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
      @include translate3d(0, 0, 0);
    }
    > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
      @include translate3d(100%, 0, 0);
    }
  }
}

@-webkit-keyframes slideInLeft {
  0% {
    @include translate3d(100%, 0, 0);
  }
  100% {
    @include translate3d(0,0,0);
  }
}
@-webkit-keyframes slideOutLeft {
  0% {
    @include translate3d(0px,0,0);
  }
  100% {
    @include translate3d(-100%,0,0);
  }
}
@-webkit-keyframes slideInRight {
  0% {
    @include translate3d(-100%,0,0);
  }
  100% {
    @include translate3d(0,0,0);
  }
}
@-webkit-keyframes slideOutRight {
  0% {
    @include translate3d(0,0,0);
  }
  100% {
    @include translate3d(100%,0,0);
  }
}

.slide-in-left {
  @include translate3d(0%,0,0);
  &.ng-enter, > .ng-enter {
    @include animation-name(slideInLeft);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
  &.ng-leave, > .ng-leave {
    @include animation-name(slideOutLeft);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
}


.slide-in-left-add {
  @include translate3d(100%,0,0);
  @include animation-duration(250ms);
  @include animation-timing-function(ease-in-out);
  @include animation-fill-mode(both);
}
.slide-in-left-add-active {
  @include animation-name(slideInLeft);
}

.slide-out-left {
  @include translate3d(-100%,0,0);
  &.ng-enter, > .ng-enter {
    @include animation-name(slideOutLeft);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
  &.ng-leave, > .ng-leave {
    @include animation-name(slideOutLeft);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
}

.slide-out-left {
}

.slide-out-left-add {
  @include translate3d(0,0,0);
  @include animation-duration(250ms);
  @include animation-timing-function(ease-in-out);
  @include animation-fill-mode(both);
}
.slide-out-left-add-active {
  @include animation-name(slideOutLeft);
}

.slide-in-right {
  @include translate3d(0%,0,0);
  &.ng-enter, > .ng-enter {
    @include animation-name(slideInRight);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
  &.ng-leave, > .ng-leave {
    @include animation-name(slideInRight);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
}

.slide-in-right-add {
  @include translate3d(-100%,0,0);
  @include animation-duration(250ms);
  @include animation-timing-function(ease-in-out);
  @include animation-fill-mode(both);
}
.slide-in-right-add-active {
  @include animation-name(slideInRight);
}

.slide-out-right {
  @include translate3d(100%,0,0);
  &.ng-enter, > .ng-enter {
    @include animation-name(slideOutRight);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
  &.ng-leave, > .ng-leave {
    @include animation-name(slideOutRight);
    @include animation-duration(250ms);
    @include animation-timing-function(ease-in-out);
    @include animation-fill-mode(both);
  }
}

.slide-out-right {
}
.slide-out-right-add {
  @include translate3d(0,0,0);
  @include animation-duration(250ms);
  @include animation-timing-function(ease-in-out);
  @include animation-fill-mode(both);
}
.slide-out-right-add-active {
  @include animation-name(slideOutRight);
}

$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(both);
}
.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);
}

@-webkit-keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@-webkit-keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.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;
  }
}

@-webkit-keyframes spin { 
  100% { -webkit-transform: rotate(360deg); } 
}
@-moz-keyframes spin { 
  100% { -moz-transform: rotate(360deg); } 
}
@keyframes spin { 
  100% { transform: rotate(360deg); } 
}



/**
 * Some component specific animations
 */

.nav-title-slide-ios7 {
  > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
    @include transition(all 350ms);
    @include transition-timing-function($ios7-timing-function);
    opacity: 1;
  }
  > .ng-enter, &.ng-enter {
    @include translate3d(30%, 0, 0);
    opacity: 0;
  }
  > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
    @include translate3d(0, 0, 0);
    opacity: 1;
  }
  > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
    @include translate3d(-30%, 0, 0);
    opacity: 0;
  }

}
.reverse {
  .nav-title-slide-ios7 {
    > .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
      @include transition(all 350ms);
      @include transition-timing-function($ios7-timing-function);
      opacity: 1;
    }
    > .ng-enter, &.ng-enter {
      @include translate3d(-30%, 0, 0);
      opacity: 0;
    }
    > .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
      @include translate3d(0, 0, 0);
      opacity: 1;
    }
    > .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
      @include translate3d(30%, 0, 0);
      opacity: 0;
    }
  }
}
