/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-hover: #25253e;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #5a5a7a;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --border: #2a2a40;
  --player-bg: #16162a;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 90px;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== 头部 ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-size: 22px;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-box {
  flex: 1;
  display: flex;
  gap: 8px;
  max-width: 600px;
}

.search-box input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box select {
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  min-width: 100px;
}

.search-box select:focus {
  border-color: var(--accent);
}

.search-box button {
  padding: 10px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.search-box button:hover {
  background: var(--accent-hover);
}

/* ========== 主区域 ========== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  gap: 20px;
}

.content {
  flex: 1;
  min-width: 0;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.list-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.list-count {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== 歌曲列表 ========== */
.song-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.song-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
}

.song-item:hover {
  background: var(--bg-card);
}

.song-item.active {
  background: var(--bg-hover);
  border-left: 3px solid var(--accent);
}

.song-item .song-index {
  width: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.song-item.active .song-index {
  color: var(--accent);
}

.song-item .song-cover-sm {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
}

.song-item .song-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.song-item .song-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-item .song-artist {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-item .song-source-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-muted);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.song-item .song-duration {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 40px;
  text-align: right;
}

.song-item .song-add-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.song-item .song-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== 播放列表侧栏 ========== */
.playlist-sidebar {
  width: 0;
  overflow: hidden;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: width 0.3s, padding 0.3s;
  flex-shrink: 0;
}

.playlist-sidebar.open {
  width: 300px;
  padding: 12px;
}

.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.playlist-count {
  font-size: 12px;
  color: var(--text-muted);
}

.playlist-list {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.empty-playlist {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.playlist-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  gap: 8px;
  font-size: 13px;
  transition: background 0.15s;
}

.playlist-item:hover {
  background: var(--bg-hover);
}

.playlist-item.current {
  color: var(--accent);
}

.playlist-item .pli-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item .pli-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
}

.playlist-item .pli-remove:hover {
  color: var(--danger);
}

/* ========== 空状态/加载 ========== */
.loading, .empty {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.loading.show, .empty.show {
  display: block;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ========== 底部播放器 ========== */
.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--player-bg);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  z-index: 1000;
  backdrop-filter: blur(16px);
}

.player-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* 歌曲信息 */
.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 240px;
  flex-shrink: 0;
}

.player-cover {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.player-title {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-artist {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 控制区 */
.player-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.controls-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ctrl-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}

.ctrl-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.play-btn {
  width: 40px;
  height: 40px;
  font-size: 20px;
  background: var(--accent) !important;
  color: white !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn:hover {
  background: var(--accent-hover) !important;
  transform: scale(1.05);
}

/* 进度条 */
.progress-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}

.time {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.progress-track, .volume-track {
  flex: 1;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.progress-fill, .volume-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.progress-thumb, .volume-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
  left: 0%;
  display: none;
}

.progress-track:hover .progress-thumb,
.volume-track:hover .volume-thumb {
  display: block;
}

/* 音量控制 */
.player-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 140px;
  flex-shrink: 0;
}

.volume-track {
  width: 80px;
  flex: none;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 10px;
  }
  .search-box {
    max-width: 100%;
  }
  .main {
    flex-direction: column;
  }
  .playlist-sidebar.open {
    width: 100%;
  }
  .player-inner {
    flex-wrap: wrap;
    gap: 10px;
  }
  .player-info {
    width: auto;
    flex: 1;
  }
  .player-volume {
    display: none;
  }
}
