// Modals

// @import "./variables.scss";


.#{$namespace}modal-mask {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: $modal-mask-color;

  .#{$namespace}modal {
    font-size: $modal-font-size;
    animation: slide-down .2s ease 1;
    background-color:$modal-background;
    border-radius: $modal-border-radius;

    &.#{$namespace}modal-lg {
      width: $modal-width-lg;
    }
  
    &.#{$namespace}modal-md {
      width: $modal-width-md;
    }

    &.#{$namespace}modal-sm {
      width: $modal-width-sm;
    }

    &.#{$namespace}modal-xs {
      width: $modal-width-xs;
    }

    .#{$namespace}modal-header {
      display: flex;
      border-radius: $modal-border-radius $modal-border-radius 0 0;
      align-items: center;
      height: $modal-header-height;
      background: $modal-header-background;

      .#{$namespace}modal-title {
        flex: 1;
        font-size: $modal-title-font-size;
        margin-left: $modal-header-margin-left;
      }

      .#{$namespace}modal-close {
        flex-shrink: 0;
        flex-grow: 0;
        display: flex;
        align-items: center;       
        margin-right: $modal-close-svg-margin-right;
        cursor: pointer;

        svg {
          width: $modal-close-svg-width;
          height: $modal-close-svg-height;
          color: $modal-close-svg-color;
        }
      }
    }

    .#{$namespace}modal-body {
      padding: $modal-body-padding;
    }

    .#{$namespace}modal-footer {
      margin: $modal-footer-margin;
      padding: $modal-footer-padding;
      text-align: right;
      .#{$namespace}modal-footer-hasborder {
          // 由于历史原因，modal-footer使用了部分行内样式:有底部border时modal-footer的padding-bottom为12px，没有时为20px。为取消行内样式使这里自定义主题变量可以正常使用且不影响原先UI，暂时通过margin-top translate方式组合解决，后续css has属性兼容性较高后可通过has修改
        margin-top: $modal-footer-hasborder-margin-top;
        transform: translateY($modal-footer-hasborder-translate-y);
        ~ button {
          transform: translateY($modal-footer-hasborder-button-translate-y);
        }
        height: $modal-footer-hasborder-height;
        margin-bottom: $modal-footer-hasborder-margin-bottom;
        background:$modal-footer-hasborder-color;
      }
      .#{$namespace}btn {
        margin-left: $modal-footer-hasborder-margin-left;
      }
    }
  }
}
