/**
 * iOS风格滑动条美化
 * 为设置页面中的所有滑动条提供更现代、更美观的iOS风格UI设计
 */

/* 滑动条容器样式 */
.ios-settings-control {
  position: relative;
  padding: 5px 0;
}

/* 滑动条数值显示 */
.ios-settings-control .text-center {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary-color);
  margin-top: 5px;
  transition: all 0.2s ease;
}

/* 基础滑动条样式 */
.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  background: transparent;
  outline: none;
  margin: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
}

/* 滑动条轨道 - Webkit浏览器 */
.form-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* 滑动条轨道 - Firefox浏览器 */
.form-range::-moz-range-track {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* 深色模式下的滑动条轨道 */
.dark-mode .form-range::-webkit-slider-runnable-track {
  background: rgba(255, 255, 255, 0.15);
}

.dark-mode .form-range::-moz-range-track {
  background: rgba(255, 255, 255, 0.15);
}

/* 滑动条滑块 - Webkit浏览器 */
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: none;
  margin-top: -7px; /* (thumb height - track height) / 2 */
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  position: relative;
  z-index: 2;
}

/* 滑动条滑块 - Firefox浏览器 */
.form-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  position: relative;
  z-index: 2;
}

/* 深色模式下的滑动条滑块 */
.dark-mode .form-range::-webkit-slider-thumb {
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

.dark-mode .form-range::-moz-range-thumb {
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

/* 滑动条悬停效果 */
.form-range:hover::-webkit-slider-thumb {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.3);
}

.form-range:hover::-moz-range-thumb {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.3);
}

/* 滑动条激活效果 */
.form-range:active::-webkit-slider-thumb {
  transform: scale(1.2);
  background: var(--primary-color);
  box-shadow: 0 3px 10px rgba(var(--primary-color-rgb), 0.4);
}

.form-range:active::-moz-range-thumb {
  transform: scale(1.2);
  background: var(--primary-color);
  box-shadow: 0 3px 10px rgba(var(--primary-color-rgb), 0.4);
}

/* 滑动条进度条效果 */
.ios-settings-control {
  --slider-value: 0%; /* 默认值，将通过JS动态更新 */
}

.ios-settings-control::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  width: var(--slider-value);
  background: var(--primary-color);
  border-radius: 2px;
  z-index: 1;
  pointer-events: none;
  transition: width 0.1s ease;
}

/* 禁用状态样式 */
.form-range:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-range:disabled::-webkit-slider-thumb {
  background: #ccc;
  box-shadow: none;
  transform: none;
}

.form-range:disabled::-moz-range-thumb {
  background: #ccc;
  box-shadow: none;
  transform: none;
}

.dark-mode .form-range:disabled::-webkit-slider-thumb {
  background: #555;
}

.dark-mode .form-range:disabled::-moz-range-thumb {
  background: #555;
}

/* 相机对焦环效果 */
.form-range:active::-webkit-slider-thumb::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  transform: translate(-50%, -50%);
  animation: focus-ring 1.5s ease-out infinite;
  z-index: -1;
}

@keyframes focus-ring {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.7;
  }
  70% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .ios-settings-control .text-center {
    font-size: 0.8rem;
  }
  
  .form-range::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    margin-top: -6px;
  }
  
  .form-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
  }
}
