/* Components */

/* Range Input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #fff, #f0f0f0);
  border-radius: 50%;
  margin-top: -6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  border: none;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(113, 113, 122, 0.5);
}

/* Volume Control - Enhanced */
.volume-track {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  cursor: pointer;
}

.volume-fill {
  position: absolute;
  height: 100%;
  background: #71717a;
  border-radius: 2px;
  transition: width 0.15s ease-out;
}

.volume-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease-out, left 0.15s ease-out;
  cursor: grab;
}

.volume-thumb:hover {
  transform: translate(-50%, -50%) scale(1.2);
}

.volume-thumb:active {
  cursor: grabbing;
}

/* Muted volume - fill gets transparent, thumb changes color */
.volume-track.muted .volume-fill {
  opacity: 0.3;
}

.volume-track.muted .volume-thumb {
  background: #a1a1aa;
  /* zinc-400 - matches muted speaker icon color */
}

/* Play Button Loading Spinner - Centered inside button, replaces icon */
.play-button-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.15);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@media (min-width: 768px) {
  .play-button-spinner {
    width: 28px;
    height: 28px;
  }
}

/* Pulsing Waves Effect - Subtle */
.play-button-waves {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.play-button-waves::before,
.play-button-waves::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: pulse-wave 1.5s ease-out infinite;
  opacity: 0;
}

.play-button-waves::after {
  animation-delay: 0.5s;
}

@keyframes pulse-wave {
  0% {
    transform: scale(1);
    opacity: 0.25;
  }

  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Animated dots for reconnecting state - fixed width to prevent background movement */
.animate-dots {
  display: inline-block;
  width: 1.2em;
  text-align: left;
}

.animate-dots::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: '';
  }

  25% {
    content: '.';
  }

  50% {
    content: '..';
  }

  75%,
  100% {
    content: '...';
  }
}

/* Mobile Menu */
.mobile-menu {
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
}

.mobile-menu.open {
  transform: translateX(0);
}

/* Mini Player */
.mini-player {
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}

.mini-player.visible {
  transform: translateY(0);
}

/* Track Card */
.track-card {
  position: relative;
}

.track-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(113, 113, 122, 0.6), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: inherit;
}

.track-card:hover::before {
  opacity: 1;
}

/* Skeleton Loader */
.skeleton {
  background: linear-gradient(90deg, #27272a 25%, #3f3f46 50%, #27272a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* Ranking Colors - Neutral Shades */
.rank-1 {
  color: #e4e4e7;
}

.rank-2 {
  color: #a1a1aa;
}

.rank-3 {
  color: #71717a;
}

.rank-other {
  color: #52525b;
}

/* Safe Area for iOS */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Footer Focus Override */
footer a:focus,
footer a:focus-visible,
footer button:focus,
footer button:focus-visible,
footer [tabindex]:focus,
footer [tabindex]:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Header Nav Focus Override */
header nav a:focus,
header nav a:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.section-divider {
  position: relative;
  height: 24px;
  color: var(--color-accent);
}

.section-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(to right,
      rgba(228, 228, 231, 0),
      rgba(228, 228, 231, 0.7),
      rgba(228, 228, 231, 0));
  transform: translateY(-50%);
}