// ----------------------------------
// COLLAPSE PANEL
// ----------------------------------

.a-accordion-card {
  background-color: transparent;
  border: none;
}

.a-collapsePanel {
  margin-bottom: $spacer;

  .a-collapsePanel-heading {
    padding: 0;
    color: $black;
    background: $white;
    border-bottom: none;
    box-shadow: $shadow2;

    a {
      display: block;
      padding-bottom: 0;
      border: none;
    }

    .a-collapseBtn {
      position: relative;
      background: $white;
    }

    &.dim {
      background-color: $white-opacity-05;

      .a-icon-circle {
        color: $black;
        background-color: $white;
      }
    }

    &:focus,
    &:hover {
      background: $white-opacity-07;
    }

    .a-iconText-text-large {
      @include a-fontSize20;
      @include a-fontReg;

      @include media-breakpoint-up( lg ) {
        @include a-fontSize28;
      }
    }

    &.a-grey-panel {
      background: $grey-lighter;
    }
  }

  .a-collapsePanel-body {
    position: relative;
    height: 0;
    background: $white;
    border: none;
    border-top: 1px solid $grey-light;
    box-shadow: $shadow2;

    &.a-collapsePanel-body--border {
      border: 1px solid $grey-medium;
      border-top: 1px solid $grey-light;
    }

    &.no-background {
      background-color: transparent;
      box-shadow: none;
    }

    &.collapse {
      border-top: none;
    }

    &.show {
      height: auto;
      border-top: 1px solid $grey-light;
    }

    .a-collapsePanel-body-content {
      position: relative;
      padding: $spacer * 2 $spacer;
      margin: 0;
      border-bottom: 1px solid $grey-medium;

      @include media-breakpoint-up( sm ) {
        padding: $spacer * 2 $spacer * 6;
      }

      @include media-breakpoint-up( md ) {
        padding: $spacer * 3 $spacer * 7 $spacer * 5 $spacer * 7;
      }

      @include media-breakpoint-up( lg ) {
        padding: $spacer * 3 $spacer * 8 $spacer * 5 $spacer * 8;
      }

      &:last-of-type {
        border-bottom: none;
      }
    }

    &.a-msg-body {
      .a-collapsePanel-body-content {
        padding-right: $spacer;
        padding-left: $spacer;

        @include media-breakpoint-up (md) {
          padding-right: $spacer * 4;
          padding-left: $spacer * 8;

          .a-inboxCompact & {
            padding-left: $spacer * 7;
          }
        }
      }
    }
  }

  &.a-collapsePanel--large {
    .a-collapsePanel-body {
      .a-collapsePanel-body-content {
        @include media-breakpoint-up( lg ) {
          padding: $spacer * 3 $spacer * 8;
        }
      }
    }
  }

  &.expanded {
    // Add top / bottom margin to add more space around expanded items
    padding-top: $spacer;
    padding-bottom: $spacer;
    margin-right: -$spacer / 2;
    margin-left: -$spacer / 2;

    @include media-breakpoint-up( md ) {
      margin-right: -$spacer * 2;
      margin-left: -$spacer * 2;
    }

    @include media-breakpoint-up( xl ) {
      margin-right: -$spacer * 3;
      margin-left: -$spacer * 3;
    }

    .a-collapsePanel-heading {
      background-color: $white;

      &.a-grey-panel {
        background-color: $grey-lighter;
      }

      @include media-breakpoint-up( md ) {

        .a-collapseBtn {
          border-radius: 2px 2px 0 0 !important;
        }
      }
    }

    .a-collapsePanel-heading,
    .a-collapsePanel-body {
      &.no-background {
        padding: 0;
      }
    }
  }

  &:first-of-type {
    padding-top: 0;
  }
}

.a-collapsePanel,
.a-collapsePanel-body,
.a-collapsePanel-body-content,
.a-collapsePanel-heading {
  transition: height 0.35s ease, margin 0.35s ease, padding 0.35s ease, width 0.35s ease;
}

.panel-collapse-content-section {
  background-color: $grey-light;
  border-top: 1px solid $grey-medium;

  .a-first-action {
    width: 100%;

    @include media-breakpoint-up( lg ) {
      width: $spacer * 17;
    }

    @include media-breakpoint-up( lg ) {
      float: left;
    }
  }

  .a-second-action {
    width: 100%;

    @include media-breakpoint-up( lg ) {
      width: $spacer * 24;
    }

    @include media-breakpoint-up( lg ) {
      display: block;
      margin: auto;
    }
  }

  .a-third-action {
    @include media-breakpoint-up( lg ) {
      position: absolute;
      top: 0;
      right: 0;
      padding-right: $spacer * 5;
    }

    .a-third-action-spacer {
      padding-top: 5px; // align text to searchfield text, pixel-pushing necessary here
    }
  }


  .a-fourth-action {
    button {
      width: 100%;
    }
  }
}

.a-third-action-mobile {
  background-color: $grey-light;

  .a-third-action-spacer {
    padding: $spacer * 2 $spacer;
  }
}

// ----------------------------------
// PANEL ACCORDION
// ----------------------------------

.a-panelAccordion {
  // When "a-collapsePanel" is inside accordion, it should animate the active panel larger than the other one
  .a-collapsePanel-heading {
    .a-collapseBtn {
      background: transparent;
      box-shadow: none !important;
    }

    .a-collapsePanel--large {
      // If large collapsePanel, body has more padding left
      .a-collapsePanel-body {
        .a-collapsePanel-body-content {
          @include media-breakpoint-up( lg ) {
            padding: 40px 112px !important;
          }
        }
      }
    }
  }
}

.a-collapsePanel-body-secondary {
  margin: -1px 0;
  background-color: $grey-light;
  border: 1px solid $grey-medium;

  @include media-breakpoint-up( sm ) {
    padding: $spacer $spacer $spacer $spacer;
  }

  @include media-breakpoint-up( md ) {
    padding: $spacer $spacer $spacer $spacer * 8;

    .a-inboxCompact & {
      padding-left: $spacer * 7;
    }
  }

  @include media-breakpoint-up( lg ) {
    padding: $spacer $spacer $spacer $spacer * 8;

    .a-inboxCompact & {
      padding-left: $spacer * 7;
    }
  }

  &.a-no-sideborder {
    border-right: none;
    border-left: none;
   }
}


// ----------------------------------
// COLLAPSE HEADER
// ----------------------------------

.a-collapseHeader {
  display: inline-block;
  width: 100%;
  padding-bottom: $spacer / 2;
  margin-bottom: 0;

  a {
    border: none;
  }

  .a-label {
    margin-top: -2px;
    margin-left: 3px;
  }
}

.a-collapseContent {

  .a-collapseContent-inside {
    padding-right: 0;
    padding-bottom: $spacer * 3;
    padding-left: $spacer * 4;

    @include media-breakpoint-up( md ) {
      padding-right: $spacer * 4;
    }
  }

  .a-collapseContent-img {
    margin-top: -36px;
    opacity: 0;

    img {
      border-radius: 50%;
    }
  }

  &.collapse {
    &.show {
      .a-collapseContent-img {
        opacity: 1;
      }
    }
  }

  ul {
    &:not(.connected-bullets) {
      &:not(.no-decoration) {
        margin-left: 0;
      }
    }
  }
}

.a-dropdownArrow {
  display: inline-flex;
  width: 0;
  height: 0;
  margin-top: 4px;
  margin-right: 7px;
  margin-bottom: 7px;
  margin-left: 2px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid $blue;
  transition: transform 0.2s ease-out;
  transform: rotate( 90deg );
  justify-content: center;
  align-items: center;
}

.a-dropdownCircleArrow {
  display: inline-flex;
  width: 36px;
  min-width: 36px;
  height: 36px;
  margin-top: -3px;
  margin-right: $spacer;
  color: $white;
  background: $blue;
  border: 3px solid $blue;
  border-radius: 50%;
  transition: transform 0.2s ease-out;
  transform: rotate( 90deg );
  justify-content: center;
  align-items: center;

  i {
    padding-left: 3px;
    line-height: inherit;
  }

  &.a-dropdownCircleArrow--small {
    width: 24px;
    min-width: 24px;
    height: 24px;

    i {
      @include a-fontSize20;
      margin-top: 0;
    }
  }
}

// Rotate arrows when collapsed
.collapsed {
  .a-dropdownArrow {
    transform: rotate( 0deg );
  }

  .a-dropdownCircleArrow {
    transform: rotate( 0deg );
   }
}


// ----------------------------------
// COLLAPSE IN DELAY
// ----------------------------------

.a-collapseContent-delay {
  opacity: 0;
}

.a-collapsePanel-body {
  &.collapse,
  .a-onboarding {
    &.show {
      .a-collapseContent-delay {
        opacity: 1;
      }
    }
  }
}

// ----------------------------------
// COLLAPSE BTN
// ----------------------------------
.a-collapse-title {
  display: flex;
  padding-bottom: 3px;
  margin-bottom: 0;
  box-shadow: none !important;
  align-items: center;

  &.a-collapse-title--flexstart {
    align-items: flex-start;
  }

  &.a-collapse-title--absolute {
    display: block;
    padding-left: 20px;

    .a-dropdownArrow {
      position: absolute;
      top: 0;
      left: 0;
      @include media-breakpoint-up( md ) {
        top: 3px;
      }
    }
  }

  a {
    border: none;
  }

  // focus
  &::before {
    margin-top: 3px;
  }

  &.toggle-collapse-text {
    .secondary-collapse-text {
      display: block;
    }

    .primary-collapse-text {
      display: none;
    }

    &.collapsed {
      .secondary-collapse-text {
        display: none;
      }

      .primary-collapse-text {
        display: block;
      }
    }
  }
}

.a-collapse-body {
  padding-left: 18px; // Custom margin to match the position of the arrow
}

// ----------------------------------
// SMALL ACCORDION
// ----------------------------------

.a-accordion-small {
  .card {
    margin-bottom: 0;
    background: none;
    border: none;

    .a-collapse-title {
      padding-top: $spacer;
      padding-bottom: $spacer / 2;
    }

    &:first-child {
      a {
        padding-top: 0;
      }
    }
  }

  &.a-accordion-largeText {
    @include a-fontSize20;

    .a-dropdownArrow {
      margin-top: 6px;
    }
  }

  .a-collapseContent {
    padding-left: 23px;
  }

  .a-dropdownArrow {
    margin-right: 10px;
  }
}

// ----------------------------------
// LARGE ACCORDION
// ----------------------------------
.a-accordion-large {
  border-bottom: 1px solid $blue-line;

  .card {
    margin-bottom: 0;
    background: none;
    border: none;
  }

  .a-collapse-title {
    padding: 21px 0 18px 0;
    border-top: 1px solid $blue-line;
  }

  &.a-accordion-large--offset {
    .a-collapse-title {
      @include media-breakpoint-up( lg ) {
        padding-left: $spacer * 2.5;
      }
      @include media-breakpoint-up( xl ) {
        padding-left: $spacer * 3.5;
      }
    }

    .a-collapseContent-inside {
      @include media-breakpoint-up( lg ) {
        padding-left: 80px;
      }
      @include media-breakpoint-up( xl ) {
        padding-left: 92px;
      }
    }
  }
}

// ----------------------------------
// EXPANDABLE CONTENT
// ----------------------------------
.a-expandable-content {
  position: relative;
  max-height: 320px;
  overflow: hidden;
  border-bottom: $spacer * 2 solid $white;

  &::before {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 150px;
    content: ' ';
    background: linear-gradient($transparent, $white);
  }

  &.a-expanded {
    max-height: none;
    border-bottom: none;

    &::before {
      content: none;
    }
  }
}
