/* 悬浮音频播放器样式 */

.floating-audio-player {
  position: fixed;
  right: 20px;
  bottom: 170px;  /* 调整到主题选择器上方 (主题选择器高度约140px + 20px间距) */
  width: 230px;   /* 与主题选择器保持相同宽度 (200px内容 + 30px padding) */
  background: white;
  border-radius: 12px;  /* 与主题选择器保持一致 */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);  /* 与主题选择器保持一致 */
  z-index: 1001;  /* 略高于主题选择器(1000)，但不过高 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 最小化状态 */
.player-minimized {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
}

.mini-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
}

.mini-icon {
  font-size: 24px;
  animation: pulse 2s ease-in-out infinite;
}

.mini-expand-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.mini-expand-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* 完整播放器 */
.player-expanded {
  display: block;
}

/* 头部 */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.player-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.player-icon {
  font-size: 20px;
}

.player-controls-header {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 当前播放信息 */
.current-track {
  padding: 12px 15px;  /* 减小内边距 */
  display: flex;
  align-items: center;
  gap: 10px;  /* 减小间距 */
  background: linear-gradient(to bottom, rgba(102, 126, 234, 0.05) 0%, transparent 100%);
}

.track-cover {
  width: 45px;  /* 减小封面尺寸 */
  height: 45px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;  /* 相应减小图标 */
  flex-shrink: 0;
  animation: rotate 20s linear infinite;
  animation-play-state: paused;
}

.track-cover.playing {
  animation-play-state: running;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.track-details {
  flex: 1;
  min-width: 0;
}

.track-name {
  font-size: 14px;  /* 减小字体 */
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.track-artist {
  font-size: 12px;  /* 减小字体 */
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 进度条 */
.progress-section {
  padding: 0 15px 12px;  /* 减小内边距 */
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 8px;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s;
  position: relative;
}

.progress-handle {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid #667eea;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #999;
}

/* 控制按钮 */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;  /* 减小按钮间距 */
  padding: 12px 15px;  /* 减小内边距 */
  border-top: 1px solid #f0f0f0;
}

.control-btn {
  width: 32px;  /* 减小按钮尺寸 */
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f5f5f5;
  color: #667eea;
  font-size: 14px;  /* 减小图标 */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.control-btn:hover {
  background: #667eea;
  color: white;
  transform: scale(1.1);
}

.control-btn:active {
  transform: scale(0.95);
}

.play-pause-btn {
  width: 42px;  /* 减小播放按钮 */
  height: 42px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 18px;  /* 播放按钮图标 */
}

.play-pause-btn:hover {
  transform: scale(1.15);
}

/* 音量控制 */
.volume-section {
  padding: 0 15px 12px;  /* 减小内边距 */
}

.volume-range {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
}

.volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
}

.volume-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* 播放列表 */
.playlist-section {
  border-top: 1px solid #f0f0f0;
  max-height: 180px;  /* 减小列表高度 */
  overflow-y: auto;
}

.playlist-header {
  padding: 10px 15px;  /* 减小内边距 */
  background: #f8f9fa;
  font-size: 13px;  /* 减小字体 */
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1;
}

.playlist-count {
  color: #999;
  font-size: 12px;  /* 减小字体 */
}

.playlist-item {
  padding: 10px 15px;  /* 减小内边距 */
  display: flex;
  align-items: center;
  gap: 10px;  /* 减小间距 */
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid #f5f5f5;
}

.playlist-item:hover {
  background: #f8f9fa;
}

.playlist-item.active {
  background: rgba(102, 126, 234, 0.1);
  border-left: 3px solid #667eea;
}

.playlist-item-icon {
  font-size: 18px;  /* 减小图标 */
  flex-shrink: 0;
}

.playlist-item-info {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  font-size: 13px;  /* 减小字体 */
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.playlist-item.active .playlist-item-title {
  color: #667eea;
  font-weight: 600;
}

.playlist-item-artist {
  font-size: 11px;  /* 减小字体 */
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-indicator {
  font-size: 14px;  /* 减小图标 */
  color: #667eea;
  display: none;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 滚动条样式 */
.playlist-section::-webkit-scrollbar {
  width: 6px;
}

.playlist-section::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.playlist-section::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 3px;
}

.playlist-section::-webkit-scrollbar-thumb:hover {
  background: #5568d3;
}

/* 响应式 */
@media (max-width: 768px) {
  .floating-audio-player {
    width: calc(100vw - 40px);
    max-width: 230px;  /* 保持与桌面版相同 */
    right: 20px;
    bottom: 170px;  /* 保持在主题选择器上方 */
  }
  
  /* 在移动端如果空间不足，可以调整位置 */
  @media (max-height: 600px) {
    .floating-audio-player {
      bottom: 20px;  /* 小屏幕时放到底部 */
    }
  }
}

/* 拖动效果 */
.floating-audio-player.dragging {
  opacity: 0.8;
  cursor: move;
}
