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

@slider-prefix-cls: ~"@{c7n-prefix}-slider";

.@{slider-prefix-cls} {
  .reset-component;
  position: relative;
  margin: @slider-margin;
  padding: .04rem 0;
  height: .12rem;
  cursor: pointer;

  .vertical();

  &-with-marks {
    margin-bottom: .28rem;
  }

  &-rail {
    position: absolute;
    width: 100%;
    height: .04rem;
    border-radius: .02rem;
    background-color: @slider-rail-background-color;
    transition: background-color .3s;
  }

  &-track {
    position: absolute;
    height: .04rem;
    border-radius: @border-radius-base;
    background-color: @slider-track-background-color;
    transition: background-color 0.3s ease;
  }

  &-handle {
    position: absolute;
    margin-left: -.07rem;
    margin-top: -.05rem;
    width: .14rem;
    height: .14rem;
    cursor: pointer;
    border-radius: 50%;
    border: .02rem @border-style-base @slider-handle-color;
    background-color: @component-background;
    transition: border-color .3s, transform .3s cubic-bezier(0.18, 0.89, 0.32, 1.28);

    &:focus {
      border-color: @slider-handle-color-focus;
      box-shadow: 0 0 0 .05rem @slider-handle-color-focus-shadow;
      outline: none;
    }

    &.@{c7n-prefix}-tooltip-open {
      border-color: @slider-handle-color-tooltip-open;
    }
  }

  &:hover {
    .@{slider-prefix-cls}-rail {
      background-color: @slider-rail-background-color-hover;
    }
    .@{slider-prefix-cls}-track {
      background-color: @slider-track-background-color-hover;
    }
    .@{slider-prefix-cls}-handle:not(.@{c7n-prefix}-tooltip-open) {
      border-color: @slider-handle-color-hover;
    }
  }

  &-mark {
    position: absolute;
    top: .14rem;
    left: 0;
    width: 100%;
    font-size: @font-size-base;
  }

  &-mark-text {
    position: absolute;
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    cursor: pointer;
    color: @text-color-secondary;

    &-active {
      color: @text-color;
    }
  }

  &-step {
    position: absolute;
    width: 100%;
    height: .04rem;
    background: transparent;
  }

  &-dot {
    position: absolute;
    top: -.02rem;
    margin-left: -.04rem;
    width: .08rem;
    height: .08rem;
    border: .02rem @border-style-base @slider-dot-border-color;
    background-color: @component-background;
    cursor: pointer;
    border-radius: 50%;
    vertical-align: middle;
    &:first-child {
      margin-left: -.04rem;
    }
    &:last-child {
      margin-left: -.04rem;
    }
    &-active {
      border-color: @slider-dot-border-color-active;
    }
  }

  &-disabled {
    cursor: not-allowed;

    .@{slider-prefix-cls}-track {
      background-color: @slider-disabled-color !important;
    }

    .@{slider-prefix-cls}-handle,
    .@{slider-prefix-cls}-dot {
      border-color: @slider-disabled-color !important;
      background-color: @component-background;
      cursor: not-allowed;
      box-shadow: none;
    }

    .@{slider-prefix-cls}-mark-text,
    .@{slider-prefix-cls}-dot {
      cursor: not-allowed !important;
    }
  }
}

.vertical() {
  &-vertical {
    width: .12rem;
    height: 100%;
    margin: .06rem .1rem;
    padding: 0 .04rem;

    .@{slider-prefix-cls}-rail {
      height: 100%;
      width: .04rem;
    }

    .@{slider-prefix-cls}-track {
      width: .04rem;
    }

    .@{slider-prefix-cls}-handle {
      margin-left: -.05rem;
      margin-bottom: -.07rem;
    }

    .@{slider-prefix-cls}-mark {
      top: 0;
      left: .12rem;
      width: .18rem;
      height: 100%;
    }

    .@{slider-prefix-cls}-mark-text {
      left: .04rem;
      white-space: nowrap;
    }

    .@{slider-prefix-cls}-step {
      width: .04rem;
      height: 100%;
    }

    .@{slider-prefix-cls}-dot {
      top: auto;
      left: .02rem;
      margin-bottom: -.04rem;
    }
  }
}
