$dialog-padding: $baseline-grid * 3;

.md-dialog-is-showing {
  max-height: 100%;
}
.md-dialog-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: $z-index-dialog;
  overflow: hidden;
}

md-dialog {

  &.md-transition-in {
    opacity: 1;
    transition: $swift-ease-out;
    transform: translate3d(0,0,0) scale(1.0);
  }
  &.md-transition-out {
    opacity: 0;
    transition: $swift-ease-out;
    transform: translate3d(0,100%,0) scale(0.2);
  }

  opacity: 0;
  min-width: 240px;
  max-width: 80%;
  max-height: 80%;
  position: relative;
  overflow: auto; // stop content from leaking out of dialog parent and fix IE

  box-shadow: $whiteframe-shadow-13dp;

  display: flex;
  flex-direction: column;

  &> form {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }
  md-dialog-content {
    order: 1;
    flex-direction: column;
    padding: $dialog-padding;
    overflow: auto;
    -webkit-overflow-scrolling: touch;

    &:not([layout=row]) > *:first-child:not(.md-subheader) {
      margin-top: 0;
    }

    &:focus {
      outline: none;
    }

    .md-subheader {
      margin: 0;

      &.sticky-clone {
        box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.16);
      }
    }
    &.sticky-container {
      padding: 0;

      &> div {
        padding: $dialog-padding;
        padding-top: 0;
      }
    }

    .md-dialog-content-body {
      width:100%;
    }
  }

  .md-actions {
    display: flex;
    order: 2;
    box-sizing: border-box;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 0;
    padding-right: $baseline-grid;
    padding-left: $baseline-grid * 2;
    min-height: $baseline-grid * 6.5;
    overflow: hidden;

    .md-button {
      margin-bottom: $baseline-grid;
      margin-left: $baseline-grid;
      margin-right: 0;
      margin-top: $baseline-grid;
    }
  }
  &.md-content-overflow .md-actions {
    border-top-width: 1px;
    border-top-style: solid;
  }

}

@media screen and (-ms-high-contrast: active) {
  md-dialog {
    border: 1px solid #fff;
  }
}
