/* RangeSlider Component Styles */
/* Follows the MPLADS dashboard design system */

.range-slider {
  width: 100%;
  margin: 1rem 0;
}

.range-slider--disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* Label styling */
.range-slider__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #4a5568;
  margin-bottom: 0.5rem;
  display: block;
}

/* Value display */
.range-slider__values {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #1a1a1a;
  font-weight: 500;
}

.range-slider__value {
  background: #f7fafc;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
  min-width: 60px;
  text-align: center;
  transition: all 0.2s ease;
}

.range-slider__value--min {
  color: #2c5282;
}

.range-slider__value--max {
  color: #2c5282;
}

.range-slider__separator {
  color: #718096;
  font-weight: 400;
}

/* Main slider container */
.range-slider__container {
  position: relative;
  height: 48px;
  width: 100%;
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px 0;
}

/* Track background */
.range-slider__track-bg {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  transform: translateY(-50%);
  transition: background-color 0.2s ease;
}

/* Active track */
.range-slider__track-active {
  position: absolute;
  top: 50%;
  height: 6px;
  background: linear-gradient(90deg, #2c5282 0%, #3182ce 100%);
  border-radius: 3px;
  transform: translateY(-50%);
  transition: all 0.2s ease;
}

/* Slider handles */
.range-slider__handle {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  cursor: grab;
  z-index: 10;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.range-slider__handle:focus {
  outline: none;
}

.range-slider__handle:focus-visible {
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.3);
  border-radius: 50%;
}

.range-slider__handle--focused {
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.3);
  border-radius: 50%;
}

.range-slider__handle--dragging {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.1);
}

.range-slider__handle--dragging .range-slider__handle-inner {
  box-shadow: 0 4px 12px rgba(44, 82, 130, 0.4);
}

/* Handle inner circle */
.range-slider__handle-inner {
  width: 100%;
  height: 100%;
  background: white;
  border: 3px solid #2c5282;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.range-slider__handle:hover .range-slider__handle-inner {
  border-color: #3182ce;
  box-shadow: 0 3px 8px rgba(44, 82, 130, 0.25);
  transform: scale(1.05);
}

.range-slider__handle:active .range-slider__handle-inner {
  border-color: #2c5282;
  box-shadow: 0 2px 4px rgba(44, 82, 130, 0.3);
}

/* Handle positioning fine-tuning */
.range-slider__handle--min {
  z-index: 11; /* Slightly higher than max handle to prevent visual conflicts */
}

.range-slider__handle--max {
  z-index: 10;
}

/* Screen reader instructions (visually hidden) */
.range-slider__sr-instructions {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Hover states for track */
.range-slider__container:hover .range-slider__track-bg {
  background: #cbd5e0;
}

.range-slider__container:hover .range-slider__track-active {
  background: linear-gradient(90deg, #3182ce 0%, #4299e1 100%);
}

/* Mobile and touch device optimizations */
@media (max-width: 768px) {
  .range-slider__container {
    height: 56px;
    padding: 16px 0;
  }

  .range-slider__handle {
    width: 32px;
    height: 32px;
  }

  .range-slider__track-bg,
  .range-slider__track-active {
    height: 8px;
  }

  .range-slider__values {
    margin-bottom: 1.25rem;
  }

  .range-slider__value {
    padding: 0.5rem 1rem;
    min-width: 70px;
    font-size: 0.9375rem;
  }
}

/* Touch-specific styles for devices with coarse pointer */
@media (pointer: coarse) {
  .range-slider__handle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .range-slider__container {
    height: 64px;
    padding: 20px 0;
  }

  .range-slider__track-bg,
  .range-slider__track-active {
    height: 10px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .range-slider__track-bg {
    background: #000;
    border: 1px solid #fff;
  }

  .range-slider__track-active {
    background: #0066cc;
  }

  .range-slider__handle-inner {
    border-width: 2px;
    border-color: #000;
  }

  .range-slider__handle--focused,
  .range-slider__handle:focus-visible {
    box-shadow: 0 0 0 3px #000, 0 0 0 6px #fff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .range-slider__handle,
  .range-slider__handle-inner,
  .range-slider__track-bg,
  .range-slider__track-active,
  .range-slider__value {
    transition: none;
  }
}

/* Dark mode removed; enforce single light theme */

/* Animation keyframes for smooth interactions */
@keyframes handlePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(44, 82, 130, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(44, 82, 130, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(44, 82, 130, 0);
  }
}

/* Pulse animation for handle interaction feedback */
.range-slider__handle:active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: handlePulse 0.4s ease-out;
  pointer-events: none;
}

/* Ultra-small devices */
@media (max-width: 360px) {
  .range-slider__values {
    flex-direction: column;
    gap: 0.25rem;
    align-items: stretch;
  }

  .range-slider__separator {
    display: none;
  }

  .range-slider__value {
    text-align: center;
  }
}

/* Print styles */
@media print {
  .range-slider {
    break-inside: avoid;
  }

  .range-slider__handle {
    display: none;
  }

  .range-slider__container::after {
    content: 'Range: ' attr(data-min) ' - ' attr(data-max);
    display: block;
    text-align: center;
    font-size: 0.875rem;
    color: #000;
  }
}