// @import './variables.scss';

.#{$namespace}slider {
  margin: $slider-margin;

  &.#{$namespace}show-tooltip {
    margin-top: $slider-show-tooltip-margin-top;
  }

  .#{$namespace}slider-runway {
    position: relative;
    height: $slider-runway-height;
    background-color: $slider-runway-background;
    border-radius: $slider-runway-border-radius;
    cursor: pointer;

    .#{$namespace}slider-activebar {
      border-radius: $slider-runway-activebar-border-radius;
      background-color: $slider-runway-activebar-background-color;
      height: 100%;
      transition: all 0.2s;
    }

    .#{$namespace}slider-mark-text {
      position: absolute;
      top: $slider-mark-text-top;
      height: $slider-mark-text-height;
      line-height: $slider-mark-text-line-height;
      font-size: $slider-mark-text-font-size;
      color: $slider-mark-text-color;
      transform: translateX(-50%);
    }

    .#{$namespace}slider-mark {
      position: absolute;
      width: $slider-mark-diameter;
      height: $slider-mark-diameter;
      background: $slider-mark-background;
      top: $slider-mark-top;
      transform: translateX(-50%);
      line-height: normal;
    }

    .#{$namespace}slider-tooltip {
      position: relative;
      display: inline-block;
      padding: 4px;
      text-overflow: normal;
      white-space: normal;
      font-size: $slider-tooltip-font-size;
      .#{$namespace}slider-tooltip-content-theme-default {
        background-color: $slider-tooltip-default-background;
        box-shadow: $slider-tooltip-default-box-shadow;
        color: $slider-tooltip-default-color;
        border: 1px solid $slider-tooltip-default-background;
        .#{$namespace}slider-tooltip-content-arrow-theme-default {
          border-color: $slider-tooltip-default-background;
        }
      }
      .#{$namespace}slider-tooltip-content-theme-dark {
        background-color: $slider-tooltip-dark-background;
        box-shadow: $slider-tooltip-dark-box-shadow;
        color: $slider-tooltip-dark-color;
        border: 1px solid $slider-tooltip-dark-background;
        .#{$namespace}slider-tooltip-content-arrow-theme-dark {
          border-color: $slider-tooltip-dark-background;
        }
      }

      .#{$namespace}slider-tooltip-content-box {
        position: absolute;
        min-width: 40px;
        height: 22px;
        line-height: 20px;
        padding: 0 6px;
        border-radius: 3px;
        transition: all 0.6s ease, min-width 0.2s;
        text-align: center;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: flex-end;
      }

      .#{$namespace}slider-tooltip-content {
        flex: 1;
        &:after {
          content: '';
          width: 0;
          height: 0;
          display: block;
          border-style: solid;
          position: absolute;
        }

        &:before {
          content: '';
          width: 0;
          height: 0;
          position: absolute;
        }
      }

      .#{$namespace}slider-tooltip-content-top-center {
        left: 50%;
        bottom: 100%;
        transform: translate(-50%, -11px);

        .#{$namespace}slider-tooltip-content-top-center-item::before {
          right: 50%;
          bottom: 0%;
          border-left: 7px solid transparent;
          border-top: 7px solid transparent;
          border-right: 7px solid transparent;
          transform: translate(7px, 7px);
        }

        .#{$namespace}slider-tooltip-content-top-center-item::after {
          right: 50%;
          bottom: 0%;
          border-color: inherit;
          border-left: 6px solid transparent;
          border-top-width: 6px;
          border-right: 6px solid transparent;
          border-bottom: transparent;
          transform: translate(6px, 6px);
        }
      }
    }

    .#{$namespace}slider-btn-wrap {
      height: 36px;
      line-height: 36px;
      position: absolute;
      transform: translateX(-50%);
      background-color: transparent;
      text-align: center;
      user-select: none;
      top: -16px;
      transition: all 0.2s;

      .#{$namespace}slider-btn {
        position: absolute;
        top: 50%;
        transform: translateX(-50%) translateY(-50%);
        transition: all 0.2s;
        background-color: $slider-btn-background-color;
        height: $slider-btn-height;
        width: $slider-btn-width;
        border-radius: $slider-btn-border-radius;
        box-shadow: $slider-btn-box-shadow;
        cursor: pointer;
        &:hover,
        &.#{$namespace}slider-btn-hover {
          transform: $slider-btn-hover-transform;
          cursor: grab;
        }

        &:active {
          cursor: grabbing;
        }
      }
    }
  }

  &.#{$namespace}is-vertical {
    margin: 6px 16px;
    .#{$namespace}slider-runway {
      width: $slider-runway-vertical-height;

      .#{$namespace}slider-mark-text {
        transform : translate(-50%, 50%);
        left: 30px;
        top: auto;
      }
  
      .#{$namespace}slider-mark {
        transform : translate(-50%, 50%);
        left: 30px;
        top: auto;
      }

      .#{$namespace}slider-activebar {
        width: $slider-runway-vertical-height;
        bottom: 0%;
        position: absolute;
      }

      .#{$namespace}slider-tooltip {
        .#{$namespace}slider-tooltip-content-top-center {
          transform: translate(-50%, -12px);
        }
      }
      .#{$namespace}slider-btn-wrap {
        top: auto;
        width: 36px;
        left: -16px;
        transform: translateY(50%);
      }
    }
  }
  // flag: scaleplate-tooltip类没有找到使用场景
  .#{$namespace}scaleplate-tooltip {
    .#{$namespace}tooltip-content-box {
      visibility: visible;
      opacity: 1;
      padding: 0;
      background: $background-color-primary;
      width: 55px;
      border: 0;
      transform: translate(-50%, -16px);

      .#{$namespace}tooltip-content {
        &:before {
          border-top-color: $background-color-primary;
        }
      }
    }
  }

  .#{$namespace}slider-scaleplate {
    height: 24px;
    position: relative;
    width: calc(100% - 164px);
    margin: auto;

    &:before,
    &:after {
      content: '';
      position: absolute;
      top: 6px;
      width: 82px;
      height: 10px;
      background: $slider-scaleplate-pseudo-background;
      border-radius: 0 10px 10px 0;
    }

    &:before {
      left: -82px;
      border-radius: 10px 0 0 10px;
    }

    .#{$namespace}slider-interval,
    .#{$namespace}slider-mini-interval {
      float: left;
      border-right: 1px solid $slider-scaleplate-mini-interval-border-right-color;
    }

    .#{$namespace}slider-interval {
      height: 24px;

      &.#{$namespace}slider-interval-short {
        height: 16px;
      }
    }

    .#{$namespace}slider-mini-interval {
      height: 8px;
      margin-top: 8px;
      border-bottom: 1px solid $slider-scaleplate-mini-interval-border-right-color;

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

    .#{$namespace}slider-wrapper {
      height: 10px;
    }

    .#{$namespace}slider {
      position: absolute;
      height: 10px;
      top: 6px;
      opacity: 0.5;
      margin: 0;
    }

    .#{$namespace}slider-btn {
      height: 20px;
      width: 20px;
      position: absolute;
      top: -12px;
      border-radius: 100%;
      margin-left: -10px;
      z-index: 1;
    }

    .#{$namespace}scale {
      position: absolute;
      width: 100%;
    }

    .#{$namespace}tag-wrapper {
      position: absolute;
      transform: translateX(-50%);
      top: -23px;
    }

    .#{$namespace}tooltip {
      .#{$namespace}tooltip-content-box {
        background: inherit;
        color: currentColor;
      }
    }

    .#{$namespace}tooltip,
    .#{$namespace}slider-label {
      position: absolute;
      transform: translateX(-50%);
      top: 20px;
    }

    .#{$namespace}slider-tooltip {
      top: -32px;
      position: absolute;
      min-width: 55px;
      padding: 0 15px;
      text-align: center;
      border-radius: 2px;
      transform: translateX(-50%);

      &:after {
        position: absolute;
        bottom: -7px;
        left: 50%;
        width: 9px;
        height: 9px;
        content: '';
        margin-left: -2px;
        transform: rotate(45deg) translate(-50%);
        border-radius: 2px;
        background: inherit;
      }
    }
  }
}

.#{$namespace}slider-wrap {
  &.#{$namespace}show-marks {
    padding-bottom: 24px;
  }

  &.#{$namespace}saving {
    .#{$namespace}slider-tooltip {
      .#{$namespace}slider-tooltip-content-box {
        min-width: 60px;

        .#{$namespace}btn-clear {
          width: 12px;
          height: 12px;
          padding: 1px;
          margin-left: 4px;
          border-radius: 50%;
          background: $slider-input-clear-background;
          opacity: 0.8;

          i {
            background: $slider-input-clear-background;
            border-radius: 50%;
            color: $slider-edit-btn-clear-i-color;
            width: 10px;
            height: 10px;
            display: block;

            &:before {
              height: 1px;
            }

            &:after {
              width: 1px;
            }
          }
        }
      }
    }
  }

  &.#{$namespace}slider-with-edit {
    .#{$namespace}edit-button-wrap {
      margin-bottom: 20px;
      width: 50%;
      display: inline-block;
    }

    button {
      margin-right: 10px;
    }
  }
}
