@import (less) "../Theme/constants.css";

.portal > * {
  // When the modal is closed, overlay div has no css class
  // This selector should be overridden by the `&--after-open` class below
  opacity: 0;
}

.modalBody {
  /*! Just a placeholder no namespace this element using css modules*/
}

@value modal_animation_duration: 200ms;

.overlay {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  background-color: rgba(0, 0, 0, 0.6);
  transition: opacity modal_animation_duration, z-index 0s modal_animation_duration;

  &--after-open {
    opacity: 1;
  }
  &--before-close {
    opacity: 0;
  }
}

.inner {
  /* Relative positioning so overflow affects absolute children */
  position: relative;
  overflow: auto;
  margin: auto;

  width: 94vw;
  max-width: 32rem;
  height: 600px;
  text-align: center;
  max-height: ~"calc(100% + 4px)";
  border-radius: 8px;

  font-family: "Open Sans", sans-serif !important;
  background-color: #f3f3f4;

  color: #585E5F;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;

  @media (--small-viewport) {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 0px;
  }

  &, *, *:before, *:after {
    box-sizing: border-box;
  }

  .portal & {
    margin: auto;
    z-index: -1;
    opacity: 0;
    transform: scale(0);
    transition: opacity modal_animation_duration, transform modal_animation_duration, z-index 0s modal_animation_duration;
  }

  .overlay--after-open & {
    z-index: 100;
    opacity: 1;
    transform: scale(1);
    transition: opacity modal_animation_duration, transform modal_animation_duration;
  }
}

.closeButton {
  background-color: transparent;
  background-image: url('assets/cross.svg');
  border-radius: 16px;
  border: none;
  cursor: pointer;
  font-family: 'Open Sans', sans-serif;
  height: 32px;
  outline: none;
  position: absolute;
  right: 15px;
  text-decoration: none;
  top: 15px;
  width: 32px;
  z-index: 4;

  @media (--small-viewport) {
    top: 10px;
    right: 8px;
  }
}

.closeButtonLabel {
  display: none;
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 500;
  font-size: 14px;
  margin-right: 8px;
}

.closeButtonFullScreen {
  background-image: url('assets/cross-white.svg');
  
  .closeButtonLabel {
    color: #fff;
  }
}

@media (--large) {
  .closeButton:hover {
    background-color: #D8DADC;

    .closeButtonLabel {
      display: block;
    }
  }

  .closeButtonFullScreen:hover {
    background-color: transparent;
  }
}
