* {
  box-sizing: border-box;
}

:host {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;

  color: var(--element-neutral-color, #1a1a1a);
}

:host([hugcontainer]) {
  margin-left: -12px;
  margin-right: -12px;
}

.wrapper {
  flex: 1;
  height: 48px;
  position: relative;
}


.slider {
  position: absolute;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0;
  background: none;
}

.slider::-webkit-slider-container {
  position: absolute;
  margin: auto 0;
  inset: 0;
  width: 100%;
  height: 4px;
  border-radius: 6px;
  background: none;
}

.track {
  position: absolute;
  -webkit-appearance: none;
  appearance: none;
  margin: auto 0;
  padding: 0;
  inset: 0;
  width: 100%;
  height: 4px;
  border-radius: 6px;
  background: var(--border-outline-color);
}

.interactive-track {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  height: 4px;
  border-radius: 6px;
  width: calc(var(--ratio) * 100% + (1 - 2 * var(--ratio)) * 12px);
  margin-top: auto;
  margin-bottom: auto;
  border: 1px solid var(--indent-enabled-border-color);
  background: var(--selected-enabled-background-color);
}

.no-input .interactive-track {
  width: calc(var(--ratio) * 100% + (1 - 2 * var(--ratio)) * 4px);
}


/* used in non-interactive mode */
.passive-thumb {
  position: absolute;
  width: 16px;
  height: 16px;
  top: 16px;
  left: calc(var(--ratio) * 100% - 8px + (1 - 2 * var(--ratio)) * 4px);
  border-radius: 100%;
  border-width: 4px;
  border-style: solid;
  border-color: var(--container-background-color);
  background: var(--selected-enabled-background-color);
}

.wrapper:hover .interactive-track {
  background: var(--selected-hover-background-color);
}

.wrapper:active .interactive-track {
  background: var(--selected-pressed-background-color);
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 100%;
  background: var(--selected-enabled-background-color);
  cursor: pointer;
}

.slider {
  cursor: pointer;


  &:focus {
    outline: none;
  }

  &::-webkit-slider-thumb {
    border-color: var(--selected-enabled-border-color);
    background-color: var(--selected-enabled-background-color);
    border-width: 1px;
    border-style: solid;
    cursor: pointer;
  }

  &:focus-visible::-webkit-slider-thumb{
    outline-color: hsla(211, 100%, 44%, 0.3);
    outline-width: 4px;
    outline-style: solid;
  }

  &:hover::-webkit-slider-thumb, &:hover + .interactive-track{
    border-color: var(--selected-hover-border-color);
    background-color: var(--selected-hover-background-color);
  }

  &:active::-webkit-slider-thumb {
    border-color: var(--selected-pressed-border-color);
    background-color: var(--selected-pressed-background-color);
  }

  &:disabled::-webkit-slider-thumb {
    border-color: var(--selected-disabled-border-color);
    background-color: var(--selected-disabled-background-color);
    cursor: not-allowed;
    color: var(--on-selected-disabled-color);
  }
}