/* ============================================
   妈妈宝宝 · Music Player Styles
   Web Audio API synthesized piano
   ============================================ */

/* ── Music Page ── */
.music-page {
  padding-bottom: 110px;
}

/* ── Category Tabs ── */
.music-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding: 2px;
  -webkit-overflow-scrolling: touch;
}
.music-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--card);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  color: var(--text-light);
  position: relative;
  overflow: hidden;
}
.music-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  border-radius: 3px;
  background: transparent;
  transition: all 0.3s ease;
}
.music-tab.active {
  color: var(--text);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.music-tab.active::after {
  background: var(--rose);
  left: 30%;
  right: 30%;
}
.music-tab:nth-child(1).active { color: var(--rose); }
.music-tab:nth-child(1).active::after { background: var(--rose); }
.music-tab:nth-child(2).active { color: var(--teal); }
.music-tab:nth-child(2).active::after { background: var(--teal); }
.music-tab:nth-child(3).active { color: #7c4dff; }
.music-tab:nth-child(3).active::after { background: #7c4dff; }
.music-tab:active { transform: scale(0.97); }
.mt-icon { font-size: 1.6rem; }
.mt-label { font-size: 0.8rem; font-weight: 600; }
.mt-count { font-size: 0.65rem; color: var(--text-muted); }

/* ── Category Header ── */
.music-category-header {
  padding: 12px 4px 8px;
  margin-bottom: 12px;
}
.mch-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.mch-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.5;
}
.mch-desc span { display: inline-block; margin-right: 6px; }

/* ── Song List / Grid ── */
.music-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 400px) {
  .music-grid { grid-template-columns: 1fr; }
}

.music-card {
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}
.music-card:active { transform: scale(0.97); }
.music-card.playing {
  box-shadow: 0 0 0 2px var(--rose), var(--shadow-md);
}
.music-card:nth-child(2n).playing { box-shadow: 0 0 0 2px var(--teal), var(--shadow-md); }
.music-card:nth-child(3n).playing { box-shadow: 0 0 0 2px #7c4dff, var(--shadow-md); }

/* ── Album Art ── */
.mc-cover-wrap {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: linear-gradient(135deg, var(--rose-light), #e8d5f5);
  overflow: hidden;
}
.mc-cover-wrap img {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.music-card.playing .mc-cover-wrap img {
  transform: scale(1.05);
}
.mc-play-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.music-card:hover .mc-play-overlay,
.music-card.playing .mc-play-overlay {
  opacity: 1;
}
.mc-play-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  color: var(--rose);
}
.mc-play-btn:active { transform: scale(0.9); }

/* ── Card Info ── */
.mc-info {
  padding: 10px 12px 12px;
}
.mc-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-artist {
  font-size: 0.72rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.mc-tag {
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--rose-light);
  color: var(--rose);
}
.mc-tag.teal { background: var(--teal-light); color: var(--teal); }
.mc-tag.purple { background: #f3e5f5; color: #7c4dff; }

/* ── Bottom Player Bar ── */
.music-player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 998;
  background: var(--card);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  padding: 0;
  border-top: 1px solid var(--border-light);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.mpb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 4px;
  gap: 8px;
}
.mpb-info {
  flex: 1;
  min-width: 0;
}
.mpb-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mpb-artist {
  font-size: 0.7rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mpb-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.mpb-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text);
}
.mpb-btn:active { transform: scale(0.9); }
.mpb-btn.mpb-play {
  width: 40px;
  height: 40px;
  background: var(--rose);
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(232,62,140,0.3);
}

/* ── Progress Bar ── */
.mpb-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 8px;
}
.mpb-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 32px;
  text-align: center;
}
.mpb-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.mpb-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose), #ff6b9d);
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* ── Hint text ── */
.mpb-hint {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  padding: 2px 16px 8px;
  border-top: 1px solid var(--border-light);
  opacity: 0.7;
}

/* ── Equalizer Animation ── */
.eq-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.5);
  padding: 3px 4px;
  border-radius: 4px;
}
.eq-bar {
  width: 3px;
  background: #fff;
  border-radius: 2px;
  animation: eqAnim 0.5s ease infinite alternate;
}
.eq-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.eq-bar:nth-child(2) { height: 12px; animation-delay: 0.1s; }
.eq-bar:nth-child(3) { height: 6px; animation-delay: 0.2s; }
.eq-bar:nth-child(4) { height: 10px; animation-delay: 0.05s; }
@keyframes eqAnim {
  from { height: 4px; }
  to { height: 14px; }
}

/* ── Now Playing / Paused Indicator ── */
.now-playing-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--rose);
  color: white;
  font-size: 0.55rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.now-playing-badge.paused {
  background: var(--text-muted);
}

/* ── Desktop enhancements ── */
@media (min-width: 768px) {
  .music-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mpb-header {
    padding: 10px 24px 4px;
  }
  .mpb-progress-row {
    padding: 4px 24px 8px;
  }
}

/* ── Vinyl Spin Animation ── */
@keyframes vinylSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.music-card.playing .mc-cover-wrap img {
  animation: vinylSpin 8s linear infinite;
}
