$slider-width: 600px;

.nucleus-modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: map-get($nucleus-zindex, modal);
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
  display: flex;

  @extend %font-antialias;

  &--center {
    align-items: center;
    justify-content: center;
  }

  &--right {
    align-items: flex-end;
    flex-direction: column;
    justify-content: flex-start;
  }

  &--left {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
  }

  &__dialog {
    position: relative;
    max-height: 70vh;
    width: 512px;
    background: $color-milk;
    border-radius: $radius;
    display: flex;
    flex-direction: column;

    &--large {
      width: 800px;
    }

    &--small {
      width: 424px;
    }

    &--slider {
      width: $slider-width;
      height: 100vh;
      max-height: 100vh;
      border-radius: 0;
    }
  }

  &__header {
    padding: 32px 32px 0;
    position: relative;
    background: $color-milk;
    border-radius: $radius $radius 0 0;
    transition: all .1s linear;
    display: flex;
    justify-content: space-between;
    flex: none;

    &.sticky {
      position: sticky;
      top: 0;
      z-index: map-get($nucleus-zindex, nine);
      padding: 16px 32px;
      box-shadow: 0 2px 4px 0 rgba(18, 52, 77, .08);
    }

    .header-icon {
      margin-right: 8px;
    }

    .header-content {
      flex-grow: 2;

      .title {
        font-size: $font-size-18;
        font-weight: $font-weight-600;
        margin: 0;
        line-height: 1.1;
      }

      .description {
        font-size: $font-size-12;
        color: $text-secondary;
      }
    }
  }

  &__body {
    padding: 16px 32px;
    font-size: $font-size-14;
    position: relative;
    flex: 1 1 auto;
    overflow-y: auto;
  }

  &__footer {
    padding: 12px 16px 12px 32px;
    background-color: $color-smoke-25;
    border-radius: 0 0 $radius $radius;
    display: flex;
    justify-content: flex-end;
    flex: none;

    &.sticky {
      position: sticky;
      bottom: 0;
    }

    button:not(:last-child) {
      margin-right: 8px;
    }
  }

  &__close {
    position: absolute;
    top: 8px; // to offset the parent padding as per the design
    right: 8px;
    transition: all .3s;

    &.right {
      top: 0;
      right: $slider-width;
      border-radius: 0 0 0 2px;
    }
  }

  &__backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: map-get($nucleus-zindex, minusone);  // CSS trick used in bootstrap backdrop
    background-color: rgba($color-elephant-900, .5);
  }

  &--open {
    overflow: hidden;
  }

  @media screen and (min-width: $mobile-screen-min-width) and (max-width: $mobile-screen-max-width) {
    .nucleus-modal__dialog {
      max-height: 100vh;
      width: 100%;
    }

    &__close {
      &.right {
        right: 0;
      }
    }
  }
}
