@import '../../style/themes/default';
@import '../../style/mixins/index';

@alert-prefix-cls: ~'@{c7n-prefix}-alert';

.@{alert-prefix-cls} {
  .reset-component;
  position: relative;
  display: flex;
  padding: @alert-padding;
  font-size: @alert-font-size;
  word-break: break-all;
  border-radius: @alert-border-radius;

  &-content{
    flex: 1;
  }

  &-close-wrapper {
    margin: @alert-close-wrapper-margin;
    padding: @alert-close-wrapper-padding;
    background-color: transparent;
    border: none;
  }

  &&-no-icon {
    padding: @alert-no-icon-padding;
  }

  &-icon {
    position: absolute;
    top: @alert-icon-top;
    left: @alert-icon-left;
  }

  &-message {
    color: @alert-message-color;
    font-size: @alert-message-font-size;
    line-height: @alert-message-line-height;
  }

  &-description {
    display: none;
    font-size: @font-size-base;
    line-height: @alert-description-line-height;
  }

  &-success {
    background-color: @success-1;
    border: @alert-border-width @border-style-base @success-3;

    .@{alert-prefix-cls}-icon {
      color: @success-color;
    }
  }

  &-info {
    background-color: @info-1;
    border: @alert-border-width @border-style-base @info-3;

    .@{alert-prefix-cls}-icon {
      color: @info-color;
    }
  }

  &-warning {
    background-color: @warning-1;
    border: @alert-border-width @border-style-base @warning-3;

    .@{alert-prefix-cls}-icon {
      color: @warning-color;
    }
  }

  &-error {
    background-color: @error-1;
    border: @alert-border-width @border-style-base @error-3;

    .@{alert-prefix-cls}-icon {
      color: @error-color;
    }
  }

  &-close-icon {
    overflow: hidden;
    font-size: @font-size-sm;
    line-height: 1.5;
    cursor: pointer;

    .@{iconfont-css-prefix}-close {
      color: @text-color-secondary;
      transition: color @animation-duration-slow;

      &:hover {
        color: #404040;
      }
    }
  }

  &-close-text {
    position: absolute;
    right: 0.16rem;
  }

  &-with-description {
    align-items: flex-start;
    padding: @alert-with-description-padding;
    color: @text-color;
    line-height: @line-height-base;
    border-radius: @alert-with-description-border-radius;
  }

  &-with-description&-no-icon {
    padding: @alert-with-description-no-icon-padding;
  }

  &-with-description &-icon {
    position: absolute;
    top: @alert-with-description-icon-top;
    left: @alert-with-description-icon-left;
    font-size: @alert-with-description-icon-size;
  }

  &-with-description &-close-icon {
    font-size: @font-size-base;
    cursor: pointer;
  }

  &-with-description &-message {
    display: block;
    margin: @alert-with-description-message-margin;
    color: @alert-message-color;
    font-size: @alert-with-description-message-font-size;
  }

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

  &&-close {
    height: 0 !important;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    transform-origin: 50% 0;
    transition: all @animation-duration-slow @ease-in-out-circ;
  }

  &-slide-up-leave {
    animation: c7nAlertSlideUpOut @animation-duration-slow @ease-in-out-circ;
    animation-fill-mode: both;
  }

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

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

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