/**
 *
 * @ai-apps/angular v2.152.0 | _loading.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.
//

@import '../../globals/scss/vars';
@import '../../globals/scss/css--reset';
@import '../../globals/scss/vendor/@carbon/elements/scss/import-once/import-once';
@import 'keyframes';
@import 'mixins';
@import 'vars';

/// Loading styles
/// @access private
/// @group loading
@mixin loading {
  .#{$prefix}--loading {
    @include reset;
    @include animation__loading--spin;

    width: $loading__size;
    height: $loading__size;
  }

  // Animation (Spin by default)
  .#{$prefix}--loading__svg {
    fill: transparent;
  }

  .#{$prefix}--loading__svg circle {
    stroke-dasharray: 240;
    stroke-linecap: butt;
    stroke-width: 10;
  }

  .#{$prefix}--loading__stroke {
    stroke: $interactive-04;
    stroke-dashoffset: $loading__gap;
  }

  .#{$prefix}--loading--small .#{$prefix}--loading__stroke {
    stroke-dashoffset: $loading--small__gap;
  }

  .#{$prefix}--loading--stop {
    @include animation__loading--stop;
  }

  .#{$prefix}--loading--small {
    width: rem(16px);
    height: rem(16px);

    circle {
      stroke-width: 16;
    }
  }

  .#{$prefix}--loading--small .#{$prefix}--loading__svg {
    stroke: $interactive-04;
  }

  .#{$prefix}--loading__background {
    stroke: $ui-03;
    stroke-dashoffset: -22;
  }

  // Negative values for `stroke-dashoffset` are not supported in Safari
  @media not all and (min-resolution: 0.001dpcm) {
    @supports (-webkit-appearance: none) and (stroke-color: transparent) {
      circle.#{$prefix}--loading__background {
        stroke-dasharray: 265;
        stroke-dashoffset: 0;
      }
    }
  }

  .#{$prefix}--loading-overlay {
    position: fixed;
    z-index: z('overlay');
    top: 0;
    left: 0;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    background-color: $overlay-01;
    transition: background-color $duration--slow-02 motion(standard, expressive);
  }

  .#{$prefix}--loading-overlay--stop {
    display: none;
  }
}

@include exports('loading') {
  @include loading;
}
