@import "./var";

.#{$prefix}slider {
  min-height: $form-height;
  display: table;
  display: flex;
  padding-bottom:10px;
  align-items: center;
  color:$color-text;
  &__content {
    position: relative;
    height: $slider-height;
    padding:10px 0;
    box-sizing: initial;
    flex: 1;
    //padding:0 5px;
    border-left:5px solid transparent;
    border-right:5px solid transparent;
    float: left\9;
    cursor: pointer;
  }
  &__bar {
    height: $slider-height;
    background-color: $slider-base-color-bg;
    position: absolute;
    left:-5px;
    right:-5px;

  }
  &__track {
    width: auto;
    height: $slider-height;
    background-color: $slider-track-color-bg;
    position: absolute;
  }
  // &__scale {
  //   width: 100%;
  //   position: absolute;
  //   left: 0;
  //   top: 6px;
  //   z-index: 2;
  // }
  &__dot {
    width: 8px;
    height: 8px;
    border-radius: 100%;
    background-color:$slider-track-color-bg ;
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -4px;
    &:last-of-type {
      margin-left: -1px;
    }
  }
  &__disabled{
    width: auto;
    height: $slider-height;
    padding:10px 0;
    position: absolute;
    cursor: not-allowed;
    margin-top: -10px;
    box-sizing: content-box;
    &::after{
      content:'';
      display: block;
      width:100%;
      height: $slider-height;
      // height: 100%;
      background-color:$slider-base-color-bg;
    }
  }
  &__mark {
    position: absolute;
    left: 0px;
    right:0px;
    top: 10px;
  }
  &__text {
    position: absolute;
    left: 0;
    top: $slider-height;
    padding-top:14px - $slider-height;
    font-size: $slider-font-size;
    color: $slider-color-text;
    white-space: nowrap;
    transform: translateX(-50%);
    &:after{
      content:"";
      display: inline-block;
      width: 1px;
      height: 5px;
      background-color: $slider-base-color-bg;
      position: absolute;
      left: 50%;
      top: $slider-height-top;
    }
  }
  &__handle {
    width:$slider-handle-width;
    height:$slider-handle-height;

    display: inline-block;
    position: absolute;
    z-index: 3;
    top: 10px - ($slider-handle-height - $slider-height)/2;
    left: 0;
    font-size: 0;
    cursor: pointer;
    margin-left:-($slider-handle-width/2);

  }
  &__handle-inner{
    border-radius: 100%;
    background-color: $slider-handle-color-bg;
    border: $slider-handle-width-border solid $slider-handle-color-border;
    display: inline-block;
    position: absolute;
    top:0;
    right:0;
    bottom:0;
    left:0;
    z-index: auto;
    &.is-active:after{
      content         : "";
      position        : absolute;
      width           : $slider-handle-width + 6px;
      height          : $slider-handle-height + 6px;
      display         : inline-block;
      background-color: $slider-handle-color-border;
      opacity         : 0.2;
      left            : -5px;
      top             : -5px;
      border-radius   : 100%;
      z-index         : -1;
    }
  }

  &__extend {
    position: relative;
    // flex:0;
    flex: none;
    white-space: nowrap;
    padding: 0 0 0 15px;
    display: inline-block\9;
    vertical-align: middle\9;
  }

  &:hover{
    .#{$prefix}slider__bar {
      background-color:$slider-base-color-bg-hover;
    }
  }

  &--vertical{
    display: inline-flex;
    height: 200px;
    min-width: 30px;
    padding-bottom: 0;
    flex-direction: column;
    padding-right: 24px;
    box-sizing: content-box;

    .#{$prefix}slider__content{
      width: 4px;
      padding: 0;
      border:none;
      border-top: 5px solid transparent;
      border-bottom: 5px solid transparent;
    }
    .#{$prefix}slider__bar{
      height: auto;
      top:-5px;
      bottom:-5px;
      left:0;
      right:0;
      width: 4px;
    }
    .#{$prefix}slider__track{
      height: 0;
      width: 100%;
      bottom:0;
    }
    .#{$prefix}slider__handle{
      top:auto;
      bottom:0;
      left: -7px;
      margin-left: 0;
      margin-bottom: -9px;

    }
    .#{$prefix}slider__mark{
      top:0;
      bottom:0;
      left:10px;
    }
    .#{$prefix}slider__text{
      left: -6px;
      top:auto;
      bottom:0;
      transform: translateY(50%);
      padding-top: 0;
      padding-left: 14px;
      &::after{
        width:5px;
        height: 1px;
        left: 0;
        top:50%;
      }
    }
    .#{$prefix}slider__extend{
      margin-top: 8px;
    }
  }

  &--time{
    .#{$prefix}slider__track{
      padding:10px 0;
      margin-top: -10px;
      box-sizing: content-box;
      background-color: transparent;
      &::after{
        content:'';
        display: block;
        width:100%;
        height: $slider-height;
        // height: 100%;
        background-color:$slider-track-color-bg;
      }
    }
    .#{$prefix}slider__dot{
      padding:10px 0;
      margin-top: -14px;
      box-sizing: content-box;
      background-color: transparent;
      &::after{
        content:'';
        display: block;
        width:8px;
        height: 8px;
        border-radius: 100%;

        background-color:$slider-track-color-bg;
      }
      &:hover::after{
        width:10px;
        height:10px;
        margin:-1px 0 0 -1px;
        background-color: #fff;
        border:2px solid $slider-track-color-bg;
      }
    }
    .#{$prefix}slider__text{
      padding-top: 0;
      margin-top: 10px;
      &::after{
        top:-10px;
      }
      &:first-child{
        transform:translateX(0);
        &::after{
          left:0;
        }
      }
      &:last-child{
        transform:translateX(-100%);
        &::after{
          left:100%;
        }
      }
    }
  }

  &.is-disabled{
    cursor:not-allowed;
    .#{$prefix}slider__content{
      cursor:not-allowed
    }
    .#{$prefix}slider__track{
      background-color: $slider-track-color-bg-disabled;
    }
    .#{$prefix}slider__handle{
      cursor:not-allowed;
    }
    .#{$prefix}slider__handle-inner{
      border: $slider-handle-width-border solid $slider-handle-color-bg-disabled;
    }
    &:hover{
      .#{$prefix}slider__bar {
        background-color:$slider-base-color-bg-disabled;
      }
      .#{$prefix}slider__handle-inner:after{
        display: none;
      }
    }
  }
  &--time.is-disabled{
    .#{$prefix}slider__track{
      background-color:transparent;
      &::after{
        background-color: $slider-track-color-bg-disabled;
      }
    }
    .#{$prefix}slider__dot{
      &::after{
        background-color: $slider-track-color-bg-disabled;
      }
      &:hover::after{
        margin:0;
        width: 8px;
        height: 8px;
        background-color: $slider-track-color-bg-disabled;
        border-color: $slider-track-color-bg-disabled;;
      }
    }
  }
}
