@use "mixins/shadow";
@use "variables";

// Modals
.modal {
  align-items: center;
  bottom: 0;
  display: none;
  justify-content: center;
  left: 0;
  opacity: 0;
  overflow: hidden;
  padding: variables.$layout-spacing;
  position: fixed;
  right: 0;
  top: 0;

  &:target,
  &.active {
    display: flex;
    opacity: 1;
    z-index: variables.$zindex-4;

    .modal-overlay {
      background: rgba(variables.$bg-color, .75);
      bottom: 0;
      cursor: default;
      display: block;
      left: 0;
      position: absolute;
      right: 0;
      top: 0;
    }

    .modal-container {
      animation: slide-down .2s ease 1;
      z-index: variables.$zindex-0;
    }
  }

  &.modal-sm {
    .modal-container {
      max-width: variables.$control-width-sm;
      padding: 0 variables.$unit-2;
    }
  }

  &.modal-lg {
    .modal-overlay {
      background: variables.$bg-color-light;
    }

    .modal-container {
      box-shadow: none;
      max-width: variables.$control-width-lg;
    }
  }
}

.modal-container {
  @include shadow.shadow-variant(.2rem);
  background: variables.$bg-color-light;
  border-radius: variables.$border-radius;
  display: flex;
  flex-direction: column;
  max-height: 75vh;
  max-width: variables.$control-width-md;
  padding: 0 variables.$unit-4;
  width: 100%;

  &.modal-fullheight {
    max-height: 100vh;
  }

  .modal-header {
    color: variables.$dark-color;
    padding: variables.$unit-4;
  }

  .modal-body {
    overflow-y: auto;
    padding: variables.$unit-4;
    position: relative;
  }

  .modal-footer {
    padding: variables.$unit-4;
    text-align: right;
  }
}
