@import '../button/button.scss';
@import '../overlay/overlay.scss';
@import '../../styles/mixins/index';

.nut-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: $dialog-width;
  max-height: 67%;
  min-height: $dialog-min-height;
  padding: $dialog-padding;
  box-sizing: border-box;

  &-overlay {
    --nutui-overlay-zIndex: 1200;
  }

  &-outer {
    position: fixed;
    max-height: 100%;
    overflow-y: auto;
    background-color: $white;
    transition:
      transform 0.2s,
      -webkit-transform 0.2s;
    -webkit-overflow-scrolling: touch;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    border-radius: $dialog-border-radius;
    z-index: $dialog-z-index;
    animation-duration: 0.3s;
  }

  &-header {
    display: block;
    text-align: center;
    font-size: $dialog-header-font-size;
    font-weight: $dialog-header-font-weight;
    color: $color-title;
    @include oneline-ellipsis();
  }

  &-content {
    width: 100%;
    margin: $dialog-content-margin;
    max-height: $dialog-content-max-height;
    line-height: $dialog-content-line-height;
    font-size: $font-size-base;
    color: $color-text;
    word-wrap: break-word;
    word-break: break-all;
    white-space: pre-wrap;
    text-align: $dialog-content-text-align;
  }

  &-footer {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-around;

    &.vertical {
      flex-direction: column;

      .nut-button {
        min-width: 100%;
        margin: 0;

        &.nut-dialog-footer-ok {
          order: 1;
        }

        &.nut-dialog-footer-cancel {
          border: 0;
          color: $color-text;
          order: 2;
          display: flex;
          align-items: flex-end;
          margin-top: $dialog-vertical-footer-ok-margin-top;
        }
      }
    }

    .nut-button {
      min-width: $dialog-footer-button-min-width;
    }

    &-cancel.nut-dialog-footer-cancel {
      margin-right: $dialog-footer-cancel-margin-right;
    }

    &-ok {
      max-width: $dialog-footer-ok-max-width;
    }
  }
}
