/* ==========================================================================
   Music Player — mini panel (bottom-left)
   Modern dark glass theme, intentionally distinct from the pastel profile
   card so it reads as a floating widget rather than part of the card.
   ========================================================================== */

:root {
  --mp-bg: rgba(16, 14, 24, 0.66);
  --mp-bg-solid: #14121e;
  --mp-border: rgba(255, 255, 255, 0.09);
  --mp-accent-a: #8b5cf6;
  --mp-accent-b: #ec4899;
  --mp-text: #f3f1fa;
  --mp-text-dim: #a7a1bd;
  --mp-track-bg: rgba(255, 255, 255, 0.08);
  --mp-radius: 16px;
  --mp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.music-panel {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 50;
  width: 300px;
  max-width: calc(100vw - 36px);
  font-family: var(--mp-font);
  background: var(--mp-bg);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  overflow: hidden;
  animation: mp-panel-in 0.5s ease-out;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.music-panel.mp-collapsed .music-queue {
  max-height: 0;
  opacity: 0;
}

@keyframes mp-panel-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- header (collapse toggle) ---- */
.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 0 14px;
}

.mp-header-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--mp-text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.mp-eq span {
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--mp-accent-a), var(--mp-accent-b));
  animation: mp-eq-bounce 0.9s ease-in-out infinite;
}

.mp-eq span:nth-child(1) { height: 40%; animation-delay: -0.6s; }
.mp-eq span:nth-child(2) { height: 100%; animation-delay: -0.2s; }
.mp-eq span:nth-child(3) { height: 65%; animation-delay: -0.9s; }

.music-panel:not(.mp-playing) .mp-eq span {
  animation-play-state: paused;
  height: 25% !important;
}

@keyframes mp-eq-bounce {
  0%, 100% { height: 25%; }
  50% { height: 100%; }
}

.mp-collapse-btn {
  background: none;
  border: none;
  color: var(--mp-text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease, transform 0.3s ease;
}

.mp-collapse-btn:hover {
  color: var(--mp-text);
  background: rgba(255, 255, 255, 0.06);
}

.music-panel.mp-collapsed .mp-collapse-btn svg {
  transform: rotate(180deg);
}

.mp-collapse-btn svg {
  transition: transform 0.3s ease;
}

/* ---- now playing ---- */
.mp-now-playing {
  display: flex;
  gap: 12px;
  padding: 10px 14px 12px;
}

.mp-cover-wrap {
  position: relative;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.mp-cover-wrap img,
.mp-cover-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mp-cover-placeholder {
  background: linear-gradient(135deg, var(--mp-accent-a), var(--mp-accent-b));
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
}

.mp-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.mp-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--mp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-artist {
  font-size: 11.5px;
  color: var(--mp-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: -4px;
}

/* ---- progress ---- */
.mp-progress-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.mp-time {
  font-size: 10px;
  color: var(--mp-text-dim);
  font-variant-numeric: tabular-nums;
  width: 30px;
  flex: 0 0 auto;
}

.mp-time.mp-time-end {
  text-align: right;
}

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

.mp-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--mp-accent-a), var(--mp-accent-b));
  width: 0%;
}

.mp-progress-track:hover .mp-progress-fill::after,
.mp-progress-fill::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.mp-progress-track:hover .mp-progress-fill::after {
  opacity: 1;
}

/* ---- controls ---- */
.mp-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.mp-btn {
  background: none;
  border: none;
  color: var(--mp-text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.mp-btn:hover {
  color: var(--mp-text);
  background: rgba(255, 255, 255, 0.07);
}

.mp-btn:active {
  transform: scale(0.92);
}

.mp-btn-play {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mp-accent-a), var(--mp-accent-b));
  color: #fff;
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.4);
}

.mp-btn-play:hover {
  color: #fff;
  filter: brightness(1.08);
  background: linear-gradient(135deg, var(--mp-accent-a), var(--mp-accent-b));
}

.mp-btn-repeat.mp-active {
  color: var(--mp-accent-b);
}

.mp-btn-repeat.mp-active::after {
  content: "";
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--mp-accent-b);
  margin: 1px auto 0;
}

.mp-spacer {
  flex: 1 1 auto;
}

.mp-volume {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mp-volume-slider {
  width: 0;
  opacity: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 3px;
  background: var(--mp-track-bg);
  outline: none;
  transition: width 0.2s ease, opacity 0.2s ease, margin 0.2s ease;
  cursor: pointer;
}

.mp-volume:hover .mp-volume-slider,
.mp-volume:focus-within .mp-volume-slider {
  width: 52px;
  opacity: 1;
  margin-left: 2px;
}

.mp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mp-text);
  cursor: pointer;
}

.mp-volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--mp-text);
  cursor: pointer;
}

/* ---- queue list ---- */
.music-queue {
  max-height: 168px;
  overflow-y: auto;
  border-top: 1px solid var(--mp-border);
  padding: 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
}

.music-queue::-webkit-scrollbar {
  width: 5px;
}

.music-queue::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.mp-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease;
  animation: mp-item-in 0.3s ease;
}

@keyframes mp-item-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mp-queue-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.mp-queue-cover,
.mp-queue-cover-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
}

.mp-queue-cover-placeholder {
  background: linear-gradient(135deg, var(--mp-accent-a), var(--mp-accent-b));
  opacity: 0.55;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mp-queue-text {
  min-width: 0;
  flex: 1 1 auto;
}

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

.mp-queue-artist {
  font-size: 10.5px;
  color: var(--mp-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- responsive ---- */
@media (width <= 640px) {
  .music-panel {
    left: 10px;
    bottom: 10px;
    width: 260px;
  }

  .music-queue {
    max-height: 130px;
  }
}
