/**
 * DJCMS Player — 精简版播放器样式
 * 
 * 一个文件替代原来散落在 6 个CSS文件 + 大量 !important 内联覆盖。
 * 使用 CSS 变量统一管理，响应式用 min/max-width 断点，零 !important。
 * 
 * 文件大小目标：< 8KB (原合计 ~45KB)
 */

/* ─── 变量 ─── */
.dj-player-vars {
  --dj-h: 70px;              /* 播放器高度 */
  --dj-cover: 48px;          /* 封面尺寸 */
  --dj-play-size: 42px;      /* 播放按钮 */
  --dj-ctrl-size: 32px;      /* 控制按钮 */
  --dj-color: var(--primary, #c20c0c);
  --dj-color-light: var(--primary-light, #e13e3e);
  --dj-bg: rgba(12, 12, 20, 0.96);
  --dj-border: rgba(255,255,255,0.06);
}

/* ─── 底部播放器 ─── */
.player-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 950;
  height: var(--dj-h);
  background: var(--dj-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--dj-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
}

/* 左侧：封面 + 信息 + 收藏 */
.player-track {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 260px;
  min-width: 0;
}

.player-cover {
  width: var(--dj-cover);
  height: var(--dj-cover);
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg3, #1a1a2e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text3, #888);
}

.player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #eee);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.player-artist {
  font-size: 11px;
  color: var(--text3, #888);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-like {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text3, #888);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.player-like:hover { color: var(--dj-color); }
.player-like.liked { color: var(--dj-color); }

/* 中间：控制按钮 + 进度条 */
.player-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.player-btns {
  display: flex;
  align-items: center;
  gap: 18px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text2, #aaa);
  font-size: 14px;
  width: var(--dj-ctrl-size);
  height: var(--dj-ctrl-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}

.ctrl-btn:hover {
  color: #fff;
}

.ctrl-btn.active {
  color: var(--dj-color);
}

.ctrl-btn.play-pause {
  width: var(--dj-play-size);
  height: var(--dj-play-size);
  background: var(--dj-color);
  color: #fff;
  font-size: 16px;
  transition: background 0.2s, transform 0.15s;
}

.ctrl-btn.play-pause:hover {
  background: var(--dj-color-light);
  transform: scale(1.06);
}

/* 进度条 */
.progress-wrap {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-time {
  font-size: 11px;
  color: var(--text3, #888);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 32px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  position: relative;
  transition: height 0.15s;
}

.progress-bar:hover {
  height: 5px;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--dj-color), var(--dj-color-light));
  width: 0%;
  pointer-events: none;
  transition: width 0.1s linear;
}

.progress-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--dj-color);
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  left: 0%;
  pointer-events: none;
  transition: transform 0.15s;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}

.progress-bar:hover .progress-dot {
  transform: translate(-50%, -50%) scale(1);
}

/* 右侧：音量 + 列表 */
.player-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 200px;
  justify-content: flex-end;
}

.vol-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vol-bar {
  width: 72px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  position: relative;
}

.vol-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--text2, #aaa);
  width: 75%;
  pointer-events: none;
}

.player-extra-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text3, #888);
  font-size: 14px;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.player-extra-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

/* ─── 播放列表弹出面板 ─── */
.queue-panel {
  position: fixed;
  bottom: var(--dj-h);
  right: 20px;
  width: 360px;
  max-height: 420px;
  background: var(--dj-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--dj-border);
  border-radius: 12px 12px 0 0;
  z-index: 951;
  overflow-y: auto;
  display: none;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
}

.queue-panel.open { display: block; }

.qp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--dj-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #eee);
  position: sticky;
  top: 0;
  background: var(--dj-bg);
}

.qp-clear {
  background: none;
  border: none;
  color: var(--text3, #888);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.qp-clear:hover { color: var(--dj-color); }

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.1s;
}

.queue-item:hover { background: rgba(255,255,255,0.04); }
.queue-item.active { color: var(--dj-color); }

.qp-num {
  width: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text3, #888);
  flex-shrink: 0;
}

.qp-info {
  flex: 1;
  min-width: 0;
}

.qp-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qp-artist {
  font-size: 11px;
  color: var(--text3, #888);
}

.qp-del {
  background: none;
  border: none;
  color: var(--text3, #888);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}

.queue-item:hover .qp-del { opacity: 1; }
.qp-del:hover { color: var(--dj-color); }

/* ─── 播放历史 ─── */
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}

.history-item:hover { background: rgba(255,255,255,0.04); }

.history-cover {
  width: 36px; height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

.history-info { flex: 1; min-width: 0; }

.history-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-artist {
  font-size: 10px;
  color: var(--text3, #888);
}

.empty-hint {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text3, #888);
  text-align: center;
}

/* ─── 播放列表按钮高亮 ─── */
.list-open .player-extra-btn[title="播放列表"],
.list-open .player-extra-btn[aria-label="播放列表"] {
  color: var(--dj-color);
}

/* ─── 移动端响应式 ─── */
@media (max-width: 768px) {
  .player-bar {
    height: 64px;
    padding: 0 12px;
    gap: 10px;
  }

  .player-track {
    flex: 0 0 auto;
    gap: 8px;
  }

  .player-cover { width: 40px; height: 40px; }

  .player-right .vol-wrap { display: none; }

  .player-btns { gap: 12px; }

  .ctrl-btn { width: 28px; height: 28px; font-size: 13px; }
  .ctrl-btn.play-pause { width: 36px; height: 36px; font-size: 15px; }

  .progress-wrap { max-width: none; gap: 6px; }
  .progress-time { font-size: 10px; min-width: 28px; }

  .queue-panel {
    width: 100%;
    right: 0;
    border-radius: 12px 12px 0 0;
  }
}

/* 小屏手机 */
@media (max-width: 480px) {
  .player-bar {
    height: 56px;
    padding: 0 10px;
    gap: 8px;
  }

  .player-track { flex: 1; min-width: 0; }

  .player-cover { width: 36px; height: 36px; border-radius: 6px; }

  .player-title { font-size: 12px; }
  .player-artist { font-size: 10px; }

  .player-like { width: 24px; height: 24px; font-size: 12px; }

  .player-controls { display: none; }

  .player-right { flex: 0 0 auto; gap: 8px; }

  .progress-wrap { display: none; }

  /* 移动端点击封面区域展开播放器 */
  .player-bar.expanded {
    height: 100vh;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
    padding: 40px 20px;
  }

  .player-bar.expanded .player-controls { display: flex; }
  .player-bar.expanded .progress-wrap { display: flex; width: 100%; max-width: 100%; }
  .player-bar.expanded .player-right .vol-wrap { display: flex; }
}

/* ─── 封面占位色块（无封面时） ─── */
.cover-c1 { background: linear-gradient(135deg, #667eea, #764ba2); }
.cover-c2 { background: linear-gradient(135deg, #f093fb, #f5576c); }
.cover-c3 { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.cover-c4 { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.cover-c5 { background: linear-gradient(135deg, #fa709a, #fee140); }
.cover-c6 { background: linear-gradient(135deg, #a18cd1, #fbc2eb); }

/* ─── 播放动画（波形/旋转） ─── */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.player-cover.playing img {
  animation: spin 8s linear infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.playing-indicator {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.playing-indicator span {
  width: 3px;
  background: var(--dj-color);
  border-radius: 1px;
  animation: pulse 0.8s ease-in-out infinite;
}

.playing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.playing-indicator span:nth-child(3) { animation-delay: 0.3s; }
