// ----------------------------------
// 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 !important;

    &.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 * 0.5;
    margin-left: -$spacer * 0.5;

    @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%;
    }
  }
}

@media(min-width: 768px) {
  .addPersonOrBusiness {
    padding-right: 12px;
    padding-left: 12px;
  }

  .rightHolderList {
    padding: inherit;
  }
}

@media(max-width: 767px) {
  .panelBox {
    display: flex;
    flex-direction: column;
  }

  .addPersonOrBusiness {
    order: 3;
  }

  .searchPersonOrBusiness {
    order: 2;
  }

  .activeLog {
    order: 1;
  }
}

@media(max-width: 575px) {
  .activeLog {
    padding-top: 1em;
  }
}

// sass-lint:disable no-disallowed-properties
@media (min-width: 768px) and (max-width: 992px) {
  .a-iconText-icon {
    width: 73px;
  }

  .a-icon {
    width: 72px;
    min-width: 72px;
    height: 72px;
    font-size: $icon-lg-em;
  }

  .a-iconText-text-large {
    font-size: 2.8rem !important;
    -webkit-font-smoothing: subpixel-antialiased;
  }

  .searchPersonOrBusiness {
    display: block;
    width: 18em !important;
    margin: auto;
  }

  .activeLog {
    position: absolute;
    top: 0;
    right: 0;
    padding-right: 60px;
  }
}

.rightHolderList {
  .a-list-container {
    background: $white;
  }
}

@media (min-width: 1200px) {
  .a-collapsePanel {
    &.expanded {
      margin-right: -24px;
      margin-left: -24px;
    }
  }
}
// ----------------------------------
// 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 * 0.5;
  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;
    }
  }

  &.a-dropdownCircleArrow--darkblue {
    background: $blue-dark !important;
    border: 3px solid $blue-dark !important;
  }
}

// Rotate arrows when collapsed
.collapsed {
  .a-dropdownArrow,
  .a-dropdownCircleArrow {
    transform: rotate( 0deg );
  }
}

a {
  &.collapsed {
    .a-dropdownArrow,
    .a-dropdownCircleArrow {
      transform: rotate( 0deg );
    }

    .hideText {
      display: none;
    }
  }

  &:not(.collapsed) {
    .expandText {
      display: none;
    }
  }
}

.a-list-parentRightHolder {
  &:not(.a-expanded) {
    .hideText {
      display: none;
      }
  }

  .a-list-expandedLink-href {
    &:hover {
      border-bottom: none !important;
    }

    &:focus {
      border-bottom: none !important;
    }
  }
}

@media(max-width: 768px) {
  .a-list {
    .row {
      display: flex;
    }
  }
}

.a-expanded {
  // .a-list-expandedLink-href {
  //   .expandable-icon {
  .a-dropdownCircleArrow {
    transform: rotate( 90deg );
  }
}

.hideRightHolders {
  &.a-list-parentRightHolder,
  &.childRightHolders {
    display: none;
  }

  .a-list-parentRightHolder,
  .childRightHolders {
    display: none;
  }
}

.force-show {
  display: block !important;
}

@media(max-width: 767px) {
  .a-list-expandedLink-href {
    display: flex;
    width: 100%;
    padding-top: 4px;
    padding-right: 12px;
    padding-left: 12px;
    margin-left: 6px;
    border-bottom: none;

    div {

      &:nth-child(1) {
        max-width: 5%;
      }

      &:nth-child(2) {
        position: relative;
        min-width: 90%;
        padding-left: 1.5em !important;

        .count {
          display: block;
          max-width: 33%;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }

    .textStatus {
      display: none;
    }
  }

  .childRightHolders {
    .a-modalLink-href {
      display: flex;
      width: 100%;
      padding-top: 4px;
      padding-right: 12px;
      padding-left: 12px;
      margin-left: 6px;
      border-bottom: none;

      div {
        &:nth-child(1) {
          min-width: 5%;
        }

        &:nth-child(2) {
          :first-child {
            display: block;
            max-width: 67%;
            padding-right: 0;
            padding-left: 1em !important;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
      }
    }
  }
}

.a-btn-blue-noUnderline {
  color: $blue-dark;
  text-align: end;
}

.a-list-expandedLink-href {
  display: flex;
  width: 100%;
  padding: 1%;
  border-bottom: none;
  align-items: center;

  .row {
    display: contents;
  }

  div {
    &:nth-child(1) {
      max-width: 3%;
      margin-right: 0.5em;
    }

    &:nth-child(2) {
      display: -webkit-box !important;

      :first-child {
        padding-left: 0 !important;
      }
    }

    @media (max-width: 992px) {
      .noneExpRole {
        max-width: 17em !important;
        margin-left: 0 !important;
      }

      &:nth-child(2) {
        :first-child {
          display: block;
          max-width: 67%;
          padding-right: 0;
          padding-left: 0 !important;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        &:nth-child(2) {
          padding-right: 0;
        }
      }
    }

    &:nth-child(3) {
      text-align: left;

      :first-child {
        display: block;
        max-width: 32em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }

    @media (min-width: 768px) and (max-width: 992px) {
      &:nth-child(3) {
        :first-child {
          max-width: 8em;
          padding-right: 2em;
          margin-left: 2em;
        }
      }
    }

    &:nth-child(4) {
      min-width: 24%;
      max-height: 2em;
      margin-left: -2em;
      text-align: end;
      align-items: -webkit-baseline-middle;

      .textStatus {
        vertical-align: sub;
      }
    }
  }
}

.childRightHoldersList {
  background:  $grey-light;
  border-top: 1px solid  $grey-medium;

  .childRightHolders {
    display: flex;

    .a-modalLink-href {
      display: flex;
      width: 100%;
      padding: 1%;
      border-bottom: none;
      align-items: center;

      .row {
        display: contents;
      }

      div {
        &:nth-child(1) {
          max-width: 3%;
          margin-right: 0.5em;
        }

        &:nth-child(2) {
          display: -webkit-box !important;
        }

        @media (max-width: 992px) {
          &:nth-child(2) {
            :first-child {
              display: block;
              max-width: 300px;
              padding-right: 0;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }

            &:nth-child(2) {
              padding-right: 0;
            }

            &:nth-child(3) {
              padding-left: 2em;
            }
          }
        }

        &:nth-child(3) {
          text-align: left;

          :first-child {
            display: block;
            max-width: 32em;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }

        @media (min-width: 768px) and (max-width: 992px) {
          &:nth-child(3) {
            :first-child {
              max-width: 8em;
              padding-right: 2em;
              margin-left: 2em;
            }
          }
        }

        &:nth-child(4) {
          min-width: 24%;
          padding-right: 0 !important;
          padding-left: 0 !important;
          margin-left: -2em;
          text-align: end;
          }
        }
      }
    }
  }

.notificationIcon {
  color: $red;
  vertical-align: -webkit-baseline-middle;
}

@media (max-width: 767px) {
  .notificationIcon {
    display: table-cell;
  }
}

// ----------------------------------
// 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 * 0.5;
    }

    &: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;
    }
  }
}

.a-rowDropdown {
  & .a-dropdownArrowDownAndUp {
    transition: transform 0.2s ease-out;
    transform: rotate( 90deg );
    justify-content: center;
    align-items: center;
  }

  &.collapsed {
    .a-dropdownArrowDownAndUp {
      transform: rotate( 0deg );
    }
  }
}
