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

// Standard imports.
@import '../../global/styles/project-settings';

// Other Carbon settings.
@import 'carbon-components/scss/globals/grid/grid';

// CreateTearsheet uses the following Carbon components:
// ProgressIndicator, ProgressStep, Toggle, SideNav, SideNavItems, SideNavLink
@import 'carbon-components/scss/components/progress-indicator/progress-indicator';
@import 'carbon-components/scss/components/toggle/toggle';
@import 'carbon-components/scss/components/ui-shell/side-nav';

// CreateTearsheet uses the following IBM Products components:
// TearsheetShell
@import '../Tearsheet/tearsheet';
@import '../CreateInfluencer/index';

@mixin create-tearsheet {
  @keyframes step-content-entrance {
    0% {
      opacity: 0;
      // stylelint-disable-next-line carbon/layout-token-use
      transform: translateY(-0.75rem);
    }

    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }

  $block-class: #{$pkg-prefix}--tearsheet-create;
  $step-block-class: #{$pkg-prefix}--tearsheet-create__step;
  $section-block-class: #{$pkg-prefix}--tearsheet-create__section;
  $tearsheet-divider-class: #{$pkg-prefix}--tearsheet-create__section--divider;
  $tearsheet-fieldset-class: #{$pkg-prefix}--tearsheet-create__step--fieldset;

  .#{$block-class} {
    --#{$block-class}--total-width: 0;
  }

  .#{$block-class} .#{$step-block-class}__step--hidden-step {
    display: none;
  }

  .#{$block-class} .#{$step-block-class}__step--visible-step {
    // stylelint-disable-next-line carbon/motion-easing-use
    animation: step-content-entrance $duration--slow-01;
    animation-fill-mode: forwards;
    animation-timing-function: $carbon--standard-easing;
    opacity: 0;
  }

  @media (prefers-reduced-motion) {
    .#{$block-class} .#{$step-block-class}__step--visible-step {
      animation: none;
      opacity: 1;
    }
  }

  .#{$block-class} .#{$block-class}__content {
    height: 100%;
    padding: $spacing-06;
    overflow-x: hidden;
  }

  .#{$block-class} .#{$block-class}__content .#{$carbon-prefix}--grid {
    padding: 0;
    margin: 0;
  }

  .#{$block-class} .#{$block-class}__step--heading {
    padding-bottom: $spacing-06;
  }

  .#{$block-class}
    .#{$carbon-prefix}--btn-set
    .#{$carbon-prefix}--btn.#{$carbon-prefix}--btn--disabled {
    box-shadow: -0.0625rem 0 0 0 $button-separator;
  }

  .#{$block-class} .#{$carbon-prefix}--side-nav--ux {
    position: initial;
    background-color: transparent;
  }

  .#{$block-class} .#{$block-class}__section--divider {
    position: relative;
    display: block;
    width: var(--#{$block-class}--total-width);
    height: 1px;
    margin: $spacing-06 calc(-1 * #{$spacing-08}) $spacing-07
      calc(-1 * #{$spacing-06});
    background-color: $ui-03;
  }

  .#{$block-class} .#{$block-class}__step--title,
  .#{$block-class} .#{$block-class}__section--title {
    margin-bottom: $spacing-05;
  }

  .#{$block-class} .#{$block-class}__section--subtitle,
  .#{$block-class} .#{$block-class}__step--subtitle {
    @include carbon--type-style('productive-heading-01');

    margin-bottom: $spacing-03;
  }

  .#{$block-class} .#{$block-class}__section--description,
  .#{$block-class} .#{$block-class}__step--description {
    @include carbon--type-style('body-long-01');

    margin-bottom: $spacing-06;
  }

  .#{$block-class} .#{$carbon-prefix}--fieldset {
    margin-bottom: 0;
  }

  .#{$block-class} .#{$block-class}__step--fieldset > * {
    margin-bottom: $spacing-05;
  }
}

@include exports('create-tearsheet') {
  @include create-tearsheet;
}
