.funkwhale.modal {
  background: var(--background-color);

  box-shadow: 0 2px 4px 2px rgba(#000, 0.2);
  border-radius: 1rem;
  max-width: min(90vw, 55rem);
  width: 100%;

  display: grid;
  max-height: 90vh;
  grid-template-rows: auto 1fr auto;

  position: relative;

  &.is-destructive {
    border-top: 24px solid var(--fw-red-400);

    > h2 {
      &.destructive-header {
        color: var(--fw-red-400);
      }
    }
  }

  > h2 {
    font-size: 1.25em;
    padding: 1.625rem 4.5rem;
    line-height: 1.2;
    text-align: center;
    position: relative;

    > .funkwhale.button {
      font-size: 1rem;
      position: absolute;
      right: 1rem;
      top: 50%;
      transform: translateY(-49%);
    }
  }

  .modal-content {
    padding: 1rem 2rem 3rem 2rem;
    overflow: auto;
    position: relative;

    > .alert-container {
      position: sticky;
      top: -1rem;
      margin: -1rem -2rem 1rem;

      display: grid;
      grid-template-rows: 1fr;

      &.v-enter-active,
      &.v-leave-active {
        transition: grid-template-rows 0.2s ease;
      }

      &.v-enter-from,
      &.v-leave-to {
        grid-template-rows: 0fr;
      }

      > div {
        overflow: hidden;
      }
    }
  }

  .modal-shadow-top {
    z-index: 2;
    height: 16px;
    width: 100%;
    position: absolute;
    top: 60px;
    background:linear-gradient(var(--background-color), color-mix(in oklab, var(--background-color) 50%, transparent), color-mix(in oklab, var(--background-color) 20%, transparent), transparent);
  }

  .modal-shadow-bottom {
    height: 32px;
    margin-top: -32px;
    position: sticky;
    bottom: 0px;
    background:linear-gradient(transparent, color-mix(in oklab, var(--background-color) 20%, transparent), color-mix(in oklab, var(--background-color) 50%, transparent), var(--background-color));
    &:last-child{
      border-bottom-right-radius: 1rem;
      border-bottom-left-radius: 1rem;
    }
  }

  .modal-actions {
    padding: 0 2rem 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    > :first-child {
      margin-left: 0px !important;
    }

    > :last-child {
      margin-right: 0px !important;
    }

    position: relative;
  }
}

.funkwhale.overlay:has(.over-popover) {
  // override z-index
  z-index: 999999;
}

.funkwhale.overlay {
  background: rgba(#000, .2);

  position: fixed;
  inset: 0;

  z-index: 9001;

  display: flex;
  align-items: center;
  justify-content: center;

  &.v-enter-active,
  &.v-leave-active {
    transition: opacity 0.2s ease;

    .funkwhale.modal {
      transition: transform 0.2s ease;
    }
  }

  &.v-enter-from,
  &.v-leave-to {
    opacity: 0;

    .funkwhale.modal {
      transform: translateY(1rem);
    }
  }

  &.v-leave-to {
    .funkwhale.modal {
      transform: translateY(-1rem);
    }
  }
}
