@dialog-prefix-cls: ~'@{wd-prefix}-modal';
@table-prefix-cls: ~'@{wd-prefix}-table';

.@{dialog-prefix-cls} {
  .@{table-prefix-cls} {
    background-color: @modal-content-bg;

    &-body {
      .@{table-prefix-cls}-cell {
        background-color: @modal-content-bg;
      }
    }
  }
  .reset-component();
  .modal-mask();

  position: relative;
  top: 10%;
  width: auto;
  max-width: 1200px;
  margin: 0 auto;

  &-wrap {
    z-index: @zindex-modal;
  }

  &-title {
    margin: 0;
    color: @modal-heading-color;
    font-weight: @modal-title-font-weight;
    font-size: @modal-header-title-font-size;
    line-height: @modal-header-title-line-height;
    word-wrap: break-word;
  }

  &-content {
    position: relative;
    background-color: @modal-content-bg;
    background-clip: padding-box;
    border: 0;
    border-radius: @border-radius-big;
    box-shadow: @shadow-300-modal;
    pointer-events: auto;
    overflow: hidden;
  }

  &-close {
    position: absolute;
    top: @modal-close-position;
    right: @modal-close-position;
    z-index: @zindex-popup-close;
    padding: 0;
    color: @modal-close-color;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    background: transparent;
    border: 0;
    outline: 0;
    cursor: pointer;
    transition: color 0.3s;
    border-radius: @modal-close-radius;

    &-x {
      display: flex;
      align-items: center;
      justify-content: center;
      width: @modal-header-close-size;
      height: @modal-header-close-size;
      font-size: @modal-header-close-font-size;
      font-style: normal;
      line-height: @modal-header-close-size;
      text-align: center;
      text-transform: none;
      text-rendering: auto;
    }

    &:focus,
    &:hover {
      color: @modal-close-hover-color;
      background-color: @modal-close-hover-bg;
      text-decoration: none;
    }
    &:active {
      color: @modal-close-hover-color;
      background-color: @modal-close-active-bg;
      text-decoration: none;
    }
  }

  &-header {
    padding: @modal-header-padding;
    color: @text-primary;
    background: @modal-header-bg;
    // border-bottom: @modal-header-border-width @modal-header-border-style
    //   @modal-header-border-color-split;
    border-radius: @border-radius-base @border-radius-base 0 0;
  }

  &-body {
    padding: @modal-body-padding;
    font-size: @font-size-base;
    line-height: @line-height-normal;
    word-wrap: break-word;
  }

  &-footer {
    padding: @modal-footer-padding-vertical @modal-footer-padding-horizontal;
    text-align: right;
    background: @modal-footer-bg;

    // border-top: @modal-footer-border-width @modal-footer-border-style
    //   @modal-footer-border-color-split;
    border-radius: 0 0 @border-radius-base @border-radius-base;

    .@{wd-prefix}-btn + .@{wd-prefix}-btn:not(.@{wd-prefix}-dropdown-trigger) {
      margin-bottom: 0;
      margin-left: 8px;
    }
  }

  &-open {
    overflow: hidden;
  }

  // 弹窗内侧边栏
  &-sidebar {
    max-width: @modal-side-max-width;
    padding: @modal-side-padding;

    &-exist {
      display: flex;
      max-height: 80vh;
    }
    &-right {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
    }
  }
}

.@{dialog-prefix-cls}-centered {
  text-align: center;

  &::before {
    display: inline-block;
    width: 0;
    height: 100%;
    vertical-align: middle;
    content: '';
  }
  .@{dialog-prefix-cls} {
    top: 0;
    display: inline-block;
    padding-bottom: 0;
    text-align: left;
    vertical-align: middle;
  }
}

@media (max-width: @screen-sm-max) {
  .@{dialog-prefix-cls} {
    max-width: calc(100vw - 16px);
    margin: 8px auto;
  }
  .@{dialog-prefix-cls}-centered {
    .@{dialog-prefix-cls} {
      flex: 1;
    }
  }
}
