@import '../style/functions.scss';
@import '../style/theme.scss';
@import '../style/mixins.scss';

$prefix-cls: 'dk-modal';

.#{$prefix-cls} {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: $zindex-modal;

  &-panel {
    @include reset-component();
    position: relative;
    max-width: 90%;
    width: 520px;
    margin: 150px auto 0;
    z-index: $zindex-modal;
    background-color: $modal-bg;
    box-shadow: $modal-box-shadow;
    transition: $modal-transition;

    &-enter {
      opacity: 0;
      transform: translate3d(0, $modal-transfrom-y, 0);
    }

    &-enter-active {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }

    &-exit {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }

    &-exit-active {
      opacity: 0;
      transform: translate3d(0, $modal-transfrom-y, 0);
    }
  }

  &-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: $zindex-modal;
    background-color: rgba(0, 0, 0, 0.35);
    transition: $modal-mask-transition;

    &-enter {
      opacity: 0;
    }

    &-enter-active {
      opacity: 1;
    }

    &-exit {
      opacity: 1;
    }

    &-exit-active {
      opacity: 0;
    }
  }

  &-header {
    padding: $modal-padding-y $modal-padding-x;
    border-bottom: 1px solid $border-color;
    color: $heading-color;
    font-size: $font-size-lg;
    font-weight: 500;
  }

  &-body {
    padding: $modal-padding-x;

    &-container {
      position: relative;
      padding-left: 38px;
    }

    &-title {
      color: $heading-color;
      font-size: $font-size-lg;
      font-weight: 500;
      line-height: 1.4;
    }

    &-content {
      margin-top: 8px;
    }

    &-btn {
      margin-top: $modal-padding-y;
      text-align: right;

      &-cancel {
        margin-right: 10px;
      }
    }

    &-icon {
      position: absolute;
      top: 0;
      left: 0;
      font-size: 22px;
      font-weight: 700;

      @each $type, $color in $modal-type-colors {
        &-#{$type} {
          color: theme-color-level($color, 2);
        }
      }
    }
  }

  &-footer {
    padding: $modal-padding-y $modal-padding-x;
    border-top: 1px solid $border-color;
    text-align: right;

    &-confirm {
      margin-inline-start: 10px;
    }
  }

  &-close {
    display: flex;
    position: absolute;
    top: 0;
    right: 0;
    width: 55px;
    height: 55px;
    cursor: pointer;
    transition: color 200ms ease;
    justify-content: center;
    align-items: center;

    &-icon {
      font-size: 16px;
    }

    &:hover {
      color: $gray-900;
    }
  }
}