
@import "../../scss/theme/config";

.d-tab {
  position: relative;
  &,
  * {
    box-sizing: border-box;
  }
  & > .d-tabs-default {
    display: flex;
    justify-content: space-around;
    position: relative;
    overflow: hidden;
    margin: 0 0 10px 0;
    font-size: 0;

    &[data-length="1"] {
      display: none;
    }

    .d-tabs-wrap {
      vertical-align: middle;
      display: inline-block;
      width: calc(100% - 26px);
      text-align: center;
      overflow: hidden;
      .d-tabs-scroll {
        position: relative;
        display: inline-flex;
        white-space: nowrap;
        transition: left 200ms ease-in-out;
        .d-item {
          display: flex;
          justify-content: center;
          align-items: center;
          position: relative;
          width: 88px;
          height: 40px;
          padding: 12px 9px;
          font-size: 12px;
          font-weight: 600;
          border: 1px solid #e1e1e1;
          background: #fff;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          cursor: pointer;
          transition: border-color 200ms ease-in-out, color 200ms ease-in-out;

          &.d-active {
            padding: 11px 8px;
            border: 2px solid #f44336;
            &:before {
              content: '';
              position: absolute;
              top: 0;
              right: 0;
              width: 0;
              height: 0;
              border-top: 16px solid #f44336;
              border-right: 0;
              border-left: 16px solid transparent;
            }
            &:after {
              content: '';
              position: absolute;
              top: 1px;
              right: 0;
              width: 6px;
              height: 3px;
              border-left: 2px solid #fff;
              border-bottom: 2px solid #fff;
              transform: rotate(-45deg);
            }
          }

          &:not(:last-child) {
            margin: 0 10px 0 0;
          }
        }
      }
    }
    .d-switch {
      width: 21px;
      height: 40px;
      border: 1px solid #e1e1e1;
      background: #fff;
      z-index: 1;
      &:before {
        content: '';
        position: relative;
        top: 50%;
        display: block;
        width: 6px;
        height: 6px;
        margin: 0 auto;
        border-bottom: 1px solid #999;
        border-left: 1px solid #999;
        transform: translateY(-5px) rotate(-45deg);
        transition: transform 200ms linear;
      }

      &.d-active:before {
        transform: translateY(-3px) rotate(135deg);
      }
    }
  }
  & > .d-tabs-container {
    position: absolute;
    top: 50px;
    left: 3px;
    right: 3px;
    max-height: 0;
    padding: 5px;
    font-size: 0;
    transition: max-height 200ms ease-in-out, background-color 200ms ease-in-out;
    overflow: hidden;
    z-index: -1;
    .d-item {
      position: relative;
      display: inline-flex;
      justify-content: center;
      align-items: center;
      width: 88px;
      height: 30px;
      padding: 6px 9px;
      margin: 5px;
      font-size: 12px;
      color: #333;
      line-height: 16px;
      text-align: center;
      border: 1px solid #e1e1e1;
      background: #fff;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      cursor: pointer;
      transition: border-color 200ms ease-in-out, color 200ms ease-in-out;

      &.d-active {
        border-color: #f44336;
        color: #f44336;
      }
    }

    &.d-active {
      max-height: 200px;
      background: #fefefe;
      box-shadow: 0 0 4px 0 rgba(0, 0, 0, .1);
      z-index: 3;
    }
  }
  & > .d-tab-content {
    .d-tab-pane {
      display: none;
      &.d-fade {
        transition: opacity 200ms linear;
      }
      &.d-fade:not(.d-show) {
        opacity: 0;
      }
      &.d-active {
        display: block;
      }
    }
  }
}