// SweetAlert2
// github.com/sweetalert2/sweetalert2

@import 'variables';
@import 'mixins';

@import 'toasts';

html,
body {
  &.swal2-shown {
    @include not(
      '.swal2-no-backdrop',
      '.swal2-toast-shown'
    ) {
      height: auto; // #781
      overflow-y: hidden;
    }
  }
}

body {
  &.swal2-iosfix {
    position: fixed;
    right: 0;
    left: 0;
  }

  &.swal2-no-backdrop {

    .swal2-shown {
      top: auto;
      right: auto;
      bottom: auto;
      left: auto;
      background-color: transparent;

      & > .swal2-modal {
        box-shadow: 0 0 10px $swal2-backdrop;
      }

      &.swal2-top {
        top: 0;
        left: 50%;
        transform: translateX(-50%);
      }

      &.swal2-top-start,
      &.swal2-top-left {
        top: 0;
        left: 0;
      }

      &.swal2-top-end,
      &.swal2-top-right {
        top: 0;
        right: 0;
      }

      &.swal2-center {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
      }

      &.swal2-center-start,
      &.swal2-center-left {
        top: 50%;
        left: 0;
        transform: translateY(-50%);
      }

      &.swal2-center-end,
      &.swal2-center-right {
        top: 50%;
        right: 0;
        transform: translateY(-50%);
      }

      &.swal2-bottom {
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
      }

      &.swal2-bottom-start,
      &.swal2-bottom-left {
        bottom: 0;
        left: 0;
      }

      &.swal2-bottom-end,
      &.swal2-bottom-right {
        right: 0;
        bottom: 0;
      }
    }
  }
}

.swal2-container {
  // centering
  display: flex;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 10px;

  // backdrop
  background-color: transparent;

  z-index: 1060;
  overflow-x: hidden;

  &.swal2-top {
    align-items: flex-start;
  }

  &.swal2-top-start,
  &.swal2-top-left {
    align-items: flex-start;
    justify-content: flex-start;
  }

  &.swal2-top-end,
  &.swal2-top-right {
    align-items: flex-start;
    justify-content: flex-end;
  }

  &.swal2-center {
    align-items: center;
  }

  &.swal2-center-start,
  &.swal2-center-left {
    align-items: center;
    justify-content: flex-start;
  }

  &.swal2-center-end,
  &.swal2-center-right {
    align-items: center;
    justify-content: flex-end;
  }

  &.swal2-bottom {
    align-items: flex-end;
  }

  &.swal2-bottom-start,
  &.swal2-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
  }

  &.swal2-bottom-end,
  &.swal2-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
  }

  &.swal2-grow-fullscreen > .swal2-modal {
    display: flex !important;
    flex: 1;
    align-self: stretch;
    justify-content: center;
  }

  &.swal2-grow-row > .swal2-modal {
    display: flex !important;
    flex: 1;
    align-content: center;
    justify-content: center;
  }

  &.swal2-grow-column {
    flex: 1;
    flex-direction: column;

    &.swal2-top,
    &.swal2-center,
    &.swal2-bottom {
      align-items: center;
    }

    &.swal2-top-start,
    &.swal2-center-start,
    &.swal2-bottom-start,
    &.swal2-top-left,
    &.swal2-center-left,
    &.swal2-bottom-left {
      align-items: flex-start;
    }

    &.swal2-top-end,
    &.swal2-center-end,
    &.swal2-bottom-end,
    &.swal2-top-right,
    &.swal2-center-right,
    &.swal2-bottom-right {
      align-items: flex-end;
    }

    & > .swal2-modal {
      display: flex !important;
      flex: 1;
      align-content: center;
      justify-content: center;
    }
  }

  @include not(
    '.swal2-top',
    '.swal2-top-start',
    '.swal2-top-end',
    '.swal2-top-left',
    '.swal2-top-right',
    '.swal2-center-start',
    '.swal2-center-end',
    '.swal2-center-left',
    '.swal2-center-right',
    '.swal2-bottom',
    '.swal2-bottom-start',
    '.swal2-bottom-end',
    '.swal2-bottom-left',
    '.swal2-bottom-right') {
    & > .swal2-modal {
      margin: auto;
    }
  }

  @include ie {
    .swal2-modal {
      margin: 0 !important;
    }
  }

  &.swal2-fade {
    transition: background-color .1s;
  }

  &.swal2-shown {
    background-color: $swal2-backdrop;
  }
}


.swal2-popup {
  display: none;
  position: relative;
  flex-direction: column;
  justify-content: center;
  width: $swal2-width;
  max-width: 100%;
  padding: $swal2-padding;
  border-radius: .3125em;
  background-color: $swal2-background-color;
  font-family: $swal2-font;
  font-size: $swal2-font-size;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;

  &:focus {
    outline: none;
  }

  &.swal2-loading {
    overflow-y: hidden;
  }

  .swal2-header {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .swal2-title {
    display: block;
    position: relative;
    margin: 0 0 .4em;
    padding: 0;
    color: $swal2-title-color;
    font-size: $swal2-title-font-size;
    font-weight: 600;
    text-align: center;
    text-transform: none;
    word-wrap: break-word;
  }

  .swal2-actions {
    align-items: center;
    justify-content: center;
    margin-top: 1.25em;

    &:not(.swal2-loading) {
      .swal2-styled {
        &[disabled] {
          opacity: .4;
        }

        &:hover {
          background-image: linear-gradient($swal2-button-darken-hover, $swal2-button-darken-hover);
        }

        &:active {
          background-image: linear-gradient($swal2-button-darken-active, $swal2-button-darken-active);
        }
      }
    }

    &.swal2-loading {
      .swal2-styled {
        &.swal2-confirm {
          width: 2.5em;
          height: 2.5em;
          margin: .46875em;
          padding: 0;
          border: .25em solid transparent;
          border-radius: 100%;
          border-color: transparent;
          background-color: transparent !important;
          color: transparent;
          cursor: default;
          box-sizing: border-box;
          animation: rotate-loading 1.5s linear 0s infinite normal;
          user-select: none;
        }

        &.swal2-cancel {
          margin-right: 30px;
          margin-left: 30px;
        }
      }

      :not(.swal2-styled) {
        &.swal2-confirm {
          &::after {
            display: inline-block;
            width: 15px;
            height: 15px;
            margin-left: 5px;
            border: 3px solid lighten($swal2-black, 60);
            border-radius: 50%;
            border-right-color: transparent;
            box-shadow: 1px 1px 1px $swal2-white;
            content: '';
            animation: rotate-loading 1.5s linear 0s infinite normal;
          }
        }
      }
    }
  }

  .swal2-styled {
    margin: 0 .3125em;
    padding: .625em 2em;
    font-weight: 500;
    box-shadow: none;

    &:not([disabled]) {
      cursor: pointer;
    }

    &.swal2-confirm {
      border: $swal2-confirm-button-border;
      border-radius: $swal2-confirm-button-border-radius;
      background-color: $swal2-confirm-button-background-color;
      color: $swal2-confirm-button-color;
      font-size: $swal2-confirm-button-font-size;
    }

    &.swal2-cancel {
      border: $swal2-cancel-button-border;
      border-radius: $swal2-cancel-button-border-radius;
      background-color: $swal2-cancel-button-background-color;
      color: $swal2-cancel-button-color;
      font-size: $swal2-cancel-button-font-size;
    }

    &:focus {
      outline: none;
      box-shadow: 0 0 0 2px $swal2-white, 0 0 0 4px $swal2-focus-outline;
    }

    &::-moz-focus-inner {
      border: 0;
    }
  }

  .swal2-footer {
    justify-content: center;
    margin-top: 1.25em;
    padding-top: 1em;
    border-top: 1px solid $swal2-footer-border-color;
    color: $swal2-footer-color;
    font-size: $swal2-footer-font-size;
  }

  .swal2-image {
    max-width: 100%;
    margin: 1.25em auto;
  }

  .swal2-close {
    position: absolute;
    top: 5px;
    right: 8px;
    justify-content: center;
    width: 1.2em;
    min-width: 1.2em;
    height: 1.2em;
    margin: 0;
    padding: 0;
    transition: color .1s ease;
    border: 0;
    background: $swal2-transparent;
    // calc is needed for the correct focus outline, w/o calc: https://goo.gl/T3NYRm
    color: $swal2-close-button;
    font-family: serif;
    font-size: calc(#{$swal2-close-button-size} - #{$swal2-close-button-size*.1});
    line-height: 1.2em;
    cursor: pointer;

    &:hover {
      color: $swal2-close-button-hover;
    }
  }

  > .swal2-input,
  > .swal2-file,
  > .swal2-textarea,
  > .swal2-select,
  > .swal2-radio,
  > .swal2-checkbox {
    display: none;
  }

  .swal2-content {
    justify-content: center;
    margin: 0;
    padding: 0;
    color: $swal2-content-color;
    font-size: $swal2-content-font-size;
    font-weight: 300;
    line-height: normal;
    word-wrap: break-word;
  }

  #swal2-content {
    text-align: center;
  }

  .swal2-input,
  .swal2-file,
  .swal2-textarea,
  .swal2-select,
  .swal2-radio,
  .swal2-checkbox {
    margin: 1em auto;
  }

  .swal2-input,
  .swal2-file,
  .swal2-textarea {
    width: 100%;
    transition: border-color .3s, box-shadow .3s;
    border: 1px solid $swal2-input-border;
    border-radius: 3px;
    font-size: $swal2-input-font-size;
    box-shadow: inset 0 1px 1px $swal2-input-box-shadow;
    box-sizing: border-box;

    &.swal2-inputerror {
      border-color: $swal2-error !important;
      box-shadow: 0 0 2px $swal2-error !important;
    }

    &:focus {
      border: 1px solid $swal2-input-border-focus;
      outline: none;
      box-shadow: 0 0 3px $swal2-input-box-shadow-focus;
    }

    &::placeholder {
      color: lighten($swal2-black, 80);
    }
  }

  .swal2-range {
    input {
      width: 80%;
    }

    output {
      width: 20%;
      font-weight: 600;
      text-align: center;
    }

    input,
    output {
      height: 2.625em;
      margin: 1em auto;
      padding: 0;
      font-size: $swal2-input-font-size;
      line-height: 2.625em;
    }
  }

  .swal2-input {
    height: 2.625em;
    padding: 0 .75em;

    &[type='number'] {
      max-width: 10em;
    }
  }

  .swal2-file {
    font-size: $swal2-input-font-size;
  }

  .swal2-textarea {
    height: 6.75em;
    padding: .75em;
  }

  .swal2-select {
    min-width: 50%;
    max-width: 100%;
    padding: .375em .625em;
    color: lighten($swal2-black, 33);
    font-size: $swal2-input-font-size;
  }

  .swal2-radio,
  .swal2-checkbox {
    align-items: center;
    justify-content: center;

    label {
      margin: 0 .6em;
      font-size: $swal2-input-font-size;
    }

    input {
      margin: 0 .4em;
    }
  }

  .swal2-validationerror {
    display: none;
    align-items: center;
    justify-content: center;
    padding: .625em;
    background-color: lighten($swal2-black, 94);
    color: lighten($swal2-black, 50);
    font-size: $swal2-validation-font-size;
    font-weight: 300;
    overflow: hidden;

    &::before {
      display: inline-block;
      width: 1.5em;
      height: 1.5em;
      margin: 0 .625em;
      border-radius: 50%;
      background-color: $swal2-validationerror-background;
      color: $swal2-validationerror-color;
      font-weight: 600;
      line-height: 1.5em;
      text-align: center;
      content: '!';
    }
  }
}

@supports (-ms-accelerator: true) {
  .swal2-range {
    input {
      width: 100% !important;
    }

    output {
      display: none;
    }
  }
}

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  .swal2-range {
    input {
      width: 100% !important;
    }

    output {
      display: none;
    }
  }
}

.swal2-icon {
  position: relative;
  justify-content: center;
  width: 80px;
  height: 80px;
  margin: 1.25em auto 1.875em;
  border: 4px solid transparent;
  border-radius: 50%;
  line-height: 80px;
  cursor: default;
  box-sizing: content-box;
  user-select: none;

  &.swal2-error {
    border-color: $swal2-error;

    .swal2-x-mark {
      position: relative;
      flex-grow: 1;
    }

    [class^='swal2-x-mark-line'] {
      display: block;
      position: absolute;
      top: 37px;
      width: 47px;
      height: 5px;
      border-radius: 2px;
      background-color: $swal2-error;

      &[class$='left'] {
        left: 17px;
        transform: rotate(45deg);
      }

      &[class$='right'] {
        right: 16px;
        transform: rotate(-45deg);
      }
    }
  }

  &.swal2-warning,
  &.swal2-info,
  &.swal2-question {
    margin: .333333em auto .5em;
    font-family: $swal2-font;
    font-size: 3.75em;
  }

  &.swal2-warning {
    border-color: lighten($swal2-warning, 7);
    color: $swal2-warning;
  }

  &.swal2-info {
    border-color: lighten($swal2-info, 20);
    color: $swal2-info;
  }

  &.swal2-question {
    border-color: lighten($swal2-question, 20);
    color: $swal2-question;
  }

  &.swal2-success {
    border-color: $swal2-success;

    [class^='swal2-success-circular-line'] { // Emulate moving circular line
      position: absolute;
      width: 60px;
      height: 120px;
      transform: rotate(45deg);
      border-radius: 50%;

      &[class$='left'] {
        top: -7px;
        left: -33px;
        transform: rotate(-45deg);
        transform-origin: 60px 60px;
        border-radius: 120px 0 0 120px;
      }

      &[class$='right'] {
        top: -11px;
        left: 30px;
        transform: rotate(-45deg);
        transform-origin: 0 60px;
        border-radius: 0 120px 120px 0;
      }
    }

    .swal2-success-ring { // Ring
      position: absolute;
      top: -4px;
      left: -4px;
      width: 80px;
      height: 80px;
      border: 4px solid $swal2-success-border;
      border-radius: 50%;
      z-index: 2;
      box-sizing: content-box;
    }

    .swal2-success-fix { // Hide corners left from animation
      position: absolute;
      top: 8px;
      left: 26px;
      width: 7px;
      height: 90px;
      transform: rotate(-45deg);
      z-index: 1;
    }

    [class^='swal2-success-line'] {
      display: block;
      position: absolute;
      height: 5px;
      border-radius: 2px;
      background-color: $swal2-success;
      z-index: 2;

      &[class$='tip'] {
        top: 46px;
        left: 14px;
        width: 25px;
        transform: rotate(45deg);
      }

      &[class$='long'] {
        top: 38px;
        right: 8px;
        width: 47px;
        transform: rotate(-45deg);
      }
    }
  }
}

.swal2-progresssteps {
  $lightblue: #add8e6;
  $blue: #3085d6;

  align-items: center;
  margin: 0 0 1.25em;
  padding: 0;
  font-weight: 600;

  li {
    display: inline-block;
    position: relative;
  }

  .swal2-progresscircle {
    width: 2em;
    height: 2em;
    border-radius: 2em;
    background: $blue;
    color: $swal2-white;
    line-height: 2em;
    text-align: center;
    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 {
    width: $swal2-progress-steps-distance;
    height: .4em;
    margin: 0 -1px;
    background: $blue;
    z-index: 10;
  }
}


// github.com/sweetalert2/sweetalert2/issues/268
[class^='swal2'] {
  -webkit-tap-highlight-color: $swal2-transparent;
}

// Modal animations
@keyframes showSweetAlert {
  0% {
    transform: scale(.7);
  }

  45% {
    transform: scale(1.05);
  }

  80% {
    transform: scale(.95);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes hideSweetAlert {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  100% {
    transform: scale(.5);
    opacity: 0;
  }
}

.swal2-show {
  animation: showSweetAlert .3s;

  &.swal2-noanimation {
    animation: none;
  }
}

.swal2-hide {
  animation: hideSweetAlert .15s forwards;

  &.swal2-noanimation {
    animation: none;
  }
}


// Right-to-left support
[dir='rtl'] {
  .swal2-close {
    right: auto;
    left: 8px;
  }
}


// Success icon animation

@keyframes animate-success-tip {
  0% {
    top: 19px;
    left: 1px;
    width: 0;
  }

  54% {
    top: 17px;
    left: 2px;
    width: 0;
  }

  70% {
    top: 35px;
    left: -6px;
    width: 50px;
  }

  84% {
    top: 48px;
    left: 21px;
    width: 17px;
  }

  100% {
    top: 45px;
    left: 14px;
    width: 25px;
  }
}

@keyframes animate-success-long {
  0% {
    top: 54px;
    right: 46px;
    width: 0;
  }

  65% {
    top: 54px;
    right: 46px;
    width: 0;
  }

  84% {
    top: 35px;
    right: 0;
    width: 55px;
  }

  100% {
    top: 38px;
    right: 8px;
    width: 47px;
  }
}

@keyframes rotatePlaceholder {
  0% {
    transform: rotate(-45deg);
  }

  5% {
    transform: rotate(-45deg);
  }

  12% {
    transform: rotate(-405deg);
  }

  100% {
    transform: rotate(-405deg);
  }
}

.swal2-animate-success-line-tip {
  animation: animate-success-tip .75s;
}

.swal2-animate-success-line-long {
  animation: animate-success-long .75s;
}

.swal2-success {
  &.swal2-animate-success-icon {
    .swal2-success-circular-line-right {
      animation: rotatePlaceholder 4.25s ease-in;
    }
  }
}


// Error icon animation

@keyframes animate-error-icon {
  0% {
    transform: rotateX(100deg);
    opacity: 0;
  }

  100% {
    transform: rotateX(0deg);
    opacity: 1;
  }
}

.swal2-animate-error-icon {
  animation: animate-error-icon .5s;
}

@keyframes animate-x-mark {
  0% {
    margin-top: 26px;
    transform: scale(.4);
    opacity: 0;
  }

  50% {
    margin-top: 26px;
    transform: scale(.4);
    opacity: 0;
  }

  80% {
    margin-top: -6px;
    transform: scale(1.15);
  }

  100% {
    margin-top: 0;
    transform: scale(1);
    opacity: 1;
  }
}

.swal2-animate-x-mark {
  animation: animate-x-mark .5s;
}

@keyframes rotate-loading {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
