//
// Base styles
//

.#{$card-prefix-cls} {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: $card-bg;
  border: $card-border-width solid $card-border-color;
  @include border-radius($card-border-radius);
  &:hover {
    box-shadow: 0 $card-border-width 6px rgba(0,0,0,.2);
    border-color: $card-border-color
  }
}

.#{$card-prefix-cls}-dis-hover{
  &:hover {
    box-shadow:none;
    border-color: $card-border-color
  }
}

.#{$card-prefix-cls}-block {
  // Enable `flex-grow: 1` for decks and groups so that card blocks take up
  // as much space as possible, ensuring footers are aligned to the bottom.
  flex: 1 1 auto;
  padding: $card-spacer-x;
}

.#{$card-prefix-cls}-title {
  margin-bottom: $card-title-spacer-y;
  font-size:$card-title-font-size;
}

.#{$card-prefix-cls}-subtitle {
  margin-top: -($card-spacer-y / 2);
  margin-bottom: 0;
}

.#{$card-prefix-cls}-text{
  color: $cart-text-color;
  font-size:$cart-text-font-size;
  &:last-child {
    margin-bottom: 0;
  }
}

.#{$card-prefix-cls}-link {
  @include hover {
    text-decoration: none;
  }

  + .#{$card-prefix-cls}-link {
    margin-left: $card-spacer-x;
  }
}

.#{$card-prefix-cls} {
  > .list-group:first-child {
    .list-group-item:first-child {
      @include border-top-radius($card-border-radius);
    }
  }

  > .list-group:last-child {
    .list-group-item:last-child {
      @include border-bottom-radius($card-border-radius);
    }
  }
}


//
// Optional textual caps
//

.#{$card-prefix-cls}-header {
  padding: $card-header-spacer-y $card-spacer-x;
  display: flex;
  align-items: center;
  height:auto;
  line-height: inherit;
  margin-bottom: 0; // Removes the default margin-bottom of <hN>
  background-color: $card-cap-bg;
  //border-bottom: $card-border-width solid $card-border-color;
  color:$card-header-color;
  font-size:$card-header-font-size;
  &:first-child {
    @include border-radius($card-border-radius-inner $card-border-radius-inner 0 0);
  }
}

.#{$card-prefix-cls}-footer {
  padding: $card-footer-spacer-y $card-footer-spacer-x;
  background-color: $card-bg;
  border-top: $card-border-width solid $card-border-color;
  font-size:$card-footer-font-size;
  line-height: 1;

  &:last-child {
    @include border-radius(0 0 $card-border-radius-inner $card-border-radius-inner);
  }
}


//
// Header navs
//

.#{$card-prefix-cls}-header-tabs {
  margin-right: -($card-spacer-x / 2);
  margin-bottom: -$card-header-spacer-y;
  margin-left: -($card-spacer-x / 2);
  border-bottom: 0;
}

.#{$card-prefix-cls}-header-pills {
  margin-right: -($card-spacer-x / 2);
  margin-left: -($card-spacer-x / 2);
}
.#{$card-prefix-cls}-header-pills .nav-item{
  margin-right:$card-header-pills-item-gutter-x;
}
.#{$card-prefix-cls}-header-pills .nav-link{
  font-size:$card-header-pills-link-font-size;
  height:$card-header-pills-link-height;
  line-height: $card-header-pills-link-height;
  background: $card-header-pills-link-bg;
  border-radius: $card-header-pills-link-height;
  color:$card-header-pills-link-color;
  &.active{
    @extend %gradient-primary;
    color:$card-header-pills-link-active-color;
  }
  &.disabled{
    background: transparent;
    color:$card-header-pills-link-disabled-color;
  }
}


//
// Background variations
//

.#{$card-prefix-cls}-primary {
  @include card-variant($brand-primary, $brand-primary);
}
.#{$card-prefix-cls}-success {
  @include card-variant($brand-success, $brand-success);
}
.#{$card-prefix-cls}-info {
  @include card-variant($brand-info, $brand-info);
}
.#{$card-prefix-cls}-warning {
  @include card-variant($brand-warning, $brand-warning);
}
.#{$card-prefix-cls}-danger {
  @include card-variant($brand-danger, $brand-danger);
}

// Remove all backgrounds
.#{$card-prefix-cls}-outline-primary {
  @include card-outline-variant($btn-primary-bg);
}
.#{$card-prefix-cls}-outline-secondary {
  @include card-outline-variant($btn-secondary-border);
}
.#{$card-prefix-cls}-outline-info {
  @include card-outline-variant($btn-info-bg);
}
.#{$card-prefix-cls}-outline-success {
  @include card-outline-variant($btn-success-bg);
}
.#{$card-prefix-cls}-outline-warning {
  @include card-outline-variant($btn-warning-bg);
}
.#{$card-prefix-cls}-outline-danger {
  @include card-outline-variant($btn-danger-bg);
}

//
// Inverse text within a card for use with dark backgrounds
//

.#{$card-prefix-cls}-inverse {
  @include card-inverse;
}

//
// Blockquote
//

.#{$card-prefix-cls}-blockquote {
  padding: 0;
  margin-bottom: 0;
  border-left: 0;
}

// Card image
.#{$card-prefix-cls}-img-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: $card-img-overlay-padding;
}

.#{$card-prefix-cls}-img {
  width: 100%; // Required because we use flexbox and this inherently applies align-self: stretch
  @include border-radius($card-border-radius-inner);
}

// Card image caps
.#{$card-prefix-cls}-img-top {
  width: 100%; // Required because we use flexbox and this inherently applies align-self: stretch
  @include border-top-radius($card-border-radius-inner);
}

.#{$card-prefix-cls}-img-bottom {
  width: 100%; // Required because we use flexbox and this inherently applies align-self: stretch
  @include border-bottom-radius($card-border-radius-inner);
}


// Card deck

@include media-breakpoint-up(sm) {
  .#{$card-prefix-cls}-deck {
    display: flex;
    flex-flow: row wrap;
    margin-right: -$card-deck-margin;
    margin-left: -$card-deck-margin;

    .#{$card-prefix-cls} {
      display: flex;
      flex: 1 0 0;
      flex-direction: column;
      margin-right: $card-deck-margin;
      margin-left: $card-deck-margin;
    }
  }
}


//
// Card groups
//

@include media-breakpoint-up(sm) {
  .#{$card-prefix-cls}-group {
    display: flex;
    flex-flow: row wrap;

    .#{$card-prefix-cls} {
      flex: 1 0 0;

      + .#{$card-prefix-cls} {
        margin-left: 0;
        border-left: 0;
      }

      // Handle rounded corners
      @if $enable-rounded {
        &:first-child {
          @include border-right-radius(0);

          .#{$card-prefix-cls}-img-top {
            border-top-right-radius: 0;
          }
          .#{$card-prefix-cls}-img-bottom {
            border-bottom-right-radius: 0;
          }
        }
        &:last-child {
          @include border-left-radius(0);

          .#{$card-prefix-cls}-img-top {
            border-top-left-radius: 0;
          }
          .#{$card-prefix-cls}-img-bottom {
            border-bottom-left-radius: 0;
          }
        }

        &:not(:first-child):not(:last-child) {
          border-radius: 0;

          .#{$card-prefix-cls}-img-top,
          .#{$card-prefix-cls}-img-bottom {
            border-radius: 0;
          }
        }
      }
    }
  }
}


//
// Columns
//

@include media-breakpoint-up(sm) {
  .#{$card-prefix-cls}-columns {
    column-count: $card-columns-count;
    column-gap: $card-columns-gap;

    .#{$card-prefix-cls} {
      display: inline-block; // Don't let them vertically span multiple columns
      width: 100%; // Don't let their width change
      margin-bottom: $card-columns-margin;
    }
  }
}

//
//accordion
//
.accordion{
  border-bottom:1px solid $card-border-color;
  border-radius: $card-border-radius;
  >.#{$card-prefix-cls}{
    border-bottom:0;
    border-radius: 0;
    &:first-child{
      border-top-left-radius: $card-border-radius;
      border-top-right-radius: $card-border-radius;
    }
  }
  .#{$card-prefix-cls}-header{
    cursor: pointer;
    a{
      &:before{
        @extend %aid-icon;
        content:"\F162";
        transform: rotate(0) scale(1.4);
      }
      &.collapsed{
        &:before{
          transform: rotate(-90deg) scale(1.4);
        }
      }
    }
  }

  .collapse-item {
    .card-block {
      padding: 0;
      overflow: hidden;
    }

    .collapse-content-box {
      padding: 1.25rem;
    }
  }
}
