@import '../../styles/common/colors';
@import '../../styles/common/_config';
@import '../../styles/common/functions';
@import '../../styles/common/screen';

.modal-component {
  position: fixed;
  z-index: z('modal');

  &.modal-open {
    height: 100%;
    left: 0;
    overflow: auto;
    top: 0;
    width: 100%;

    .modal-content {
      opacity: 1;
      visibility: visible;
      transform: scale(1);
      z-index: z('modal');
    }
  }

  .modal-scroll-container {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    padding: 80px 0;
    justify-content: center;
    width: 100%;
  }

  .modal-content {
    background: $white;
    border-radius: 3px;
    box-shadow: 0 8px 24px 0 rgba($primary-3, 0.5);
    display: flex;
    flex-direction: column;
    opacity: 0;
    max-width: 708px;
    position: relative;
    padding: 24px;
    transform: scale(0.7);
    transition: scale 0.3s, opacity 0.3s, transform 0.3s, width 0.3s, max-width 0.3s;
    visibility: hidden;
    width: 75%;
    will-change: scale, opacity, transform;
    z-index: z('below');

    .modal-header {
      .modal-close {
        position: absolute;
        right: 24px;

        > svg {
          cursor: pointer;
        }
      }

      h1 {
        margin: 0 0 16px;
      }
    }

    .modal-body {
      font-size: 14px;
      color: $navy-text;
      margin: 0 -16px;
      padding: 0 16px;

      p:last-child {
        margin-bottom: 0;
      }
    }

    .modal-footer {
      display: block; // because CSS modules won't render the style w/o a defined selector
    }

    .modal-actions {
      margin-top: 24px;
      float: right;

      button {
        margin-right: 0;
        margin-left: 12px;
      }
    }

    @media (max-width: 600px) {
      bottom: 0;
      box-sizing: border-box;
      overflow: auto;
      position: fixed;
      left: 0;
      right: 0;
      top: 0;
      width: 100%;
    }

    &.modal-sm {
      max-width: 320px;

      @media (max-width: 600px) {
        max-width: 100%;
      }
    }

    &.modal-md {
      max-width: 588px;

      @media (max-width: 600px) {
        max-width: 100%;
      }
    }

    &.modal-lg {
      max-width: 1200px;

      @media (max-width: 600px) {
        max-width: 100%;
      }
    }
  }
}
