/**
 *
 * @ai-apps/angular v2.152.0 | _inline-notification.scss
 *
 * Copyright 2014, 2023 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/helper-mixins';
@import '../../globals/scss/layout';
@import '../../globals/scss/component-tokens';
@import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
@import '../../globals/scss/css--reset';
@import 'mixins';
@import 'tokens';

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

    position: relative;
    display: flex;
    width: 100%;
    min-width: rem(288px);
    max-width: rem(288px);
    height: auto;
    min-height: rem(48px);
    flex-wrap: wrap;
    @if not feature-flag-enabled('enable-v11-release') {
      margin-top: $carbon--spacing-05;
      margin-bottom: $carbon--spacing-05;
    }

    color: $inverse-01;

    @include carbon--breakpoint(md) {
      max-width: rem(608px);
      flex-wrap: nowrap;
    }

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

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

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

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

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

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

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

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

    &::before {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      box-sizing: border-box;
      border-width: 1px 1px 1px 0;
      border-style: solid;
      content: '';
      filter: opacity(0.4);
      pointer-events: none;
    }
  }

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

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

    &::before {
      border-color: $support-01;
    }
  }

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

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

    &::before {
      border-color: $support-02;
    }
  }

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

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

    &::before {
      border-color: $support-04;
    }
  }

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

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

    &::before {
      border-color: $support-03;
    }
  }

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

  .#{$prefix}--inline-notification__details {
    display: flex;
    flex-grow: 1;
    margin: 0 $carbon--spacing-09 0 $carbon--spacing-05;

    @include carbon--breakpoint(md) {
      margin: 0 $carbon--spacing-05;
    }
  }

  .#{$prefix}--inline-notification__icon {
    flex-shrink: 0;
    margin-top: rem(14px);
    margin-right: $carbon--spacing-05;
  }

  .#{$prefix}--inline-notification__text-wrapper {
    display: flex;
    flex-wrap: wrap;
    padding: rem(15px) 0;
  }

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

      word-break: break-word;
    }
  } @else {
    .#{$prefix}--inline-notification__title {
      @include type-style('productive-heading-01');

      margin: 0 $carbon--spacing-02 0 0;
    }

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

      word-break: break-word;
    }
  }

  .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost {
    height: rem(32px);
    margin-bottom: $carbon--spacing-03;
    margin-left: $carbon--spacing-08;

    @include carbon--breakpoint(md) {
      margin: $carbon--spacing-03 0;
    }
  }

  .#{$prefix}--inline-notification:not(.#{$prefix}--inline-notification--low-contrast)
    .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost {
    color: $inverse-link;
  }

  .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost:active,
  .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost:hover {
    background-color: $inverse-hover-ui;
  }

  .#{$prefix}--inline-notification--low-contrast
    .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost:active,
  .#{$prefix}--inline-notification--low-contrast
    .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost:hover {
    background-color: get-token-value(
      $notification-colors,
      'notification-action-hover'
    );
  }

  .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost:focus {
    border-color: transparent;
    box-shadow: none;
    outline: 2px solid $inverse-focus-ui;
    outline-offset: -2px;
  }

  .#{$prefix}--inline-notification--low-contrast
    .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost:focus {
    outline-color: $focus;
  }

  .#{$prefix}--inline-notification--hide-close-button
    .#{$prefix}--inline-notification__action-button.#{$prefix}--btn--ghost {
    margin-right: $carbon--spacing-03;
  }

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

    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    width: rem(48px);
    min-width: rem(48px);
    max-width: rem(48px);
    height: rem(48px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: outline $duration--fast-02 motion(standard, productive),
      background-color $duration--fast-02 motion(standard, productive);

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

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

    @include carbon--breakpoint(md) {
      position: static;
    }
  }

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

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

  // Windows HCM fix
  /* stylelint-disable */
  .#{$prefix}--inline-notification {
    @include high-contrast-mode('outline');
  }

  .#{$prefix}--inline-notification__close-button:focus,
  .#{$prefix}--btn.#{$prefix}--btn--ghost.#{$prefix}--inline-notification__action-button:focus {
    @include high-contrast-mode('focus');
  }

  .#{$prefix}--inline-notification__icon {
    @include high-contrast-mode('icon-fill');
  }
  /* stylelint-enable */
}

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