@prefixCls: rc-collapse;
@text-color: #666;
@borderStyle: 1px solid #d9d9d9;

#arrow {
  .common() {
    width: 0;
    height: 0;
    font-size: 0;
    line-height: 0;
  }
  .right(@w, @h, @color) {
    border-top: @w solid transparent;
    border-bottom: @w solid transparent;
    border-left: @h solid @color;
  }

  .bottom(@w, @h, @color) {
    border-left: @w solid transparent;
    border-right: @w solid transparent;
    border-top: @h solid @color;
  }
}

.@{prefixCls} {
  background-color: #f7f7f7;
  border-radius: 3px;
  border: @borderStyle;

  &-anim-active {
    transition: height 0.2s ease-out;
  }

  & > &-item {
    border-top: @borderStyle;
    &:first-child {
      border-top: none;
    }

    > .@{prefixCls}-header {
      display: flex;
      align-items: center;
      line-height: 22px;
      padding: 10px 16px;
      color: #666;
      cursor: pointer;
      .arrow {
        display: inline-block;
        content: '\20';
        #arrow > .common();
        #arrow > .right(3px, 4px, #666);
        vertical-align: middle;
        margin-right: 8px;
      }

      .@{prefixCls}-extra {
        margin: 0 16px 0 auto;
      }
    }
  }

  & > &-item-disabled > .@{prefixCls}-header {
    cursor: not-allowed;
    color: #999;
    background-color: #f3f3f3;
  }

  &-content {
    overflow: hidden;
    color: @text-color;
    padding: 0 16px;
    background-color: #fff;

    & > &-box {
      margin-top: 16px;
      margin-bottom: 16px;
    }

    &-inactive {
      display: none;
    }
  }

  &-item:last-child {
    > .@{prefixCls}-content {
      border-radius: 0 0 3px 3px;
    }
  }

  & > &-item-active {
    > .@{prefixCls}-header {
      .arrow {
        position: relative;
        top: 2px;
        #arrow > .bottom(3px, 4px, #666);
        margin-right: 6px;
      }
    }
  }
}
