$colorWhite: #ffffff;

$colorGray3: #e0e0e0;
$colorGray4: #bdbdbd;
$colorGray5: #9e9e9e;
$colorGray6: #757575;
$colorGray7: #616161;

$colorGray9: #212121;

$i: 4px;

$indentXS: $i * 1;
$indentS: $i * 2;
$indentM: $i * 4;
$indentL: $i * 8;
$indentXL: $i * 16;

$modalHeaderCloseIconSize: $i * 6;

.modal {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: $indentL;
  min-height: 100%;
  pointer-events: none;
  perspective: 600px;
}

.modalHasHeader {
}

.modalHasFooter {
}

.modalSizeXs .container {
  width: 340px;
}

.modalSizeS .container {
  width: 480px;
}

.modalSizeM .container {
  width: 600px;
}

.modalSizeL .container {
  width: 900px;
}

.modalSizeXl .container {
  width: 1200px;
}

.container {
  max-width: 100%;
  pointer-events: auto;
  background: $colorWhite;
  box-shadow: 0 0 $indentM $colorGray6;
  border-radius: $i;
  border: 1px solid $colorGray4;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid $colorGray3;
  padding: $indentM;
  font-weight: bold;
  text-transform: uppercase;
}

.closeIconContainer {
  line-height: 0;
  cursor: pointer;
}

svg.closeIcon {
  fill: $colorGray5;
}

svg.closeIcon:hover {
  fill: $colorGray7;
}

svg.closeIcon:active {
  fill: $colorGray9;
}
.headerContent {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.headerContentHasText {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.body {
  padding: 24px;
  overflow: auto;
}

.noPadding {
  padding: 0;
}

.footer {
  border-top: 1px solid $colorGray3;
  padding: $indentM;
}

@mixin animation($name, $timing: ease-out, $duration: 0.3s, $delay: 0s,$fill-mode: forwards) {
  animation-name: $name;
  animation-timing-function: $timing;
  animation-duration: $duration;
  animation-delay: $delay;
  animation-fill-mode: $fill-mode;
}

/*
 ----------------------------
 # FlipTop animation effect
 ----------------------------
 */
.animationFlipTopOpen {
  @include animation(flipInTop, ease-in);
}
.animationFlipTopClose {
  @include animation(flipOutTop, ease-in);
}

@mixin flipOpen() {
  transform-style: preserve-3d;
  transform: rotateX(-70deg);
}
@mixin flipClose() {
  transform: rotateY(0deg);
  opacity: 1;
}

@keyframes flipInTop {
  from {
    @include flipOpen();
    opacity: 0;
  }
  to {
    @include flipClose();
  }
}
@keyframes flipOutTop {
  from {
    @include flipClose();
  }
  to {
    @include flipOpen();
    opacity: 0;
  }
}

/*
 ----------------------------
 # Slit animation effect
 ----------------------------
 */
.animationSlitOpen {
  opacity: 0;
  transform-style: preserve-3d;
  @include animation(slitIn, ease-in);
}
.animationSlitClose {
  opacity: 0;
  transform-style: preserve-3d;
  @include animation(slitOut, ease-out);
}

@mixin slitIn-a() {
  transform: translateZ(-3000px) rotateY(90deg);
}
@mixin slitIn-b() {
  transform: translateZ(-250px) rotateY(89deg);
  opacity: 1;
  animation-timing-function: ease-out;
}
@mixin slitIn-c() {
  transform: translateZ(0) rotateY(0deg);
  opacity: 1;
}

@keyframes slitIn {
  0% {
    @include slitIn-a();
  }
  50% {
    @include slitIn-b();
  }
  100% {
    @include slitIn-c();
  }
}
@keyframes slitOut {
  0% {
    @include slitIn-c();
  }
  50% {
    @include slitIn-b();
  }
  100% {
    @include slitIn-a();
  }
}

/*
 ----------------------------
 # Default animation effect
 ----------------------------
 */
.animationOpen {
  opacity: 0;
  @include animation(showModal, ease-in, 0.25s);
}
.animationClose {
  opacity: 0;
  @include animation(hideModal, ease-out, 0.15s);
}

@keyframes showModal {
  0% {
    transform: translateY(10%);
  }
  100% {
    transform: translateY(0%);
    opacity: 1;
  }
}
@keyframes hideModal {
  0% {
    transform: translateY(0%);
    opacity: 1;
  }
  100% {
    transform: translateY(10%);
  }
}
