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

/* Variables Custom */
$collapse-header-font-size: 1.5rem !default;
$collapse-header-font-weight: $font-weight-bold !default;
$collapse-header-padding-y: 1rem !default;
$collapse-header-padding-x: 0 !default;
$collapse-header-color: $white !default;
$collapse-header-icon-color: $primary !default;
$collapse-header-icon: str-replace(url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='18' height='9' viewBox='0 0 18 9'%3E%3Cpath fill='#{$collapse-header-icon-color}' d='M9,9,0,0H0L9,5.377,18,0h0Z' transform='translate(18 9) rotate(180)'/%3E%3C/svg%3E%0A"), "#", "%23") !default;
$collapse-header-width: 1.8rem !default;
$collapse-header-height: 0.9rem !default;

$collapse-body-padding-y: 1rem !default;
$collapse-body-padding-x: 0 !default;
$collapse-body-font-size: 1.3rem !default;

$accordion-border-width: 0.1rem !default;
$accordion-border-color: $gray-300 !default;
$accordion-header-font-size: 1.4rem !default;
$accordion-header-font-weight: $font-weight-medium !default;
$accordion-header-padding-y: 1.5rem !default;
$accordion-header-padding-x: 2rem !default;
$accordion-header-border-width: $accordion-border-width !default;
$accordion-header-border-color: $accordion-border-color !default;

$accordion-body-padding-y: 1.7rem !default;
$accordion-body-padding-x: 2rem !default;
/***************************************/

.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: $collapse-header-icon;
      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;
  }
}
