/**
 *
 * @ai-apps/angular v2.154.0-next.30 | _toast-notification.scss
 *
 * Copyright 2014, 2024 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

//-----------------------------
// Notifications
//-----------------------------

@import '../../globals/scss/vars';
@import '../../globals/scss/layout';
@import '../../globals/scss/component-tokens';
@import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
@import '../../globals/scss/helper-mixins';
@import '../../globals/scss/css--reset';
@import 'mixins';
@import 'tokens';

/// Toast notification styles
/// @access private
/// @group notification
@mixin toast-notifications {
  .#{$prefix}--toast-notification {
    @include reset;

    display: flex;
    width: rem(288px);
    height: auto;
    padding-left: $carbon--spacing-05;
    @if not feature-flag-enabled('enable-v11-release') {
      margin-top: $carbon--spacing-03;
      margin-right: $carbon--spacing-05;
      margin-bottom: $carbon--spacing-03;
    }

    box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2);
    color: $inverse-01;

    @if not feature-flag-enabled('enable-v11-release') {
      &:first-child {
        margin-top: $carbon--spacing-05;
      }
    }

    @include carbon--breakpoint(max) {
      width: rem(352px);
    }
  }

  .#{$prefix}--toast-notification:not(.#{$prefix}--toast-notification--low-contrast)
    a {
    color: $inverse-link;
  }

  .#{$prefix}--toast-notification a {
    text-decoration: none;
  }

  .#{$prefix}--toast-notification a:hover {
    text-decoration: underline;
  }

  .#{$prefix}--toast-notification a:focus {
    outline: 1px solid $inverse-link;
  }

  .#{$prefix}--toast-notification.#{$prefix}--toast-notification--low-contrast
    a:focus {
    @include focus-outline;
  }

  .#{$prefix}--toast-notification--low-contrast {
    color: $text-01;
  }

  .#{$prefix}--toast-notification--error {
    @include notification--experimental($inverse-support-01, $inverse-02);
  }

  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--error {
    @include notification--experimental(
      $support-01,
      get-token-value($notification-colors, 'notification-background-error')
    );
  }

  .#{$prefix}--toast-notification--success {
    @include notification--experimental($inverse-support-02, $inverse-02);
  }

  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--success {
    @include notification--experimental(
      $support-02,
      get-token-value($notification-colors, 'notification-background-success')
    );
  }

  .#{$prefix}--toast-notification--info,
  .#{$prefix}--toast-notification--info-square {
    @include notification--experimental($inverse-support-04, $inverse-02);
  }

  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--info,
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--info-square {
    @include notification--experimental(
      $support-04,
      get-token-value($notification-colors, 'notification-background-info')
    );
  }

  .#{$prefix}--toast-notification--warning,
  .#{$prefix}--toast-notification--warning-alt {
    @include notification--experimental($inverse-support-03, $inverse-02);
  }

  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning,
  .#{$prefix}--toast-notification--low-contrast.#{$prefix}--toast-notification--warning-alt {
    @include notification--experimental(
      $support-03,
      get-token-value($notification-colors, 'notification-background-warning')
    );
  }

  .#{$prefix}--toast-notification--warning
    .#{$prefix}--toast-notification__icon
    path[opacity='0'] {
    fill: $carbon__black-100;
    opacity: 1;
  }

  .#{$prefix}--toast-notification__icon {
    flex-shrink: 0;
    margin-top: $carbon--spacing-05;
    margin-right: $carbon--spacing-05;
  }

  @if feature-flag-enabled('enable-v11-release') {
    .#{$prefix}--toast-notification__content {
      @include type-style('body-short-01');

      margin-top: $carbon--spacing-05;
      margin-right: $carbon--spacing-05;
      margin-bottom: $carbon--spacing-05;
      word-break: break-word;
    }

    .#{$prefix}--toast-notification--low-contrast
      .#{$prefix}--toast-notification__content {
      color: $text-primary;
    }
  } @else {
    .#{$prefix}--toast-notification__details {
      margin-right: $carbon--spacing-05;
    }
  }

  .#{$prefix}--toast-notification__close-button {
    @include focus-outline('reset');

    display: flex;
    width: rem(48px);
    min-width: rem(48px);
    height: rem(48px);
    min-height: rem(48px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    margin-left: auto;
    background-color: transparent;
    cursor: pointer;
    transition: outline $transition--base, background-color $transition--base;

    &:focus {
      outline: 2px solid $inverse-focus-ui;
      outline-offset: -2px;
    }

    .#{$prefix}--toast-notification__close-icon {
      fill: $inverse-01;
    }
  }

  .#{$prefix}--toast-notification--low-contrast
    .#{$prefix}--toast-notification__close-button:focus {
    @include focus-outline('outline');
  }

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

  @if not feature-flag-enabled('enable-v11-release') {
    .#{$prefix}--toast-notification__title {
      @include type-style('productive-heading-01');

      margin-top: $carbon--spacing-05;
      font-weight: 600;
      word-break: break-word;
    }

    .#{$prefix}--toast-notification__subtitle {
      @include type-style('body-short-01');

      margin-top: 0;
      margin-bottom: $carbon--spacing-05;
      color: $inverse-01;
      word-break: break-word;
    }

    .#{$prefix}--toast-notification--low-contrast
      .#{$prefix}--toast-notification__subtitle {
      color: $text-primary;
    }

    .#{$prefix}--toast-notification__caption {
      @include type-style('body-short-01');

      padding-top: $carbon--spacing-03;
      margin-bottom: $carbon--spacing-05;
      color: $inverse-01;
    }

    .#{$prefix}--toast-notification--low-contrast
      .#{$prefix}--toast-notification__caption {
      color: $text-01;
    }
  }

  // Windows HCM fix
  /* stylelint-disable */
  .#{$prefix}--toast-notification {
    @include high-contrast-mode('outline');
  }
  .#{$prefix}--toast-notification__close-button:focus {
    @include high-contrast-mode('focus');
  }
  .#{$prefix}--toast-notification__icon {
    @include high-contrast-mode('icon-fill');
  }
  /* stylelint-enable */
}

@include exports('toast-notifications') {
  @include toast-notifications;
}
