@use "sass:math";

.tr-range-input {
  width: 100%;
}

.tr-range-selected {
  display: block;
  margin-bottom: 3px;
  color: #32373c;
  font-size: 1rem;
}

.tr-range-labels {
  display: flex;
  margin-top: 1px;
  color: #666666;
  font-size: .8rem;
  flex-grow: 1;
  min-width: 0;

  div {
    flex: 1;
  }

  div:last-child {
    margin-left: auto;
    text-align: right;
  }
}

// Styling Cross-Browser Compatible Range Inputs with Sass
// Github: https://github.com/darlanrod/input-range-sass
// Author: Darlan Rod https://github.com/darlanrod
// Version 1.5.2
// MIT License

$track-color: #d7dade !default;
$track-color-progress: var(--tr-profile-color,#00669b) !default;
$thumb-color: #607d8b !default;

$thumb-radius: 10px !default;
$thumb-height: 20px !default;
$thumb-width: 20px !default;
$thumb-shadow-size: 4px !default;
$thumb-shadow-blur: 4px !default;
$thumb-shadow-color: rgba(0, 0, 0, .2) !default;
$thumb-border-width: 1px !default;
$thumb-border-color: #eceff1 !default;

$track-width: 100% !default;
$track-height: 4px !default;
$track-shadow-size: 1px !default;
$track-shadow-blur: 1px !default;
$track-shadow-color: rgba(0, 0, 0, .2) !default;
$track-border-width: 0px !default;
$track-border-color: #cfd8dc !default;

$track-radius: 0px !default;
$contrast: 5% !default;

$ie-bottom-track-color: darken($track-color, $contrast) !default;

@mixin shadow($shadow-size, $shadow-blur, $shadow-color) {
  box-shadow: $shadow-size $shadow-size $shadow-blur $shadow-color, 0 0 $shadow-size lighten($shadow-color, 5%);
}

@mixin track {
  cursor: default;
  height: $track-height;
  transition: all .2s ease;
  width: $track-width;
}

@mixin thumb {
  // @include shadow($thumb-shadow-size, $thumb-shadow-blur, $thumb-shadow-color);
  background: #fff;
  border: $thumb-border-width solid var(--tr-profile-color,#00669b);
  border-radius: $thumb-radius;
  box-sizing: border-box;
  cursor: default;
  height: $thumb-height;
  width: $thumb-width;
}

[type='range'] {
  -webkit-appearance: none;
  background: transparent;
  margin:  math.div( $thumb-height, 2) 0;
  width: $track-width;
  cursor: pointer;

  &::-moz-focus-outer {
    border: 0;
  }

  &:focus {
    outline: 0;

    &::-webkit-slider-runnable-track {
      background: $track-color;
    }

    &::-ms-fill-lower {
      background: $track-color-progress;
    }

    &::-ms-fill-upper {
      background: $track-color;
    }
  }

  &::-webkit-slider-runnable-track {
    @include track;
    // @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    background: $track-color;
    border: $track-border-width solid $track-border-color;
    border-radius: $track-radius;
  }

  &::-webkit-slider-thumb {
    @include thumb;
    -webkit-appearance: none;
    margin-top: math.div($track-height, 2) - math.div($thumb-height, 2) + 1;
  }

  &::-moz-range-track {
    // @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    @include track;
    background: $track-color;
    border: $track-border-width solid $track-border-color;
    border-radius: $track-radius;
    height: math.div($track-height, 2);
  }

  &::-moz-range-thumb {
    @include thumb;
  }

  &::-ms-track {
    @include track;
    background: transparent;
    border-color: transparent;
    border-width: math.div($thumb-height, 2) 0;
    color: transparent;
  }

  &::-ms-fill-lower {
    // @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    background: $track-color-progress;
    border: none;
    border-radius: ($track-radius * 2);
  }

  &::-ms-fill-upper {
    // @include shadow($track-shadow-size, $track-shadow-blur, $track-shadow-color);
    background: $track-color;
    border: none;
    border-radius: ($track-radius * 2);
  }

  &::-moz-range-progress {
    background-color: $track-color-progress;
  }

  &::-ms-thumb {
    @include thumb;
    margin-top: math.div($track-height, 4);
  }

  ::-ms-ticks-after {
    display: none;
  }

  ::-ms-ticks-before {
    display: none;
  }

  &:disabled {
    &::-webkit-slider-thumb,
    &::-moz-range-thumb,
    &::-ms-thumb,
    &::-webkit-slider-runnable-track,
    &::-ms-fill-lower,
    &::-ms-fill-upper {
      cursor: not-allowed;
    }
  }
}