/*------------------------------------------------------------
COLLAPSE
====================================*/

.collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: $collapse-header-padding-y $collapse-header-padding-x;
  text-align: left;
  font-size: $collapse-header-font-size;
  font-weight: $collapse-header-font-weight;
  background: $collapse-header-color;
  border: 0;
  -webkit-appearance: none;

  &:after {
    content: '';
    display: block;
    flex-shrink: 0;
    width: $collapse-header-width;
    height: $collapse-header-height;
    margin-left: 1rem;
    background: {
      image: str-replace($collapse-header-icon, "#", "%23");
      repeat: no-repeat;
      position: center center;
      size: contain;
    }
    transform: rotate(180deg);
    transition: 0.3s;
  }

  &:focus {
    outline: none;
  }

  &[aria-expanded=true], &.active {
    &:after {
      transform: rotate(0deg);
    }
  }
}
.collapse-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  &.active {
    max-height: none;
  }
}
.collapse-body {
  padding: $collapse-body-padding-y $collapse-body-padding-x;
  font-size: $collapse-body-font-size;
}

/* Accordion */
.custom-accordion {
  border: $accordion-border-width solid $accordion-border-color;

  .collapse-header {
    padding: $accordion-header-padding-y $accordion-header-padding-x;
    font-size: $accordion-header-font-size;
    font-weight: $accordion-header-font-weight;
    &[aria-expanded=true], &.active {
      border-bottom: $accordion-header-border-width solid $accordion-header-border-color;
    }
  }
  .collapse-wrapper {
    border: 0;
    border-bottom: $accordion-border-width solid $accordion-border-color;
    &:last-child {
      border-bottom: 0;
    }
  }
  .collapse-header {
    border-right: 0;
    border-left: 0;
  }
  .collapse-body {
    padding: $accordion-body-padding-y $accordion-body-padding-x;
  }
}
