//
// Copyright IBM Corp. 2020, 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';

// ProductiveCard uses the following IBM Products components:
// Card
@import '../Card/card';

@mixin card-productive {
  $block-class: #{$pkg-prefix}--card;

  .#{$block-class}__productive {
    .#{$block-class}__header {
      padding-right: 0;
    }

    .#{$block-class}__title {
      @include carbon--type-style('productive-heading-02');
    }

    .#{$block-class}__title-lg .#{$block-class}__title {
      @include carbon--type-style('productive-heading-03');
    }

    .#{$block-class}__body {
      padding-top: $spacing-03;
    }

    .#{$block-class}__footer {
      align-items: center;
      justify-content: space-between;
      border-top: 1px solid $ui-03;
    }

    .#{$block-class}__footer-no-button {
      justify-content: flex-end;
    }

    .#{$block-class}__actions {
      margin: 0;
    }

    .#{$block-class}__actions-header {
      margin-top: calc(-1 * #{$spacing-02});
      margin-right: $spacing-03;

      .bx--btn {
        &:hover {
          + .#{$block-class}__actions-header-ghost-button.bx--btn--ghost.bx--btn--sm {
            &::before {
              opacity: 0;
            }
          }
        }
      }
    }

    .#{$block-class}__actions-header-ghost-button.bx--btn--ghost.bx--btn--sm {
      // stylelint-disable-next-line carbon/layout-token-use
      padding-right: calc($spacing-01 + $spacing-03);
      // stylelint-disable-next-line carbon/layout-token-use
      padding-left: calc($spacing-01 + $spacing-03);

      &::before {
        position: absolute;
        left: 0;
        width: 0.05rem;
        height: $spacing-06;
        background-color: $hover-ui;
        content: '';
        opacity: 1;
      }

      &:hover {
        &::before {
          opacity: 0;
        }
      }
    }

    .#{$block-class}__actions-header-ghost-button--only.bx--btn--ghost.bx--btn--sm {
      &::before {
        opacity: 0;
      }
    }

    .#{$block-class}__title-lg .#{$block-class}__actions-header,
    .#{$block-class}__header-has-label .#{$block-class}__actions-header {
      margin-top: 0;
    }

    .#{$block-class}__icon {
      margin-right: $spacing-05;
    }

    .#{$block-class}__header-container {
      align-items: start;
    }
  }
}

@include exports('card-productive') {
  @include card-productive;
}
