@import '../../globals/scss/vars';
@import '../../globals/scss/colors';
@import '../../globals/scss/mixins';
@import '../../globals/scss/typography';
@import '../../globals/scss/spacing';
@import '@carbon/import-once/scss/import-once';
@import '../../globals/scss/css--typography';

@function cssColor($color-variable) {
  @return var(--cds-inverse-support-02, #fa4d56);
}

.wfp--toast-notification {
  box-sizing: border-box;
  font-size: 100%;
  font-family: inherit;
  vertical-align: initial;
  border: 0;
  display: flex;
  width: 18rem;
  height: auto;
  margin: 0.5rem 1rem 0.5rem 0;
  padding: 0 0 0 0.875rem;
  color: var(--cds-inverse-01, var(--ui-01));
  box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);

  .#{$prefix}--toast-notification:first-child {
    margin-top: 1rem;
  }

  .#{$prefix}--toast-notification__close-button {
    outline: 2px solid transparent;
    outline-offset: -2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3rem;
    min-width: 3rem;
    height: 3rem;
    min-height: 3rem;
    margin-left: auto;
    padding: 0;
    background-color: initial;
    border: none;
    cursor: pointer;
    transition: outline 0.11s, background-color 0.11s;

    .#{$prefix}--toast-notification__close-icon {
      fill: var(--cds-inverse-01, var(--ui-01));
    }
  }

  .#{$prefix}--toast-notification__icon {
    flex-shrink: 0;
    margin-top: 0.875rem;
    margin-right: 0.875rem;
  }

  .#{$prefix}--toast-notification__details {
    margin-right: 1rem;
    color: var(--cds-inverse-01, var(--ui-01));
    .#{$prefix}--toast-notification__title {
      font-size: 0.875rem;
      line-height: 1.29;
      letter-spacing: 0.16px;
      margin-top: 1rem;
      font-weight: 600;
      word-break: break-word;
    }

    .#{$prefix}--toast-notification__subtitle {
      font-size: 0.875rem;
      font-weight: 400;
      line-height: 1.29;
      letter-spacing: 0.16px;
      margin-top: 0;
      margin-bottom: 1.5rem;

      word-break: break-word;
    }

    .#{$prefix}--toast-notification__caption {
      font-size: var(--cds-body-short-01-font-size, 0.875rem);
      font-weight: var(--cds-body-short-01-font-weight, 400);
      line-height: var(--cds-body-short-01-line-height, 1.29);
      letter-spacing: var(--cds-body-short-01-letter-spacing, 0.16px);
      margin-bottom: 1rem;
    }
  }
}

.#{$prefix}--toast-notification--info,
.#{$prefix}--toast-notification--info-square {
  background: #393939;
  border-left: 3px solid var(--interactive-01);
}
.#{$prefix}--toast-notification--low-contrast
  .#{$prefix}--toast-notification__close-button
  .#{$prefix}--toast-notification__close-icon {
  fill: #161616;
}

.#{$prefix}--toast-notification--info-square
  .#{$prefix}--toast-notification__icon,
.#{$prefix}--toast-notification--info {
  fill: var(--interactive-01);
}

.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--info
  .#{$prefix}--toast-notification__icon {
  fill: var(--interactive-01);
}

.#{$prefix}--toast-notification--warning-alt
  .#{$prefix}--toast-notification__icon,
.#{$prefix}--toast-notification--warning .#{$prefix}--inline-notification__icon,
.#{$prefix}--toast-notification--warning .#{$prefix}--toast-notification__icon {
  fill: var(--support-03);
}

.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning-alt
  .#{$prefix}--toast-notification__icon,
.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning
  .#{$prefix}--toast-notification__icon {
  fill: var(--support-03);
}

.#{$prefix}--toast-notification--success .#{$prefix}--inline-notification__icon,
.#{$prefix}--toast-notification--success .#{$prefix}--toast-notification__icon {
  fill: var(--support-02);
}

.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--success
  .#{$prefix}--inline-notification__icon,
.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--success
  .#{$prefix}--toast-notification__icon {
  fill: var(--support-02);
}

.#{$prefix}--toast-notification--error {
  background: var(--cds-inverse-02, #393939);
  // border-left: 3px solid var(--cds-inverse-support-01, #fa4d56);
  border-left: 3px solid var(--support-01);
  color: var(--support-01);

  .#{$prefix}--toast-notification__icon {
    fill: currentColor;
  }
}
.#{$prefix}--toast-notification--low-contrast {
  .#{$prefix}--toast-notification__details {
    color: #161616;
  }
}

.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--error {
  background: var(--support-light-01);
  border-left: 3px solid var(--support-01);
}

.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--info,
.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--info-square {
  background: var(--support-light-04);
  border-left: 3px solid var(--interactive-01);
}

.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--success {
  background: var(--support-light-02);
  border-left: 3px solid var(--support-02);
}

.#{$prefix}--toast-notification--success {
  background: var(--cds-inverse-02, #393939);
  border-left: 3px solid var(--support-02);
}

.#{$prefix}--toast-notification--warning,
.#{$prefix}--toast-notification--warning-alt {
  background: var(--cds-inverse-02, #393939);
  border-left: 3px solid var(--support-03);
}

.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning,
.#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning-alt {
  background: var(--support-light-03);
  border-left: 3px solid var(--support-03);
}
.#{$prefix}--toast-notification:first-child {
  margin-top: 1rem;
}
.#{$prefix}--toast-notification--warning,
.#{$prefix}--toast-notification--warning-alt {
  background: var(--cds-inverse-02, #393939);
  border-left: 3px solid var(--support-03);
}

.#{$prefix}--inline-notification {
  box-sizing: border-box;
  padding: 0;
  font-size: 100%;
  font-family: inherit;
  vertical-align: initial;
  border: 0;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  min-width: 18rem;
  max-width: 18rem;
  height: auto;
  min-height: 3rem;
  margin: 1rem 0;
  color: var(--cds-inverse-01, var(--ui-01));

  .#{$prefix}--inline-notification__details {
    display: flex;
    flex-grow: 1;
    margin: 0 3rem 0 1rem;

    .#{$prefix}--inline-notification__icon {
      flex-shrink: 0;
      margin-top: 0.875rem;
      margin-right: 1rem;
    }

    .#{$prefix}--inline-notification__text-wrapper {
      display: flex;
      flex-wrap: wrap;
      padding: 0.9375rem 0;

      .#{$prefix}--inline-notification__title {
        font-size: var(--cds-productive-heading-01-font-size, 0.875rem);
        font-weight: var(--cds-productive-heading-01-font-weight, 600);
        line-height: var(--cds-productive-heading-01-line-height, 1.29);
        letter-spacing: var(--cds-productive-heading-01-letter-spacing, 0.16px);
        margin: 0 0.25rem 0 0;
      }

      .#{$prefix}--inline-notification__subtitle {
        font-size: var(--cds-body-short-01-font-size, 0.875rem);
        font-weight: var(--cds-body-short-01-font-weight, 400);
        line-height: var(--cds-body-short-01-line-height, 1.29);
        letter-spacing: var(--cds-body-short-01-letter-spacing, 0.16px);
        word-break: break-word;
      }
    }
  }

  .#{$prefix}--inline-notification__action-button {
    height: 2rem;
    margin-bottom: 0.5rem;
    margin-left: 2.5rem;
    font-weight: 400;
    color: var(--cds-inverse-link, #78a9ff);

    .#{$prefix}--inline-notification__close-icon {
      fill: var(--cds-inverse-01, var(--ui-01));
    }
  }
}

.#{$prefix}--inline-notification--info,
.#{$prefix}--inline-notification--info-square {
  background: var(--cds-inverse-02, #393939);
  border-left: 3px solid var(--interactive-01);
}

.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--info,
.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--info-square {
  background: var(--support-light-04);
  border-left: 3px solid var(--interactive-01);
}
.#{$prefix}--inline-notification--info .#{$prefix}--inline-notification__icon {
  fill: var(--interactive-01);
}

.#{$prefix}--inline-notification--success,
.#{$prefix}--inline-notification--success-square {
  background: var(--cds-inverse-02, #393939);
  border-left: 3px solid var(--support-02);
}

.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--success,
.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--success-square {
  background: var(--support-light-02);
  border-left: 3px solid var(--support-02);
}

.#{$prefix}--inline-notification--success
  .#{$prefix}--inline-notification__icon {
  fill: var(--support-02);
}

.#{$prefix}--inline-notification--error,
.#{$prefix}--inline-notification--error-square {
  background: var(--cds-inverse-02, #393939);
  border-left: 3px solid var(--support-01);
}

.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--error,
.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--error-square {
  background: var(--support-light-01);
  border-left: 3px solid var(--support-01);
}

.#{$prefix}--inline-notification--error .#{$prefix}--inline-notification__icon {
  fill: var(--support-01);
}

.#{$prefix}--inline-notification--warning,
.#{$prefix}--inline-notification--warning-square {
  background: var(--cds-inverse-02, #393939);
  border-left: 3px solid var(--support-03);
}

.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--warning,
.#{$prefix}--inline-notification--low-contrast.#{$prefix}--inline-notification--warning-square {
  background: var(--support-light-03);
  border-left: 3px solid var(--support-03);
}

.#{$prefix}--inline-notification--warning
  .#{$prefix}--inline-notification__icon {
  fill: var(--support-03);
}

.#{$prefix}--inline-notification--low-contrast {
  color: #161616;
}

.#{$prefix}--inline-notification--low-contrast
  .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost {
  color: var(--cds-link-01, #0f62fe);
}
.#{$prefix}--inline-notification--low-contrast
  .#{$prefix}--inline-notification__action-button,
.#{$prefix}--inline-notification--low-contrast
  .#{$prefix}--inline-notification__action-button:active {
  color: var(--interactive-01);
}

.#{$prefix}--inline-notification__close-button {
  outline: 2px solid transparent;
  outline-offset: -2px;
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3rem;
  min-width: 3rem;
  max-width: 3rem;
  height: 3rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: outline 0.11s cubic-bezier(0.2, 0, 0.38, 0.9),
    background-color 0.11s cubic-bezier(0.2, 0, 0.38, 0.9);
}

.#{$prefix}--inline-notification__close-button
  .#{$prefix}--inline-notification__close-icon {
  fill: var(--cds-inverse-01, var(--ui-01));
}

.#{$prefix}--inline-notification--low-contrast
  .#{$prefix}--inline-notification__close-button
  .#{$prefix}--inline-notification__close-icon {
  fill: #161616;
}

.#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost:hover {
  background-color: transparent;
}

// @include exports('notification') {
//   .wfp--toast-notification {
//     box-sizing: border-box;
//     font-size: 100%;
//     font-family: inherit;
//     vertical-align: initial;
//     border: 0;
//     display: flex;
//     width: 18rem;
//     height: auto;
//     margin: 0.5rem 1rem 0.5rem 0;
//     padding: 0 0 0 0.875rem;
//     color: var(--cds-inverse-01, var(--ui-01));
//     box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);

//     .#{$prefix}--toast-notification--info,
//     .#{$prefix}--toast-notification--info-square {
//       background: var(--cds-inverse-02, #393939);
//       border-left: 3px solid var(--cds-inverse-support-04, #4589ff);
//     }

//     .#{$prefix}--toast-notification:first-child {
//       margin-top: 1rem;
//     }
//   }
// }

@media (min-width: 66rem) {
  .#{$prefix}--inline-notification {
    max-width: 46rem;
  }
}

@media (min-width: 42rem) {
  .#{$prefix}--inline-notification {
    flex-wrap: nowrap;
    max-width: 38rem;
  }

  .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost {
    margin: 0.5rem 0;
  }

  .#{$prefix}--inline-notification__close-button {
    position: static;
  }
}
