@import "../../style/themes/default";
@import "../../style/mixins/index";

@collapse-prefix-cls: ~"@{ant-prefix}-collapse";

@collapse-header-bg: @background-color-base;
@collapse-active-bg: @background-color-active;

.collapse-close() {
  .iconfont-size-under-12px(9px, 0);
}
.collapse-open() {
  .iconfont-size-under-12px(9px, 90deg);
}

.@{collapse-prefix-cls} {
  background-color: @collapse-header-bg;
  border-radius: @border-radius-base;
  border: @border-width-base @border-style-base @border-color-base;
  border-bottom: 0;

  & > &-item {
    border-bottom: @border-width-base @border-style-base @border-color-base;

    &:last-child {
      &,
      & > .@{collapse-prefix-cls}-header {
        border-radius: 0 0 @border-radius-base @border-radius-base;
      }
    }

    > .@{collapse-prefix-cls}-header {
      line-height: 22px;
      padding: 8px 0 8px 32px;
      color: @heading-color;
      cursor: pointer;
      position: relative;
      transition: all .3s;

      .arrow {
        .collapse-close();
        .iconfont-mixin();
        position: absolute;
        color: @text-color-secondary;
        display: inline-block;
        font-weight: bold;
        line-height: 40px;
        vertical-align: top;
        transition: transform 0.24s;
        top: 0;
        left: 16px;
        &:before {
          content: "\E61F";
        }
      }
    }
  }

  &-anim-active {
    transition: height .2s @ease-out;
  }

  &-content {
    overflow: hidden;
    color: @text-color;
    padding: 0 16px;
    background-color: @component-background;

    & > &-box {
      padding-top: 16px;
      padding-bottom: 16px;
    }

    &-inactive {
      display: none;
    }
  }

  &-item:last-child {
    > .@{collapse-prefix-cls}-content {
      border-radius: 0 0 @border-radius-base @border-radius-base;
    }
  }

  & > &-item > &-header[aria-expanded="true"] {
    .arrow {
      .collapse-open();
    }
  }

  &-borderless {
    background-color: @component-background;
    border: 0;
  }

  &-borderless > &-item:last-child,
  &-borderless > &-item:last-child &-header {
    border-radius: 0;
  }

  &-borderless > &-item-active {
    border: 0;
  }

  &-borderless > &-item > &-content {
    background-color: transparent;
    border-top: @border-width-base @border-style-base @border-color-base;
  }

  &-borderless > &-item > &-header {
    transition: all .3s;
    &:hover {
      background-color: @collapse-header-bg;
    }
  }

  & &-item-disabled > &-header {
    &,
    & > .arrow {
      cursor: not-allowed;
      color: @disabled-color;
      background-color: @disabled-bg;
    }
  }

  & > &-item:not(&-item-disabled) > .@{collapse-prefix-cls}-header:active {
    background-color: @collapse-active-bg;
  }
}
