@use '../theme/modal.tokens' as modal;
@use '../theme/palette.tokens' as palette;
@use '../theme/shadows.tokens' as shadows;
@use '../theme/spacing.tokens' as spacing;
@use '../theme/transitions.tokens' as transitions;
@use '../theme/z-index.tokens' as z-index;

.pa-modal-backdrop {
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  opacity: 1;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: z-index.$z-index-modal-backdrop;

  &.out {
    opacity: 0;
    transition: opacity transitions.$transition-process-out;
  }
}

.pa-modal {
  align-items: stretch;
  border: 0;
  border-radius: modal.$border-radius-modal;
  display: flex;
  flex-flow: column nowrap;
  opacity: 0;
  padding: 0;
  position: relative;

  background-color: modal.$background-color-modal;
  box-shadow: shadows.$shadow-modal;
  margin: 0;
  transition: opacity transitions.$transition-response;

  z-index: z-index.$z-index-modal-backdrop + 10;

  &.in {
    opacity: 1;
  }

  &.out {
    opacity: 0;
  }

  &.off {
    display: none;
  }

  .pa-modal-description {
    color: palette.$color-neutral-regular;
    text-align: center;
  }

  .pa-modal-content {
    padding: 0 modal.$padding-modal;
    z-index: 0;
  }

  .pa-modal-header,
  pa-modal-footer,
  .pa-modal-footer {
    z-index: 2;
  }

  pa-modal-footer,
  .pa-modal-footer {
    align-items: center;
    display: flex;
    gap: spacing.rhythm(2);
    height: modal.$height-header-footer-modal;
    justify-content: center;
  }

  .scrolling-content {
    border-top: 1px solid palette.$color-neutral-lighter;
  }

  @media (max-width: spacing.$size-viewport-medium-max) {
    &.pa-modal-fullscreen-on-small {
      height: 100%;
      width: 100%;
    }
  }
}

@media (min-width: spacing.$size-viewport-medium-min) {
  .pa-modal {
    max-height: 90vh;

    &.pa-take-available-height {
      height: 80vh;
    }
  }
}
