@import './../theme/vars.scss';

$tips-prefix-cls: amos-tips;

$tips-message-color: $heading-color;
$tips-text-color: $text-color;
$tips-close-color: $text-color-secondary;
$tips-close-hover-color: #404040;

.#{$tips-prefix-cls} {
  position: relative;
  padding: 8px 15px 8px 37px;
  border-radius: $border-radius-base;

  &.#{$tips-prefix-cls}-no-icon {
    padding: 8px 15px;
  }

  &.#{$tips-prefix-cls}-closable {
    padding-right: 30px;
  }

  &-icon {
    position: absolute;
    top: 6px;
    left: 16px;
    display: inline-block;
  }

  &-description {
    display: none;
    font-size: $font-size-base;
    line-height: 22px;
  }

  &-success {
    background-color: $tips-success-bg-color;
    border: $border-width-base $border-style-base $tips-success-border-color;

    .#{$tips-prefix-cls}-icon {
      color: $tips-success-icon-color;
    }
  }

  &-info {
    background-color: $tips-info-bg-color;
    border: $border-width-base $border-style-base $tips-info-border-color;

    .#{$tips-prefix-cls}-icon {
      color: $tips-info-icon-color;
    }
  }

  &-warning {
    background-color: $tips-warning-bg-color;
    border: $border-width-base $border-style-base $tips-warning-border-color;

    .#{$tips-prefix-cls}-icon {
      color: $tips-warning-icon-color;
    }
  }

  &-error {
    background-color: $tips-error-bg-color;
    border: $border-width-base $border-style-base $tips-error-border-color;

    .#{$tips-prefix-cls}-icon {
      color: $tips-error-icon-color;
    }
  }

  &-close-icon {
    position: absolute;
    top: 4px;
    right: 8px;
    overflow: hidden;
    font-size: $font-size-sm;
    line-height: 22px;
    cursor: pointer;

    .#{$iconfont-css-prefix}-cross {
      font-size: $font-size-base;
      color: $tips-close-color;
      transition: color 0.3s;

      &:hover {
        color: $tips-close-hover-color;
      }
    }
  }

  &-close-text {
    position: absolute;
    right: 16px;
  }

  &-with-description {
    position: relative;
    padding: 15px 15px 15px 64px;
    line-height: $line-height-base;
    color: $tips-text-color;
    border-radius: $border-radius-base;
  }

  &-with-description.#{$tips-prefix-cls}-no-icon {
    padding: 15px;
  }

  &-with-description &-icon {
    position: absolute;
    top: 16px;
    left: 24px;
    font-size: 24px;
  }

  &-with-description &-close-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: $font-size-base;
    cursor: pointer;
  }

  &-with-description &-message {
    display: block;
    margin-bottom: 4px;
    font-size: $font-size-lg;
    color: $tips-message-color;
  }

  &-with-description &-description {
    display: block;
  }

  &.#{$tips-prefix-cls}-close {
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    transition: all 0.3s $ease-in-out-circ;
    transform-origin: 50% 0;
  }

  &-slide-up-leave {
    animation: amosTipsSlideUpOut 0.3s $ease-in-out-circ;
    animation-fill-mode: both;
  }

  &-banner {
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
  }
}

.border-scale-anim {
  animation: amosBorderScale 1s infinite $ease-in-out-circ;
  transition: all 0.6s;

  &:hover {
    animation-play-state: paused;
  }
}

@keyframes amosTipsSlideUpIn {
  0% {
    opacity: 0;
    transform-origin: 0% 0%;
    transform: scaleY(0);
  }

  100% {
    opacity: 1;
    transform-origin: 0% 0%;
    transform: scaleY(1);
  }
}

@keyframes amosTipsSlideUpOut {
  0% {
    opacity: 1;
    transform-origin: 0% 0%;
    transform: scaleY(1);
  }

  100% {
    opacity: 0;
    transform-origin: 0% 0%;
    transform: scaleY(0);
  }
}

@keyframes amosBorderScale {
  0% {
    box-shadow: 0 0 0 0 rgba(red, 0.6);
  }

  100% {
    box-shadow: 0 0 20px 0 rgba(red, 0.8);
  }
}
