@import '../../styles/common/colors';
@import '../../styles/common/mixins';
@import '../../styles/common/screen';
@import '../../styles/common/functions';

.panel-group {

  > .panel {
    background: $white;
    border-bottom: 1px solid $neutral-3;

    .panel-header {
      box-sizing: border-box;
      cursor: pointer;
      font-size: 14px;
      font-weight: 200;
      padding: 12px 15px;
      position: relative;
      user-select: none;

      .title-group {
        @include vertical-align('block');
        user-select: none;

        h4 {
          color: $neutral-4;
          margin: 0;
          padding-right: 30px;
          position: relative;
          top: 1px;
          transition: all .25s ease;
        }

        .context-icon {
          position: relative;
          top: 2px;
        }

        svg {
          fill: $neutral-4;
          transition: fill .25s ease;
        }

        .context-icon + h4,
        .context-node + h4 {
          margin-left: 10px;
        }
      }

      .toggle-icon {
        opacity: 0;
        position: absolute;
        right: 15px;
        top: 13px;
        transform: rotate(-135deg);
      }

    }

    .panel-content {
      display: none;
      padding: 0 40px 15px;
    }

    &:last-child {
      border-bottom: none;
    }
  }

  > .panel.panel-active {
    > .panel-content {
      display: block;
    }

    .toggle-icon {
      opacity: 1;
      top: 15px;
      transform: rotate(0);
    }
  }
}

// Default Theme
.panel-group.default {

  .panel-header {
    .context-icon {
      transition: all .25s ease;
    }

    .toggle-icon {
      transition: all .25s ease;
    }

    &:hover {
      .title-group {
        h4 {
          color: $primary-5;
        }
        svg {
          fill: $primary-5;
        }
      }
      .toggle-icon {
        opacity: 1;
      }
    }
  }

  > .panel-active {
    .title-group {
      h4 {
        color: $primary-5;
      }
      svg {
        fill: $primary-5;
      }
    }
  }
}

// Multi-step Theme
.panel-group.multi-step {

  > .panel {
    background-color: $white;
    border-bottom: 0;
    border-radius: 3px;
    margin-bottom: 10px;

    > .panel-header {
      background-color: $neutral-2;
      border-radius: 3px 3px 0 0;
      padding: 13px 20px;

      [class^='badge'] {
        border: none;
        border-radius: 50%;
        font-size: 14px;
        height: 20px;
        min-width: 20px;
        width: 20px;
      }

      h4 {
        font-size: 16px;
        position: relative;
        top: 1px;
      }

      svg {
        fill: $neutral-4;
      }

      svg + h4,
      .context-node + h4 {
        margin-left: 20px;
      }

      .toggle-icon {
        opacity: 1;
        top: calc(50% - 9px);
        transform: rotate(0);
      }

      &:hover {
        .title-group {
          h4 {
            color: $primary-5;
          }
          svg {
            fill: $primary-5;
          }
        }
        .toggle-icon {
          opacity: 1;
        }
      }

      @media #{$media-small-minus} {
        padding: 13px;
      }
    }

    .panel-content {
      padding: 0;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }

  > .panel.panel-active {

      > .panel-header {
        background-color: $primary-1;

        [class^='badge'] {
          background-color: $primary-2;
        }

        .title-group {
          h4 {
            color: $white;
          }
        }

        .toggle-icon {
          top: calc(50% - 15px);
          transform: rotate(180deg);

          svg {
            fill: $white;
          }
        }
      }

      .panel-content {
        padding: 20px;
      }
    }

}

// Simple Theme
.panel-group.simple {

  > .panel {
    background: transparent;
    border-bottom: 0;

    > .panel-header {
      padding: 15px 0;

      h4 {
        color: $primary-1;
        font-size: 18px;
      }

      svg {
        fill: $primary-1;
      }

      .toggle-icon {
        display: none;
      }
    }

    > .panel-content {
      padding: 0;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }

  > .panel.panel-active {
    .panel-header {
      .context-icon {
        left: -2px;
        top: 0;
        transform: rotate(90deg);
      }
    }
    > .panel-content {
      padding: 0 0 15px;
    }
  }

}
