@use '../../sass/abstracts/variables' as *;
@use '../../sass/abstracts/typography' as *;
@use '../../sass/abstracts/mixins';

#{$component-prefix}modal {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;

  @include mixins.media-breakpoint-down(sm) {
    align-items: flex-end;
  }

  &.is-open {
    display: flex !important;
  }

  &:not(.is-open) {
    animation: slide-out 0.3s ease forwards;
  }

  &__dialog {
    background: $white;
    padding: 2.25rem 1.5rem 2.5rem 1.5rem;
    margin: 0 2rem;
    width: 35rem;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    animation: slide-in 0.3s ease forwards;

    @include mixins.media-breakpoint-down(sm) {
      margin: 0;
      border-radius: 12px 12px 0 0;
    }

    &--lg {
      width: 47rem;
    }

    &--xl {
      width: 82rem;
    }
  }

  &__header {
    @include headline-medium;
    margin-bottom: 1rem;
  }

  &__body {
    @include body-large;
    position: relative;
  }

  &__title {
    @include headline-medium;
    display: inline-block;
    margin-bottom: 0;
  }

  &__close {
    float: right;
    cursor: pointer;
  }

  &__footer {
    border-top: 1px solid $sodra-black-10;
    padding-top: 1.5rem;
  }

  @keyframes slide-in {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  @keyframes slide-out {
    from {
      display: flex;
      background-color: transparent;
      transform: translateY(0);
    }
    to {
      background-color: transparent;
      transform: translateY(100%);
    }
  }
}
