/**
 * Slider - Range slider styles
 * @countermeasure/web-components/primitives/slider
 */

/* ============================================================================
   BASE SLIDER
   ============================================================================ */
.cmm-slider {
  position: relative;
  width: 100%;
  padding: 8px 0;
  touch-action: none;
}

/* Track bar */
.cmm-slider__track {
  position: relative;
  height: 4px;
  background-color: hsl(var(--muted));
  border-radius: 9999px;
  cursor: pointer;
}

/* Filled portion */
.cmm-slider__fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background-color: hsl(var(--primary));
  border-radius: 9999px;
  pointer-events: none;
}

/* Draggable thumb */
.cmm-slider__thumb {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: hsl(var(--primary-foreground));
  border: 2px solid hsl(var(--primary));
  transform: translate(-50%, -50%);
  cursor: grab;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition-fast) ease-in-out,
    transform var(--transition-fast) ease-in-out;
}

.cmm-slider__thumb:active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.15);
}

.cmm-slider__thumb:focus-visible {
  outline: 2px solid hsl(var(--focus-ring));
  outline-offset: 2px;
}

/* ============================================================================
   TOOLTIP
   ============================================================================ */
.cmm-slider__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: hsl(var(--foreground));
  color: hsl(var(--background));
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.75rem;
  line-height: 1rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast) ease-in-out;
}

.cmm-slider__tooltip--visible {
  opacity: 1;
}

/* ============================================================================
   TICKS
   ============================================================================ */
.cmm-slider__ticks {
  position: relative;
  width: 100%;
  height: 8px;
  margin-top: 4px;
}

.cmm-slider__tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 6px;
  background-color: hsl(var(--muted-foreground));
  transform: translateX(-50%);
}

/* ============================================================================
   DISABLED STATE
   ============================================================================ */
.cmm-slider--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.cmm-slider--disabled .cmm-slider__track {
  cursor: not-allowed;
}

.cmm-slider--disabled .cmm-slider__thumb {
  cursor: not-allowed;
}
