// SweetAlert2
// github.com/limonte/sweetalert2

$white: #fff;

.swal2-overlay {
  background-color: rgba(#000, .4);

  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;

  display: none;
  z-index: 1000;
}

.swal2-modal {
  background-color: $white;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  border-radius: 5px;
  box-sizing: border-box;
  text-align: center;

  position: fixed;
  left: 50%;
  top: 50%;
  margin-top: -200px;

  max-height: 90%;
  overflow-x: hidden;
  overflow-y: auto;
  display: none;
  z-index: 2000;

  &:focus {
    outline: none;
  }

  &.loading {
    overflow-y: hidden;
  }

  h2 {
    color: #575757;
    font-size: 30px;
    text-align: center;
    font-weight: 600;
    text-transform: none;
    position: relative;
    margin: 0;
    padding: 0;
    line-height: 60px;
    display: block;
  }

  .swal2-spacer {
    height: 10px;
    color: transparent;
    border: 0;
  }

  button.styled {
    border: 0;
    border-radius: 3px;
    box-shadow: none;
    color: $white;
    cursor: pointer;
    font-size: 17px;
    font-weight: 500;
    margin: 0 5px;
    padding: 10px 32px;

    &:not(.loading)[disabled] {
      opacity: .4;
      cursor: no-drop;
    }

    &.loading {
      box-sizing: border-box;
      border: 4px solid transparent;
      border-color: transparent;
      width: 40px;
      height: 40px;
      padding: 0;
      margin: -2px 30px;
      vertical-align: top;
      background-color: transparent !important;
      color: transparent;
      cursor: default;
      border-radius: 100%;
      animation: rotate-loading 1.5s linear 0s infinite normal;
    }
  }

  button:not(.styled) {
    &.loading:after {
      display: inline-block;
      content: "";
      margin-left: 5px;
      vertical-align: -1px;
      height: 6px;
      width: 6px;
      border: 3px solid #999;
      border-right-color: transparent;
      border-radius: 50%;
      animation: rotate-loading 1.5s linear 0s infinite normal;
    }
  }

  .swal2-image {
    margin: 20px auto;
    max-width: 100%;
  }

  .swal2-close {
    font-size: 36px;
    line-height: 36px;
    font-family: serif;
    position: absolute;
    top: 5px;
    right: 13px;
    cursor: pointer;
    color: #cfcfcf;
    transition: all 0.1s ease;

    &:hover {
      color: #d55;
    }
  }

  > .swal2-input,
  > .swal2-textarea,
  > .swal2-select,
  > .swal2-radio,
  > .swal2-checkbox {
    display: none;
  }

  .swal2-content {
    font-size: 18px;
    text-align: center;
    font-weight: 300;
    position: relative;
    float: none;
    margin: 0;
    padding: 0;
    line-height: normal;
    color: #555;
  }

  .swal2-input,
  .swal2-textarea,
  .swal2-select,
  .swal2-radio,
  .swal2-checkbox,
  .swal2-range input,
  .swal2-range output {
    margin: 20px auto;
  }

  .swal2-input:not([type="file"]), .swal2-textarea {
    width: 100%;
    box-sizing: border-box;
    border-radius: 3px;
    border: 1px solid rgb(215, 215, 215);
    font-size: 18px;
    box-shadow: inset 0px 1px 1px rgba(black, 0.06);
    transition: all 0.3s;
    &.error {
      border-color: #f06e57 !important;
    }
    &:focus {
      outline: none;
      box-shadow: 0px 0px 3px rgb(196, 230, 245);
      border: 1px solid rgb(180, 219, 237);
      &::-moz-placeholder {
        transition: opacity 0.3s 0.03s ease;
        opacity: 0.8;
      }
      &:-ms-input-placeholder {
        transition: opacity 0.3s 0.03s ease;
        opacity: 0.8;
      }
      &::-webkit-input-placeholder {
        transition: opacity 0.3s 0.03s ease;
        opacity: 0.8;
      }
    }
    &::-moz-placeholder {
      color: lighten(#575757, 40);
    }
    &:-ms-input-placeholder {
      color: lighten(#575757, 40);
    }
    &::-webkit-input-placeholder {
      color: lighten(#575757, 40);
    }
  }

  .swal2-range {
    input {
      float: left;
      padding: 0 !important;
      width: 80% !important;
    }

    output {
      float: right;
      font-size: 20px;
      font-weight: 600;
    }
  }

  .swal2-input:not([type="file"]),
  .swal2-range input,
  .swal2-range output {
    height: 43px;
    line-height: 43px;
    vertical-align: middle;
    padding: 0 12px;
  }

  .swal2-input[type="file"] {
    font-size: 20px;
  }

  .swal2-input[type="number"] {
    max-width: 150px;
  }

  .swal2-textarea {
    height: 108px;
    padding: 12px;
  }

  .swal2-select {
    color: #555;
    font-size: inherit;
    padding: 5px 10px;
    min-width: 40%;
    max-width: 100%;
  }

  .swal2-radio {
    border: 0;

    label:not(:first-child) {
      margin-left: 20px;
    }

    input, span {
      vertical-align: middle;
    }

    input {
      margin: 0 3px 0 0;
    }
  }

  .swal2-checkbox {
    color: #555;
    input, span {
      vertical-align: middle;
    }
  }

  .swal2-validationerror {
    background-color: #f1f1f1;
    margin: 0 -20px;
    overflow: hidden;
    padding: 10px;
    color: #797979;
    font-size: 16px;
    font-weight: 300;
    display: none;

    &::before {
      content: "!";
      display: inline-block;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background-color: rgb(234, 125, 125);
      color: white;
      line-height: 24px;
      text-align: center;
      margin-right: 10px;
    }
  }
}

.swal2-icon {
  $red:    #f27474;
  $orange: #f8bb86;
  $cyan:   #3fc3ee;
  $blue:   #c9dae1;
  $green:  #a5dc86;

  width: 80px;
  height: 80px;
  border: 4px solid #808080;
  border-radius: 50%;
  margin: 20px auto 30px;
  padding: 0;
  position: relative;
  box-sizing: content-box;
  cursor: default;

  /* http://stackoverflow.com/a/4407335/1331425 */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;

  &.swal2-error {
    border-color: $red;

    .x-mark {
      position: relative;
      display: block;
    }

    .line {
      position: absolute;
      height: 5px;
      width: 47px;
      background-color: $red;
      display: block;
      top: 37px;
      border-radius: 2px;

      &.left {
        transform: rotate(45deg);
        left: 17px;
      }

      &.right {
        transform: rotate(-45deg);
        right: 16px;
      }
    }
  }

  &.swal2-warning {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: $orange;
    border-color: $orange;
    font-size: 60px;
    line-height: 80px;
    text-align: center;
  }

  &.swal2-info {
    font-family: "Open Sans", sans-serif;
    color: $cyan;
    border-color: $cyan;
    font-size: 60px;
    line-height: 80px;
    text-align: center;
  }

  &.swal2-question {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: $blue;
    border-color: $blue;
    font-size: 60px;
    line-height: 80px;
    text-align: center;
  }

  &.swal2-success {
    border-color: $green;

    &::before,
    &::after { // Emulate moving circular line
      content: '';
      border-radius: 50%;
      position: absolute;
      width: 60px;
      height: 120px;
      background: $white;
      transform: rotate(45deg);
    }

    &::before {
      border-radius: 120px 0 0 120px;
      top: -7px;
      left: -33px;

      transform: rotate(-45deg);
      transform-origin: 60px 60px;
    }

    &::after {
      border-radius: 0 120px 120px 0;
      top: -11px;
      left: 30px;

      transform: rotate(-45deg);
      transform-origin: 0 60px;
    }

    .placeholder { // Ring
      width: 80px;
      height: 80px;
      border: 4px solid rgba($green, .2);
      border-radius: 50%;
      box-sizing: content-box;

      position: absolute;
      left: -4px;
      top: -4px;
      z-index: 2;
    }

    .fix {  // Hide corners left from animation
      width: 7px;
      height: 90px;
      background-color: $white;

      position: absolute;
      left: 28px;
      top: 8px;
      z-index: 1;

      transform: rotate(-45deg);
    }

    .line {
      height: 5px;
      background-color: $green;
      display: block;
      border-radius: 2px;

      position: absolute;
      z-index: 2;

      &.tip {
        width: 25px;

        left: 14px;
        top: 46px;

        transform: rotate(45deg);
      }

      &.long {
        width: 47px;

        right: 8px;
        top: 38px;

        transform: rotate(-45deg);
      }
    }
  }
}

.swal2-progresssteps {
  $lightblue: #add8e6;
  $blue: #3085d6;

  font-weight: 600;
  margin: 0 0 20px;
  padding: 0;

  li {
    display: inline-block;
    position: relative;
  }

  .swal2-progresscircle {
    background: $blue;
    border-radius: 2em;
    color: $white;
    height: 2em;
    line-height: 2em;
    text-align: center;
    width: 2em;
    z-index: 20;

    &:first-child {
      margin-left: 0;
    }

    &:last-child {
      margin-right: 0;
    }

    &.swal2-activeprogressstep {
      background: $blue;

      ~ .swal2-progresscircle {
        background: $lightblue;
      }

      ~ .swal2-progressline {
        background: $lightblue;
      }
    }
  }

  .swal2-progressline {
    background: $blue;
    height: 0.4em;
    margin: 0 -1px;
    z-index: 10;
  }
}


/* github.com/limonte/sweetalert2/issues/268 */
[class^=swal2] {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

// Animations

@mixin keyframes($animation-name) {
  @keyframes #{$animation-name} {
    @content;
  }
}

@mixin animation($str) {
  animation: #{$str};
}


// Modal animation

@include keyframes(showSweetAlert) {
  0% {
    transform: scale(.7);
  }

  45% {
    transform: scale(1.05);
  }

  80% {
    transform: scale(.95);
  }

  100% {
    transform: scale(1);
  }
}

@include keyframes(hideSweetAlert) {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(.5);
    opacity: 0;
  }
}

.show-swal2 {
  @include animation('showSweetAlert 0.3s');

  &.no-animation {
    @include animation('none');
  }
}

.hide-swal2 {
  @include animation('hideSweetAlert 0.15s forwards');

  &.no-animation {
    @include animation('none');
  }
}



// Success icon animation

@include keyframes(animate-success-tip) {
  0% {
    width: 0;
    left: 1px;
    top: 19px;
  }

  54% {
    width: 0;
    left: 1px;
    top: 19px;
  }

  70% {
    width: 50px;
    left: -8px;
    top: 37px;
  }

  84% {
    width: 17px;
    left: 21px;
    top: 48px;
  }

  100% {
    width: 25px;
    left: 14px;
    top: 45px;
  }
}

@include keyframes(animate-success-long) {
  0% {
    width: 0;
    right: 46px;
    top: 54px;
  }

  65% {
    width: 0;
    right: 46px;
    top: 54px;
  }

  84% {
    width: 55px;
    right: 0;
    top: 35px;
  }

  100% {
    width: 47px;
    right: 8px;
    top: 38px;
  }
}

@include keyframes(rotatePlaceholder) {
  0% {
    transform: rotate(-45deg);
  }

  5% {
    transform: rotate(-45deg);
  }

  12% {
    transform: rotate(-405deg);
  }

  100% {
    transform: rotate(-405deg);
  }
}

.animate-success-tip {
  @include animation('animate-success-tip 0.75s');
}

.animate-success-long {
  @include animation('animate-success-long 0.75s');
}

.swal2-icon.swal2-success.animate::after {
  @include animation('rotatePlaceholder 4.25s ease-in');
}


// Error icon animation

@include keyframes(animate-error-icon) {
  0% {
    transform: rotateX(100deg);
    opacity: 0;
  }

  100% {
    transform: rotateX(0deg);
    opacity: 1;
  }
}

.animate-error-icon {
  @include animation('animate-error-icon 0.5s');
}

@include keyframes(animate-x-mark) {
  0% {
    transform: scale(.4);
    margin-top: 26px;
    opacity: 0;
  }

  50% {
    transform: scale(.4);
    margin-top: 26px;
    opacity: 0;
  }

  80% {
    transform: scale(1.15);
    margin-top: -6px;
  }

  100% {
    transform: scale(1);
    margin-top: 0;
    opacity: 1;
  }
}

.animate-x-mark {
  @include animation('animate-x-mark 0.5s');
}

@include keyframes(pulse-warning) {
  0% {
    border-color: #f8d486;
  }

  100% {
    border-color: #f8bb86;
  }
}

.pulse-warning {
  @include animation('pulse-warning 0.75s infinite alternate');
}

@include keyframes(rotate-loading) {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
