@use "design-system";

.actionable-message {
  color: var(--color-text-default);
  background-color: var(--color-background-default);
  border: 1px solid var(--color-info-default);
  border-radius: 8px;
  padding: 16px;
  margin-top: 18px;
  display: flex;
  flex-flow: column;
  align-items: center;
  position: relative;

  /**
  * Need the z-index and pseudo element for the time being while we update our muted colors to not use alpha levels
  * Otherwise ActionableMessages on top of content will transparent and it may effect
  * readability.
  */

  * {
    z-index: 1;
  }

  &::before {
    content: '';
    position: absolute;
    border-radius: 8px;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: var(--color-info-muted);
  }


  &--with-icon {
    padding-inline-start: 32px;
  }

  &--with-icon.actionable-message--warning {
    justify-content: normal;
  }

  &--with-icon.actionable-message--with-right-button {
    padding-left: 32px;
  }

  svg {
    width: 16px;
    height: 16px;
    position: absolute;
    left: 8px;
  }

  @include design-system.H7;

  &__message {
    color: var(--color-text-default);
    text-align: center;
    width: 100%;
  }

  &__actions {
    display: flex;
    width: 80%;
    justify-content: flex-end;
    align-items: center;
    margin-top: 10px;
    color: var(--color-primary-default);

    &--single {
      width: 100%;
    }
  }

  &__action {
    font-weight: bold;

    &--rounded {
      border-radius: 8px;
    }
  }

  &__action-v2 {
    color: var(--color-primary-default);
    background: none;
    border: none;
    font-size: 12px;
    align-self: baseline;
    padding: 0;
    margin-top: 12px;
  }

  &__info-tooltip-wrapper {
    position: absolute;
    right: 4px;
    top: 8px;
  }

  &--warning {
    border: 1px solid var(--color-warning-default);
    justify-content: center;

    &::before {
      background: var(--color-warning-muted);
    }

    .actionable-message__action--secondary {
      text-decoration: underline;
    }

    .actionable-message__actions button {
      background: var(--color-warning-default);
      color: var(--color-warning-inverse);
    }
  }

  &--danger {
    border: 1px solid var(--color-error-default);
    justify-content: flex-start;

    &::before {
      background: var(--color-error-muted);
    }

    .actionable-message__message {
      text-align: left;
    }

    .actionable-message__actions button {
      background: var(--color-error-default);
      color: var(--color-error-inverse);
    }
  }

  &--success {
    border: 1px solid var(--color-success-default);

    &::before {
      background: var(--color-success-muted);
    }

    .actionable-message__actions button {
      background: var(--color-success-default);
      color: var(--color-success-inverse);
    }
  }

  &--left-aligned {
    .actionable-message__message,
    .actionable-message__actions {
      text-align: left;
    }
  }

  &--with-right-button {
    padding: 12px;

    .actionable-message__message {
      justify-content: flex-start;
      text-align: left;
      width: 100%;
    }

    .actionable-message__actions {
      justify-content: flex-end;
      width: 100%;
    }

    .actionable-message__action {
      font-weight: normal;
      border-radius: 42px;
      min-width: 72px;
      height: 18px;
      display: flex;
      justify-content: center;
      align-items: center;

      @include design-system.H8;
    }
  }
}

.actionable-message--warning.actionable-message--with-right-button {
  .actionable-message__action {
    &::before {
      background: var(--color-warning-muted);
    }
  }
}
