@import '../../style/index.scss';

$modal: 'cp-ui-modal';

.#{$modal} {
  &-mask {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: $modalIndex;
  }

  &-wrap {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: $modalIndex;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  &-container {
    background: #fff;
    border-radius: $border-radius-large;
    width: 70%;
    position: relative;
  }

  &-header {
    padding: 24px 24px 0 24px;

    .#{$modal}-title {
      text-align: center;
    }
  }

  &-close {
    position: absolute;
    right: 0;
    top: 0;
    color: rgba(0, 0, 0, 0.45);
    width: 55px;
    height: 55px;
    line-height: 55px;
    text-align: center;
    cursor: pointer;

    .cp-ui-icon {
      font-size: 16px;
    }
  }

  &-body {
    &-contain {
      padding: 24px 16px;
      text-align: center;
      font-size: $font-size-normal;
      line-height: $line-height-normal;
      word-wrap: break-word;
    }

  }

  &-footer {
    padding: 10px auto;
    text-align: right;
    border-top: 1px solid #e8e8e8;

    &-container {
      display: flex;

      .#{$modal}-footer-ok-only {
        font-family: PingFangSC-Regular;
        font-size: 16px;
        color: $color-brand-normal;
        letter-spacing: 0;
        padding: 8px 12px;
        text-align: center;
        background: none;
        line-height: 16px;
        border-bottom-right-radius: 10px;
        border-bottom-left-radius: 10px;
      }

      .#{$modal}-footer-ok {
        font-family: PingFangSC-Regular;
        font-size: 16px;
        padding: 8px 0;
        color: $color-brand-normal;
        letter-spacing: 0;
        background: none;
        line-height: 16px;
        border-bottom-right-radius: 10px;
        border-bottom-left-radius: 10px;
      }

      .#{$modal}-footer-cancel {
        font-family: PingFangSC-Regular;
        font-size: 16px;
        padding: 8px 0;
        border-right: 1px solid #e8e8e8;
        color: $color-brand-normal;
        background: none;
        letter-spacing: 0;
        text-align: center;
        line-height: 16px;
      }
    }
  }

  &-fade-enter {
    opacity: 0;
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
    animation-play-state: paused;
  }

  &-fade-enter-active {
    animation-name: modalFadeIn;
    animation-play-state: running;
  }

  &-fade-exit {
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
    animation-play-state: paused;
  }

  &-fade-exit-active {
    animation-name: modalFadeOut;
    animation-play-state: running;
  }
}

@keyframes modalFadeIn {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes modalFadeOut {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes modalZoomIn {
  0% {
    opacity: 0;
    transform: scale(0, 0);
  }

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

@keyframes modalZoomOut {
  0% {
    transform: scale(1, 1);
  }

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