/* 音乐播放器样式 */
.music-player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-bg, #fff);
  border-top: 1px solid var(--color-border, #e1e4e8);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  height: 80px; /* 默认高度 */
  box-sizing: border-box;
}

.music-player-bar.active {
  transform: translateY(0);
}

/* 关闭按钮在最右边 */
.player-close-btn {
  margin-left: auto;
}

.player-cover {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

/* 歌曲信息和歌词组合区域 */
.player-info-section {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.player-info {
  min-width: 0;
}

.player-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #24292e);
  margin-bottom: 4px;
  white-space: nowrap;
}

.player-artist {
  font-size: 12px;
  color: var(--color-text-secondary, #586069);
  white-space: nowrap;
}

/* 歌词显示区域 */
.player-lyrics {
  flex: 2;
  min-width: 150px;
  max-width: 300px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  position: relative;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--color-border, #e1e4e8);
}

.player-lyrics-text {
  font-size: 13px;
  color: var(--color-text-secondary, #586069);
  text-align: left;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  display: inline-block;
}

.player-lyrics-text.show {
  opacity: 1;
  transform: translateY(0);
}

.player-lyrics-text.hide {
  opacity: 0;
  transform: translateY(-10px);
}

.player-lyrics-text.scroll {
  animation: lyricsScroll 8s linear infinite;
}

@keyframes lyricsScroll {
  0% { transform: translateX(0); }
  10% { transform: translateX(0); }
  90% { transform: translateX(calc(-100% + var(--container-width, 300px)))); }
  100% { transform: translateX(calc(-100% + var(--container-width, 300px)))); }
}

.player-progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.player-time {
  font-size: 11px;
  color: var(--color-text-secondary, #586069);
  font-family: monospace;
  min-width: 40px;
  text-align: center;
}

.player-progress {
  flex: 1;
  height: 4px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border, #e1e4e8);
  border-radius: 2px;
  outline: none;
}

.player-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--color-primary, #0366d6);
  border-radius: 50%;
  cursor: pointer;
  margin-top: -4px;
  vertical-align: middle;
}

.player-progress::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--color-primary, #0366d6);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.player-progress::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--color-border, #e1e4e8);
  border-radius: 2px;
}

.player-progress::-moz-range-track {
  height: 4px;
  background: var(--color-border, #e1e4e8);
  border-radius: 2px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-btn {
  background: transparent;
  border: none;
  color: var(--color-text, #24292e);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.player-btn:hover {
  background: var(--color-bg-secondary, #f6f8fa);
}

.player-speed {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-secondary, #586069);
}

.player-speed select {
  padding: 4px 8px;
  border: 1px solid var(--color-border, #d1d5da);
  border-radius: 4px;
  font-size: 12px;
  background: var(--color-bg, #fff);
  color: var(--color-text, #24292e);
  cursor: pointer;
  outline: none;
  min-width: 60px;
}

.player-speed select:hover {
  border-color: var(--color-primary, #0366d6);
}

.player-speed select:focus {
  border-color: var(--color-primary, #0366d6);
  box-shadow: 0 0 0 2px rgba(3, 102, 214, 0.2);
}

/* 响应式设计 - 自适应布局 */
@media (max-width: 1200px) {
  .music-player-bar {
    padding: 6px 10px;
    gap: 6px;
    height: auto;
    min-height: 55px;
    flex-wrap: nowrap;
  }
  
  .player-cover {
    width: 36px;
    height: 36px;
  }
  
  .player-info-section {
    gap: 8px;
    flex: 0 0 auto;
    min-width: 120px;
  }
  
  .player-info {
    min-width: 100px;
  }
  
  .player-title {
    font-size: 12px;
  }
  
  .player-artist {
    font-size: 10px;
  }
  
  .player-lyrics {
    flex: 1 1 auto;
    min-width: 80px;
    max-width: 200px;
    height: 32px;
    font-size: 11px;
  }
  
  .player-progress-container {
    flex: 0 1 auto;
    min-width: 80px;
    gap: 4px;
  }
  
  .player-controls {
    flex: 0 0 auto;
    gap: 4px;
  }
  
  .player-btn {
    padding: 4px;
    flex-shrink: 0;
  }
  
  .player-btn svg {
    width: 14px;
    height: 14px;
  }
  
  .player-speed {
    font-size: 10px;
    flex-shrink: 0;
  }
  
  .player-speed select {
    min-width: 50px;
    padding: 2px 4px;
  }
  
  .player-volume {
    width: 70px;
    flex: 0 0 70px;
    gap: 2px;
  }
  
  .player-volume input[type="range"] {
    width: 45px;
  }
}

@media (max-width: 900px) {
  .music-player-bar {
    padding: 4px 8px;
    gap: 4px;
    min-height: 50px;
  }
  
  .player-cover {
    width: 32px;
    height: 32px;
  }
  
  .player-info-section {
    gap: 6px;
    flex: 0 0 auto;
    min-width: 100px;
  }
  
  .player-info {
    min-width: 80px;
  }
  
  .player-title {
    font-size: 11px;
  }
  
  .player-artist {
    font-size: 9px;
  }
  
  .player-lyrics {
    display: none; /* 小屏幕隐藏歌词 */
  }
  
  .player-progress-container {
    flex: 0 1 auto;
    min-width: 50px;
    gap: 2px;
  }
  
  .player-time {
    font-size: 9px;
    min-width: 32px;
  }
  
  .player-controls {
    gap: 2px;
    flex: 0 0 auto;
  }
  
  .player-btn {
    padding: 3px;
  }
  
  .player-btn svg {
    width: 12px;
    height: 12px;
  }
  
  .player-speed {
    display: none; /* 小屏幕隐藏倍速选择 */
  }
  
  .player-volume {
    width: 55px;
    flex: 0 0 55px;
    gap: 2px;
  }
  
  .player-volume svg {
    width: 10px;
    height: 10px;
  }
  
  .player-volume input[type="range"] {
    width: 35px;
  }
}

@media (max-width: 600px) {
  .music-player-bar {
    padding: 3px 5px;
    gap: 3px;
    min-height: 45px;
  }
  
  .player-cover {
    width: 28px;
    height: 28px;
  }
  
  .player-info-section {
    flex: 0 0 auto;
    min-width: 80px;
  }
  
  .player-info {
    min-width: 60px;
  }
  
  .player-title {
    font-size: 10px;
    margin-bottom: 1px;
  }
  
  .player-artist {
    font-size: 8px;
  }
  
  .player-progress-container {
    flex: 0 1 auto;
    min-width: 40px;
    gap: 2px;
  }
  
  .player-time {
    font-size: 8px;
    min-width: 28px;
  }
  
  .player-controls {
    gap: 1px;
    flex: 0 0 auto;
  }
  
  .player-btn {
    padding: 2px;
  }
  
  .player-btn svg {
    width: 11px;
    height: 11px;
  }
  
  .player-volume {
    width: 45px;
    flex: 0 0 45px;
    gap: 1px;
  }
  
  .player-volume svg {
    width: 9px;
    height: 9px;
  }
  
  .player-volume input[type="range"] {
    width: 28px;
    height: 3px;
  }
}

@media (max-width: 400px) {
  .music-player-bar {
    padding: 3px 4px;
    gap: 3px;
    min-height: 45px;
  }
  
  .player-cover {
    width: 28px;
    height: 28px;
  }
  
  .player-info {
    max-width: 60px;
  }
  
  .player-title {
    font-size: 9px;
  }
  
  .player-artist {
    font-size: 7px;
  }
  
  .player-progress-container {
    min-width: 50px;
  }
  
  .player-btn {
    padding: 1px;
  }
  
  .player-btn svg {
    width: 11px;
    height: 11px;
  }
  
  .player-volume {
    width: 40px;
    flex: 0 0 40px;
  }
  
  .player-volume input[type="range"] {
    width: 24px;
  }
}

/* 音量容器 */
.player-volume-container {
  position: relative;
  display: flex;
  align-items: center;
}

/* 音量滑块容器 - 默认隐藏 */
.player-volume-slider {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #e1e4e8);
  border-radius: 8px;
  padding: 12px 8px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1001;
}

/* 悬停时显示音量滑块（桌面端） */
@media (hover: hover) and (pointer: fine) {
  .player-volume-container:hover .player-volume-slider,
  .player-volume-slider:hover {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }
}

/* 移动端点击显示音量条 */
.player-volume-container.active .player-volume-slider {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 音量滑块容器 */
.player-volume-slider {
  width: 40px;
  height: 130px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* 音量百分比显示 - 在底部 */
.player-volume-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text, #24292e);
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 4px;
}

/* 音量滑块包装器 - 用于旋转 */
.player-volume-slider-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
}

/* 音量滑块 - 旋转实现垂直 */
.player-volume-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  background: var(--color-border, #e1e4e8);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transform: rotate(-90deg);
}

/* 滑块轨道 - WebKit */
.player-volume-slider input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: var(--color-border, #e1e4e8);
  border-radius: 2px;
}

/* 滑块轨道 - Firefox */
.player-volume-slider input[type="range"]::-moz-range-track {
  width: 100%;
  height: 4px;
  background: var(--color-border, #e1e4e8);
  border-radius: 2px;
}

/* 滑块圆点 - WebKit */
.player-volume-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--color-primary, #0366d6);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border: 2px solid #fff;
  margin-top: -5px;
}

/* 滑块圆点 - Firefox */
.player-volume-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--color-primary, #0366d6);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 响应式音量 */
@media (max-width: 1200px) {
  .player-volume-slider {
    padding: 10px 6px;
  }
  
  .player-volume-slider input[type="range"]:not(*:root) {
    height: 60px;
  }
}

@media (max-width: 900px) {
  .player-volume-slider {
    padding: 8px 5px;
  }
  
  .player-volume-slider input[type="range"]:not(*:root) {
    height: 50px;
  }
}

@media (max-width: 400px) {
  .player-volume {
    min-width: 50px;
    gap: 2px;
  }
  
  .player-volume svg {
    width: 10px;
    height: 10px;
  }
}

/* 播放历史记录 */
.play-history {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #e1e4e8);
  border-radius: 8px;
  padding: 12px;
  max-width: 300px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.play-history.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.play-history-header {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text, #24292e);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.play-history-header-btns {
  display: flex;
  gap: 4px;
}

.play-history-header-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary, #586069);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.play-history-header-btn:hover {
  background: var(--color-bg-secondary, #f6f8fa);
  color: var(--color-text, #24292e);
}

.play-history-header-btn[title="清空历史"]:hover,
.play-history-header-btn[title="清空列表"]:hover {
  color: #d73a49;
}

/* 播放列表样式 */
.play-queue {
  right: 80px; /* 在播放历史左侧 */
}

.play-queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 4px;
}

.play-queue-item:hover {
  background: var(--color-bg-secondary, #f6f8fa);
}

.play-queue-item.active {
  background: var(--color-primary-light, #e1f5fe);
}

.play-queue-item.playing .play-queue-title {
  color: var(--color-primary, #0366d6);
  font-weight: 600;
}

.play-queue-number {
  width: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-secondary, #586069);
  flex-shrink: 0;
}

.play-queue-item.playing .play-queue-number {
  color: var(--color-primary, #0366d6);
}

.play-queue-cover {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.play-queue-info {
  flex: 1;
  min-width: 0;
}

.play-queue-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text, #24292e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-queue-artist {
  font-size: 11px;
  color: var(--color-text-secondary, #586069);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-queue-remove {
  background: transparent;
  border: none;
  color: var(--color-text-tertiary, #999);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s;
}

.play-queue-item:hover .play-queue-remove {
  opacity: 1;
}

.play-queue-remove:hover {
  background: var(--color-bg-secondary, #f6f8fa);
  color: #d73a49;
}

.play-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 4px;
}

.play-history-item:hover {
  background: var(--color-bg-secondary, #f6f8fa);
}

.play-history-cover {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.play-history-info {
  flex: 1;
  min-width: 0;
}

.play-history-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text, #24292e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-history-artist {
  font-size: 11px;
  color: var(--color-text-secondary, #586069);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .music-player-bar {
    flex-wrap: wrap;
    padding: 8px 12px;
  }
  
  .player-info {
    order: 1;
    width: 100%;
    margin-bottom: 8px;
  }
  
  .player-progress-container {
    order: 2;
    width: 100%;
    max-width: 100%;
    margin-bottom: 8px;
  }
  
  .player-controls {
    order: 3;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }
  
  .player-speed {
    font-size: 11px;
  }
  
  .player-volume {
    min-width: 100px;
  }
  
  .play-history {
    bottom: 70px;
    right: 10px;
    left: 10px;
    max-width: 100%;
  }
}

/* 深色模式支持 - 使用 theme.css 的变量 */
[data-theme="dark"] {
  --color-bg: #0f0f0f;
  --color-bg-secondary: #1a1a1a;
  --color-bg-tertiary: #2d2d2d;
  --color-text: #e5e5e5;
  --color-text-secondary: #a0a0a0;
  --color-text-tertiary: #666666;
  --color-border: #333333;
  --color-primary: #0ea5e9;
  --color-primary-hover: #0284c7;
  --color-primary-light: rgba(14, 165, 233, 0.15);
}

/* 深色模式下的播放器样式 */
[data-theme="dark"] .music-player-bar {
  background: var(--color-bg, #0f0f0f);
  border-color: var(--color-border, #333333);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .play-history,
[data-theme="dark"] .play-queue {
  background: var(--color-bg, #0f0f0f);
  border-color: var(--color-border, #333333);
}

[data-theme="dark"] .player-volume-slider {
  background: var(--color-bg, #0f0f0f);
  border-color: var(--color-border, #333333);
}
