/* ============================================================
   CyberPulse Music Player
   ── 默认展开，可收起至右下角标签
   ── 风格跟随站点设计系统（variables.css）
   ── 后端预置音乐列表
   ============================================================ */

/* ── 外层容器 ──────────────────────────────────────────────── */
.mp-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  font-family: var(--font-body);
  -webkit-user-select: none;
  user-select: none;
  transform: translateY(100%);
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.mp-player--active {
  transform: translateY(0);
}

/* ── Shell ─────────────────────────────────────────────────── */
.mp-player__shell {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.07);
}

/* ── 主操作栏（62px） ──────────────────────────────────────── */
.mp-player__bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  height: 62px;
  padding: 0 var(--edge-pad);
  gap: var(--space-lg);
}

/* ── 左：封面 + 曲目 ───────────────────────────────────────── */
.mp-player__info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* 黑胶唱片封面 */
.mp-player__art {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-body);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.mp-player__disc {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

.mp-player__disc-inner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--bg-surface) 26%, transparent 27%),
    conic-gradient(
      var(--bg-body) 0deg, var(--border) 60deg,
      var(--bg-body) 120deg, var(--border) 180deg,
      var(--bg-body) 240deg, var(--border) 300deg,
      var(--bg-body) 360deg
    );
  animation: mp-spin 5s linear infinite;
  animation-play-state: paused;
  position: relative;
}

.mp-player--playing .mp-player__disc-inner {
  animation-play-state: running;
}

@keyframes mp-spin { to { transform: rotate(360deg); } }

.mp-player__disc-inner::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--link);
}

.mp-player__art-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-ghost);
  transition: opacity 200ms;
}

.mp-player--playing .mp-player__art-ph {
  opacity: 0;
}

/* 曲目信息 */
.mp-player__track-info { min-width: 0; }

.mp-player__track-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-player__track-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* 播放中声波 */
.mp-soundbars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 200ms;
}

.mp-player--playing .mp-soundbars { opacity: 1; }

.mp-soundbars span {
  display: block;
  width: 2px;
  background: var(--link);
  border-radius: 1px;
  animation: mp-bar 0.85s ease-in-out infinite alternate;
}

.mp-soundbars span:nth-child(1) { animation-delay: 0s;    animation-duration: 0.80s; }
.mp-soundbars span:nth-child(2) { animation-delay: 0.18s; animation-duration: 1.00s; }
.mp-soundbars span:nth-child(3) { animation-delay: 0.08s; animation-duration: 0.70s; }
.mp-soundbars span:nth-child(4) { animation-delay: 0.25s; animation-duration: 0.90s; }

@keyframes mp-bar {
  from { height: 2px; }
  to   { height: 11px; }
}

/* ── 中：控制按钮 + 进度条 ─────────────────────────────────── */
.mp-player__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mp-player__ctrl-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ── 通用按钮 ─────────────────────────────────────────────── */
.mp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  padding: 0;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.mp-btn:hover {
  color: var(--text-body);
  background: var(--bg-surface-hover);
}

.mp-btn:active { background: var(--bg-code); }

.mp-btn--play {
  width: 36px;
  height: 36px;
  background: var(--text-heading);
  color: #fff;
  border-radius: 50%;
  margin: 0 6px;
}

.mp-btn--play:hover { background: #000; color: #fff; }
.mp-btn--play:active { background: var(--text-secondary); }

.mp-btn--active { color: var(--link) !important; }

/* ── 进度条 ─────────────────────────────────────────────────  */
.mp-player__progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}

.mp-player__time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.mp-seek-wrap {
  flex: 1;
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.mp-seek-track {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  pointer-events: none;
}

.mp-seek-track-bg { fill: var(--border); }

.mp-seek-svg {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  overflow: visible;
}

.mp-seek-buffered {
  fill: var(--border-strong);
  transition: width 200ms linear;
}

.mp-seek-fill {
  fill: var(--text-heading);
  transition: width 80ms linear;
}

.mp-seek-wrap:hover .mp-seek-fill { fill: var(--link); }

.mp-audio-el { display: none; }
.u-hidden { display: none !important; }

.mp-playlist-count {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.mp-playlist-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.mp-seek-range {
  position: absolute;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0; padding: 0;
  -webkit-appearance: none;
}

/* ── 右：音量 + 操作 ────────────────────────────────────────  */
.mp-player__right {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
}

.mp-vol-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: var(--space-xs);
}

.mp-vol-slider {
  width: 72px;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}

.mp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--text-heading);
  cursor: pointer;
  transition: transform var(--transition);
  border: none;
}

.mp-vol-slider:hover::-webkit-slider-thumb {
  transform: scale(1.25);
  background: var(--link);
}

.mp-vol-slider::-moz-range-thumb {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--text-heading);
  border: none;
  cursor: pointer;
}

.mp-player__divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 var(--space-xs);
  flex-shrink: 0;
}

/* ── 播放列表面板 ─────────────────────────────────────────── */
.mp-player__playlist-panel {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  max-height: 0;
  overflow: hidden;
  transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mp-player__playlist-panel--open {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.mp-player__playlist-panel--open::-webkit-scrollbar { width: 4px; }
.mp-player__playlist-panel--open::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.mp-playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px var(--edge-pad);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
}

/* （已移除文件选择/拖拽区相关样式，改为后端预置歌单） */

/* ── 播放列表条目 ─────────────────────────────────────────── */
.mp-playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--edge-pad);
  cursor: pointer;
  transition: background var(--transition);
  border-left: 2px solid transparent;
}

.mp-playlist-item:hover { background: var(--bg-surface-hover); }

.mp-playlist-item--active {
  background: var(--bg-body);
  border-left-color: var(--link);
}

.mp-playlist-item__art {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-body);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-ghost);
  overflow: hidden;
}

.mp-playlist-item--active .mp-playlist-item__art {
  color: var(--link);
  border-color: var(--link);
  background: #eff6ff;
}

.mp-mini-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.mp-mini-bars span {
  display: block;
  width: 2px;
  background: var(--link);
  border-radius: 1px;
  animation: mp-bar 0.85s ease-in-out infinite alternate;
}

.mp-mini-bars span:nth-child(1) { animation-delay: 0s;   animation-duration: 0.80s; }
.mp-mini-bars span:nth-child(2) { animation-delay: 0.2s; animation-duration: 0.95s; }
.mp-mini-bars span:nth-child(3) { animation-delay: 0.1s; animation-duration: 0.70s; }

.mp-player--playing .mp-playlist-item--active .mp-mini-bars { display: flex; }
.mp-player--playing .mp-playlist-item--active .mp-note-icon { display: none; }

.mp-playlist-item__info { flex: 1; min-width: 0; }

.mp-playlist-item__name {
  font-size: 13px;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.mp-playlist-item--active .mp-playlist-item__name {
  color: var(--link);
  font-weight: 500;
}

.mp-playlist-item__dur {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}

/* （已移除删除按钮样式，后端预置歌单） */

/* ── 循环模式徽标 ─────────────────────────────────────────── */
.mp-btn-loop-wrap { position: relative; }

.mp-loop-badge {
  position: absolute;
  top: 2px; right: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--link);
  font-size: 7px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── 收起恢复标签（右下角） ────────────────────────────────── */
.mp-restore-tab {
  position: fixed;
  bottom: 14px;
  right: var(--edge-pad);
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease, background var(--transition);
  white-space: nowrap;
}

.mp-restore-tab--visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.mp-restore-tab:hover {
  background: var(--bg-surface-hover);
  color: var(--text-body);
}

.mp-restore-tab .mp-mini-bars { display: none; }

.mp-restore-tab.is-playing .mp-mini-bars {
  display: flex;
  height: 10px;
}

.mp-restore-tab.is-playing .mp-mini-bars span { background: var(--link); }
.mp-restore-tab.is-playing .mp-restore-note   { display: none; }

/* （已移除拖拽遮罩样式） */

/* ── 页面偏移 ─────────────────────────────────────────────── */
body.has-mp-player {
  padding-bottom: 62px;
  transition: padding-bottom 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 响应式 ───────────────────────────────────────────────── */
@media (max-width: 720px) {
  .mp-player__track-name,
  .mp-player__track-sub    { max-width: 120px; }
}

@media (max-width: 560px) {
  .mp-player__bar { padding: 0 var(--space-md); gap: var(--space-sm); }
  .mp-player__track-name { max-width: 80px; }
  .mp-vol-wrap { display: none; }
  .mp-btn-shuffle, .mp-btn-loop-wrap { display: none; }
}
