.collapsible {
  border: $border;
  $self: &;

  &__header {
    padding: 0 20px;

    p {
      margin-bottom: 0;

      &:nth-child(2) {
        margin-top: 10px;
      }
    }

    &--grey {
      background-color: #dedede;
    }
  }

  &__sub-container {
    background-color: $pale-gray;
  }

  &__list {
    line-height: 1;
    padding: 0;
    margin: 0;

    &-radio {
      padding: 0;

      input[type="radio"] {
        display: none;
      }

      input[type="radio"]:checked + label {
        font-weight: 600;
      }
    }

    @include media-breakpoint-up(sm) {
      padding: 0;
    }

    li {
      position: relative;
      line-height: 1;
      list-style-type: none;

      &:not(:last-of-type) {
        a {
          @include media-breakpoint-up(sm) {
            border-bottom: $border;
          }
        }
      }

      @include media-breakpoint-up(sm) {
      }
    }

    #{$self}__indicator {
      width: 30px;
      min-height: 42px;
      display: inline-block;
      position: absolute;
      top: 0px;
      right: 10px;
      cursor: pointer;
      z-index: 3;

      &:before,
      &:after {
        content: "";
        border-top: 1px solid;
        position: absolute;
        width: 10px;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        transition: 0.3s ease-in-out;
      }

      &:after {
        transform: rotate(90deg);
        left: calc(50% - 5px);
        opacity: 0;
      }

      &.collapsed {
        &:after {
          opacity: 1;
        }
      }

      &:not(.collapsed) {
        & ~ a {
          background: #ebebeb;
          margin: 0;
          border-bottom: none;
        }
      }
    }

    a {
      line-height: 1.3;
      text-decoration: none;
      color: $black;
      min-height: 42px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      padding-left: 19px;
      color: $black;
      font-size: 16px;

      &.active {
        font-weight: 500;
      }
    }
  }

  &__list-sub {
    padding: 11px 0 8px;

    li {
      #{$self}__indicator {
        min-height: 30px;
      }

      &:not(:last-of-type),
      &:last-of-type {
        a {
          border-bottom: none;
        }
      }

      a {
        padding-left: 29px;
        min-height: auto;

        @include media-breakpoint-up(sm) {
          min-height: 30px;
        }

        &.active {
          font-weight: 700;
        }
      }
    }

    ul {
      a {
        padding-left: 40px;
      }
    }
  }

  // modifier
  &--arrow {
    #{$self}__header {
      border-bottom: 1px solid #dedede;

      p {
        margin-bottom: 0;
      }
    }

    #{$self}__list {
      a {
        padding-left: 29px;
      }

      &-sub {
        a {
          padding-left: 39px;
        }
      }
    }

    #{$self}__indicator {
      left: 0;
      right: auto;

      &:before {
        top: 50%;
        transform: translate(-50%, -50%);
        border-top: 4px solid rgba(0, 0, 0, 0);
        border-left: 8px solid;
        border-bottom: 4px solid rgba(0, 0, 0, 0);
        border-right: 0px solid rgba(0, 0, 0, 0);
        width: 0;
      }

      &:after {
        content: none;
        border-top: 4px solid rgba(0, 0, 0, 0);
      }

      &:not(.collapsed) {
        &:before {
          transform: translate(-50%, -50%) rotate(90deg);
        }
      }
    }
  }

  &--arrow-reverse {
    @extend #{$self}--arrow;

    #{$self}__list {
      a {
        padding-left: 29px;
      }

      &-sub {
        a {
          padding-left: 39px;
        }
      }
    }

    #{$self}__indicator {
      &:before {
        border-top: 4px solid rgba(0, 0, 0, 0);
        border-left: 8px solid;
        border-bottom: 4px solid rgba(0, 0, 0, 0);
        border-right: 0px solid rgba(0, 0, 0, 0);
        top: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
        width: 0;
      }

      &:not(.collapsed) {
        &:before {
          transform: translate(-50%, -50%);
        }
      }
    }
  }

  &--arrow-gray {
    #{$self}__indicator {
      color: $gray;
    }
  }

  &--collapsed {
    #{$self}__sub-container {
      background-color: #fff;
      @include media-breakpoint-up(sm) {
        background-color: #f4f4f4;
      }
      &.collapse:not(.show) {
        display: block;
        @include media-breakpoint-up(sm) {
          display: none;
        }
      }
    }

    #{$self}__list {
      & > li {
        background-color: #ebebeb;
        line-height: 2.5;
        @include media-breakpoint-up(sm) {
          line-height: 2;
          background-color: #fff;
        }
      }
    }

    #{$self}__list-sub {
      padding-left: 35px;
      margin-bottom: 13px;

      @include media-breakpoint-up(sm) {
        padding-left: 0;
        list-style-type: none;
        margin-bottom: 0;
      }

      li {
        list-style-type: disc;

        @include media-breakpoint-up(sm) {
          list-style-type: none;
        }
      }

      a {
        padding: 7px 0 0;
        display: inline-block;

        @include media-breakpoint-up(sm) {
          padding: 4px 29px 3px 29px;
          display: flex;
        }
      }
      #{$self}__list-sub {
        a {
          @include media-breakpoint-up(sm) {
            padding-left: 40px;
          }
        }
      }
    }

    #{$self}__indicator {
      display: none;

      @include media-breakpoint-up(sm) {
        display: block;
      }
    }
  }
}
