@use '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-notification-notificationCard';
@use '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-element';

.notificationCardFunction {
  @include styles-tokens-notification-notificationCard.composite-var(styles-tokens-notification-notificationCard.$notification-card-function-badge);

  pointer-events: none;

  position: absolute;
  top: 0;
  right: 0;

  display: flex;

  opacity: 0;
}

.notificationCardTitleText {
  box-sizing: border-box;
  color: styles-tokens-notification-notificationCard.$sys-neutral-text-main;
}

.notificationCardTitleIcon {
  @include styles-tokens-notification-notificationCard.composite-var(styles-tokens-notification-notificationCard.$notification-card-icon-type);

  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.statusIndicator {
  position: absolute;
  top: 4px;
  right: 4px;
}

.notificationCard {
  @include styles-tokens-notification-notificationCard.composite-var(styles-tokens-notification-notificationCard.$notification-card-container);

  position: relative;

  display: flex;
  flex-direction: column;

  box-sizing: border-box;
  max-width: 100%;

  border-color: styles-tokens-notification-notificationCard.$sys-neutral-decor-default;
  border-style: solid;

  &::before {
    pointer-events: none;
    content: '';

    position: absolute;
    top: 0;
    left: 0;

    box-sizing: border-box;
    width: 100%;
    height: calc(100% + styles-tokens-notification-notificationCard.$border-width-notification-panel-card);

    opacity: 0;
    background-color: styles-tokens-notification-notificationCard.$sys-neutral-accent-default;
  }

  &:focus-visible {
    @include styles-tokens-notification-notificationCard.outline-var(styles-tokens-element.$container-focused-s);

    border-color: transparent;
    outline-color: styles-tokens-notification-notificationCard.$sys-available-complementary;
  }

  &[data-droplist-open], &:hover, &:focus-visible, &:focus-within:not(:focus) {
    &::before {
      opacity: styles-tokens-notification-notificationCard.$opacity-a004;
    }

    .notificationCardFunction {
      pointer-events: auto;
      opacity: 1;
    }
  }

  &[data-clickable] {
    cursor: pointer;
  }

  &[data-unread] {
    &::before {
      opacity: styles-tokens-notification-notificationCard.$opacity-a008;
    }

    &[data-droplist-open], &:hover, &:focus-visible, &:focus-within:not(:focus) {
      &::before {
        opacity: styles-tokens-notification-notificationCard.$opacity-a004;
      }
    }
  }

  &[data-appearance='neutral'] {
    &::before {
      background-color: styles-tokens-notification-notificationCard.$sys-neutral-accent-default;
    }

    .notificationCardTitleIcon {
      color: styles-tokens-notification-notificationCard.$sys-neutral-accent-default;
    }
  }

  &[data-appearance='error'],
  &[data-appearance='errorCritical'] {
    &::before {
      background-color: styles-tokens-notification-notificationCard.$sys-red-accent-default;
    }

    .notificationCardTitleIcon {
      color: styles-tokens-notification-notificationCard.$sys-red-accent-default;
    }
  }

  &[data-appearance='errorCritical'] {
    .notificationCardTitleText {
      color: styles-tokens-notification-notificationCard.$sys-red-accent-default;
    }
  }

  &[data-appearance='warning'] {
    &::before {
      background-color: styles-tokens-notification-notificationCard.$sys-yellow-accent-default;
    }

    .notificationCardTitleIcon {
      color: styles-tokens-notification-notificationCard.$sys-yellow-accent-default;
    }
  }

  &[data-appearance='success'] {
    &::before {
      background-color: styles-tokens-notification-notificationCard.$sys-green-accent-default;
    }

    .notificationCardTitleIcon {
      color: styles-tokens-notification-notificationCard.$sys-green-accent-default;
    }
  }

  &[data-skeleton] {
    &::before {
      display: none;
    }
  }
}

.notificationCardLabel {
  display: grid;
  color: styles-tokens-notification-notificationCard.$sys-neutral-text-support;
}

.notificationCardTitle {
  @include styles-tokens-notification-notificationCard.composite-var(styles-tokens-notification-notificationCard.$notification-card-title-layout);

  display: flex;

  &[data-center] {
    align-items: center;
  }
}

.notificationCardContent {
  box-sizing: border-box;
  color: styles-tokens-notification-notificationCard.$sys-neutral-text-support;
  white-space: pre-line;
}

.notificationCardFooter {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  box-sizing: border-box;
}

.notificationCardDate {
  flex: 1 0 auto;
  box-sizing: border-box;
  color: styles-tokens-notification-notificationCard.$sys-neutral-text-light;
  text-align: right;
}

.notificationCardButtons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
