@import '../../style/variables';

.#{$prefix}collapse {
  box-sizing: border-box;
  border-radius: $collapse-border-radius;
  color: $font-color;
  font-size: 14px;
  font-family: $font-family;
  border: 1px solid #d9d9d9;
  border-bottom: 0;
  background-color: #fafafa;

  &-item {
    box-sizing: border-box;
    border-bottom: 1px solid #d9d9d9;

    &:last-child {
      border-radius: 0 0 $collapse-border-radius $collapse-border-radius;

      .#{$prefix}collapse-item__content {
        border-radius: 0 0 $collapse-border-radius $collapse-border-radius;
      }
    }

    &__header {
      display: flex;
      align-items: center;
      box-sizing: border-box;
      position: relative;
      padding: 12px 16px;
      color: rgba(0, 0, 0, 0.85);
      line-height: 22px;
      cursor: pointer;
      transition: all 300ms;

      &:hover {
        background-color: #efefef;
      }

      &_disabled {
        color: rgba(0, 0, 0, 0.25);
        cursor: not-allowed;
      }
    }

    &__arrow {
      margin-right: 15px;
      transform: rotate(0);
      text-align: center;
      font-size: 12px;
      color: inherit;
      transition: all 300ms;

      &_active {
        transform: rotate(90deg);
      }
    }

    &__title {
      flex: 1;
    }

    &__extra {
      color: inherit;
      font-size: 11px;
      margin-left: 15px;
    }

    &__content {
      overflow: hidden;
      color: rgba(0, 0, 0, 0.65);
      background-color: #fff;
      border-top: 1px solid #d9d9d9;
      padding: 16px;
      box-sizing: border-box;
      transition: height 300ms;
    }
  }

  &_borderless {
    border: 0;
    background-color: #fff;
  }

  &_borderless > .#{$prefix}collapse-item {
    &:last-child {
      border-radius: 0;
    }
  }

  &_borderless > .#{$prefix}collapse-item > .#{$prefix}collapse-item__content {
    border-radius: 0;
    border-top: 0;
    padding-top: 4px;
  }
}

.collapse-transition {
  transition: 0.3s height ease-in-out, 0.3s padding-top ease-in-out, 0.3s padding-bottom ease-in-out;
}
