.threshold-field {
  animation: slideIn 0.3s ease-out;
}

.ac-slider-container {
  display: block;
  .slider-wrapper {
    position: relative;
    margin: 1rem 0 0.5rem;
  }

  .slider-tooltip {
    position: absolute;
    top: -35px;
    transform: translateX(-50%);
    padding: 0.375rem 0.75rem;
    background: hsl(217, 71%, 53%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition:
      opacity 0.2s ease,
      left 0.05s ease-out;
    z-index: 10;

    &::after {
      content: "";
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      border: 5px solid transparent;
      border-top-color: hsl(217, 71%, 53%);
    }
  }

  .slider-wrapper:hover .slider-tooltip,
  .slider:focus ~ .slider-tooltip,
  .slider:active ~ .slider-tooltip {
    opacity: 1;
  }

  .slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 6px;
    background: hsl(0, 0%, 96%);
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;

    background: linear-gradient(
      to right,
      hsl(217, 71%, 53%) 0%,
      hsl(217, 71%, 53%) calc((var(--value) - var(--min)) / (var(--max) - var(--min)) * 100%),
      hsl(0, 0%, 96%) calc((var(--value) - var(--min)) / (var(--max) - var(--min)) * 100%),
      hsl(0, 0%, 96%) 100%
    );

    &:hover {
      transform: scaleY(1.1);
    }

    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    // Chrome, Safari, Edge, Opera
    &::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: white;
      cursor: pointer;
      border: 3px solid hsl(217, 71%, 53%);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

      &:hover {
        transform: scale(1.2);
        box-shadow: 0 4px 12px rgba(72, 95, 199, 0.4);
        border-width: 4px;
      }

      &:active {
        transform: scale(1.1);
        animation: pulse 0.3s ease;
      }
    }

    // Firefox
    &::-moz-range-thumb {
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: white;
      cursor: pointer;
      border: 3px solid hsl(217, 71%, 53%);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

      &:hover {
        transform: scale(1.2);
        box-shadow: 0 4px 12px rgba(72, 95, 199, 0.4);
        border-width: 4px;
      }

      &:active {
        transform: scale(1.1);
        animation: pulse 0.3s ease;
      }
    }

    // Firefox track
    &::-moz-range-track {
      background: transparent;
      border: none;
    }

    // Focus state with primary color
    &:focus {
      outline: none;

      &::-webkit-slider-thumb {
        box-shadow: 0 0 0 4px hsla(217, 71%, 53%, 0.25);
        border-color: hsl(217, 71%, 45%);
      }

      &::-moz-range-thumb {
        box-shadow: 0 0 0 4px hsla(217, 71%, 53%, 0.25);
        border-color: hsl(217, 71%, 45%);
      }
    }
  }
}

// Responsive adjustments
@media (max-width: 768px) {
  .slider {
    height: 10px;

    &::-webkit-slider-thumb,
    &::-moz-range-thumb {
      width: 24px;
      height: 24px;
    }
  }

  .slider-tooltip {
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
  }
}
