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

/* Variables Custom */
$collapse-header-font-size: 1.5rem;
$collapse-header-font-weight: $font-weight-bold;
$collapse-header-padding-y: 1rem;
$collapse-header-padding-x: 0;
$collapse-header-color: $white;
$collapse-header-icon-color: $primary;
$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");
$collapse-header-width: 1.8rem;
$collapse-header-height: 0.9rem;

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

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

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

.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;

  &: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;
}
.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;
  }
}
