.modal-dialog .modal-title { display: inline-block; }

.modal-range [type="range"] {box-shadow: none;}

.modal-prompt {
    textarea {
        height: 108px;
        padding: 12px;
    }

    .form-control-feedback {
        font-size: 12px;
        position: inherit;
        width: inherit;
        text-align: left;
    }
}

.modal-dialog.has-icon {

}

$icon-success:        #a5dc86 !default;
$icon-success-border: rgba($icon-success, .2) !default;
$icon-error:          #f27474 !default;
$icon-warning:        #f8bb86 !default;
$icon-info:           #3fc3ee !default;
$icon-question:       #87adbd !default;

.modal-icon {
  width: 80px;
  height: 80px;
  border: 4px solid transparent;
  border-radius: 50%;
  margin: 20px auto 30px;
  padding: 0;
  position: relative;
  box-sizing: content-box;
  cursor: default;
  user-select: none;
  -webkit-tap-highlight-color: transparent;

  &.modal-error {
    border-color: $icon-error;

    .x-mark {
      position: relative;
      display: block;
    }

    [class^='x-mark-line'] {
      position: absolute;
      height: 5px;
      width: 47px;
      background-color: $icon-error;
      display: block;
      top: 37px;
      border-radius: 2px;

      &[class$='left'] {
        transform: rotate(45deg);
        left: 17px;
      }

      &[class$='right'] {
        transform: rotate(-45deg);
        right: 16px;
      }
    }
  }

  &.modal-warning {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: $icon-warning;
    border-color: lighten($icon-warning, 7);
    font-size: 60px;
    line-height: 80px;
    text-align: center;
  }

  &.modal-info {
    font-family: 'Open Sans', sans-serif;
    color: $icon-info;
    border-color: lighten($icon-info, 20);
    font-size: 60px;
    line-height: 80px;
    text-align: center;
  }

  &.modal-question {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: $icon-question;
    border-color: lighten($icon-question, 20);
    font-size: 60px;
    line-height: 80px;
    text-align: center;
  }

  &.modal-success {
    border-color: $icon-success;

    [class^='success-circular-line'] { // Emulate moving circular line
      border-radius: 50%;
      position: absolute;
      width: 60px;
      height: 120px;
      transform: rotate(45deg);

      &[class$='left'] {
        border-radius: 120px 0 0 120px;
        top: -7px;
        left: -33px;

        transform: rotate(-45deg);
        transform-origin: 60px 60px;
      }

      &[class$='right'] {
        border-radius: 0 120px 120px 0;
        top: -11px;
        left: 30px;

        transform: rotate(-45deg);
        transform-origin: 0 60px;
      }
    }

    .success-ring { // Ring
      width: 80px;
      height: 80px;
      border: 4px solid $icon-success-border;
      border-radius: 50%;
      box-sizing: content-box;

      position: absolute;
      left: -4px;
      top: -4px;
      z-index: 2;
    }

    .success-fix { // Hide corners left from animation
      width: 7px;
      height: 90px;

      position: absolute;
      left: 28px;
      top: 8px;
      z-index: 1;

      transform: rotate(-45deg);
    }

    [class^='success-line'] {
      height: 5px;
      background-color: $icon-success;
      display: block;
      border-radius: 2px;

      position: absolute;
      z-index: 2;

      &[class$='tip'] {
        width: 25px;

        left: 14px;
        top: 46px;

        transform: rotate(45deg);
      }

      &[class$='long'] {
        width: 47px;

        right: 8px;
        top: 38px;

        transform: rotate(-45deg);
      }
    }
  }
}

// Animations

@mixin keyframes($animation-name) {
  @keyframes #{$animation-name} {
    @content;
  }
}

@mixin animation($str) {
  animation: #{$str};
}

// 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-line-tip {
  @include animation('animate-success-tip 0.75s');
}

.animate-success-line-long {
  @include animation('animate-success-long 0.75s');
}

.modal-success {
  &.animate-success-icon {
    .success-circular-line-right {
      @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(rotate-loading) {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}
