// --------------------------------------------
// Card Base Mixin --------------------------
// --------------------------------------------
@mixin card {
  display: flex;
  position: relative;
  border: $card-border;
  word-wrap: break-word;
  flex-direction: column;
  color: $card-text-color;
  box-shadow: $card-shadow;
  background-color: $card-bg;
  min-width: $card-min-width;
  background-clip: border-box;
  font-family: $card-font-family;
  font-size: $card-body-font-size;
  border-radius: $card-border-radius;
  transition: all .1s ease-in-out 0s;

  &-hover:hover {
    cursor: pointer;
    box-shadow: $card-shadow-hover;
    border: $card-border-hover;
  }
}

@mixin card-header {
  border-bottom: $card-border;
  padding: $card-padding-v $card-padding-h;
  border-radius: $card-border-radius $card-border-radius 0 0;

  &-title {
    display: inline-block;
    color: $card-header-color;
    font-size: $card-header-font-size;
    font-weight: $card-header-font-weight;
    line-height: $card-header-line-height;
  }

  &-subtitle {
    display: block;
    font-size: $card-subtitle-font-size;
    line-height: $card-subtitle-line-height;

    + .c-card-header-menu {
      height: $card-header-line-height + $card-subtitle-line-height + ($card-padding-v * 2);
    }
  }

  &-menu {
    top: 0;
    float: right;
    display: flex;
    position: absolute;
    align-items: center;
    right: $card-padding-h;
    height: $card-header-line-height + ($card-padding-v * 2);

    > * {
      margin: auto 12px;

      &:last-child {
        margin-right: $space-0;
      }
    }

    .c-btn {
      margin: auto $space-xs;

      &:last-child {
        margin-right: $space-0;
      }
    }

    &-item {
      padding-left: $space-xs;
    }

    &-icon {
      font-size: $font-size-4;
      color: $card-header-icon-color;

      &:hover {
        color: $card-header-icon-hover-color;
      }

      // &:not(:first-child) {
      //   margin-left: $space-lg;
      // }
    }
  }
}

@mixin card-content {
  flex: 1 1 auto;
  font-weight: normal;
  font-family: $card-font-family;
  font-size: $card-body-font-size;
  padding: $card-padding-v $card-padding-h;
}

@mixin card-footer {
  display: flex;
  align-items: center;
  border-top: $card-border;
  padding: $card-padding-v $card-padding-h;
  border-radius: $radius-0 $radius-0 $card-border-radius $card-border-radius;

  a:not(.c-btn),
  &-link {
    text-decoration: underline;
    color: $card-footer-color;
    font-size: $card-footer-font-size;
    line-height: $card-footer-line-weight;

    &:hover {
      color: $card-footer-hover-color;
    }
  }

  &-item {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    font-size: $card-footer-font-size;
    line-height: $card-footer-line-weight;

    &-center {
      justify-content: center;
    }

    &-right {
      justify-content: flex-end;
    }

    &-left {
      justify-content: flex-start;
    }
  }
}

@mixin card-variant($background, $border, $color) {
  background-color: $background;
  border-color: $border;
  color: $color;

  .c-card-header {
    background-color: transparent;
    color: $color;
    border-bottom: 1px solid darken($background, 5%);

    &-menu-icon {
      color: $color;
    }
  }

  .c-card-footer {
    background-color: transparent;
    border-top: 1px solid darken($background, 5%);

    &-link {
      color: $color;

      &:hover {
        color: $color;
      }
    }
  }

  .c-card-content {
    background-color: transparent;
  }

  .c-card-content-title,
  .c-card-content-body,
  .c-card-content-subtitle {
    color: $color;
  }
}

