@import '../../style/themes/index';
@import '../../style/mixins/index';

@yee-collapse-prefix-cls: ~'@{yee-prefix}-collapse';

.@{yee-collapse-prefix-cls} {
  .yee-reset-component;

  background-color: @yee-collapse-header-bg;
  border: @yee-border-width-base @yee-border-style-base @yee-border-color-base;
  border-bottom: 0;
  border-radius: @yee-collapse-panel-border-radius;

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

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

    > .@{yee-collapse-prefix-cls}-header {
      position: relative;
      padding: @yee-collapse-header-padding;
      padding-left: @yee-collapse-header-padding-extra;
      color: @yee-heading-color;
      line-height: 22px;
      cursor: pointer;
      transition: all 0.3s;

      .@{yee-collapse-prefix-cls}-arrow {
        .yee-iconfont-mixin();

        position: absolute;
        top: 50%;
        left: @yee-padding-md;
        display: inline-block;
        font-size: @yee-font-size-sm;
        transform: translateY(-50%);

        & svg {
          transition: transform 0.24s;
        }
      }

      .@{yee-collapse-prefix-cls}-extra {
        float: right;
      }

      &:focus {
        outline: none;
      }
    }

    &.@{yee-collapse-prefix-cls}-no-arrow {
      > .@{yee-collapse-prefix-cls}-header {
        padding-left: 12px;
      }
    }
  }

  // Expand Icon right
  &-icon-position-right {
    & > .@{yee-collapse-prefix-cls}-item {
      > .@{yee-collapse-prefix-cls}-header {
        padding: @yee-collapse-header-padding;
        padding-right: @yee-collapse-header-padding-extra;

        .@{yee-collapse-prefix-cls}-arrow {
          right: @yee-padding-md;
          left: auto;
        }
      }
    }
  }

  &-anim-active {
    transition: height 0.2s @yee-ease-out;
  }

  &-content {
    overflow: hidden;
    color: @yee-text-color;
    background-color: @yee-collapse-content-bg;
    border-top: @yee-border-width-base @yee-border-style-base @yee-border-color-base;

    & > &-box {
      padding: @yee-collapse-content-padding;
    }

    &-inactive {
      display: none;
    }
  }

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

  &-borderless {
    background-color: @yee-collapse-header-bg;
    border: 0;
  }

  &-borderless > &-item {
    border-bottom: 1px solid @yee-border-color-base;
  }

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

  &-borderless > &-item > &-content {
    background-color: transparent;
    border-top: 0;
  }

  &-borderless > &-item > &-content > &-content-box {
    padding-top: 4px;
  }

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