@use "sass:map";

$modalWidth: 500px;

@keyframes modalIn {
  0% {
    transform: translateX(40px);
    opacity: 0;
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.vuiModalContainer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: modalIn $transitionSpeed cubic-bezier(0, 1, 1, 1);
  pointer-events: none;
}

.vuiModal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: $modalWidth;
  max-height: calc(100vh - $sizeXl);
  background-color: $colorEmptyShade;
  border: 1px solid $borderColor;
  z-index: $modalZIndex;
  pointer-events: all;

  @media screen and (max-width: 1000px) {
    & {
      max-width: 100%;
    }
  }

  @media screen and (max-height: 600px) {
    & {
      max-height: 100%;
      height: 100%;
    }
  }
}

.vuiModalHeader {
  padding: $sizeS $sizeM;
  background-color: $colorLightShade;
}

.vuiModalHeader__title {
  font-size: $fontSizeMedium;
  font-weight: $fontWeightBold;
  line-height: 1.2;
  color: $colorText;
}

.vuiModalContent {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.vuiModalContent__inner {
  padding: $sizeL $sizeM $sizeXxl;
}

// Color
$color: (
  primary: (
    "color": $colorPrimary
  ),
  danger: (
    "color": $colorDanger
  )
);

@each $colorName, $colorValue in $color {
  .vuiModal--#{$colorName} {
    .vuiModalHeader {
      .vuiIcon {
        color: #{map.get($colorValue, "color")};
      }
    }
  }
}
