/* ============================================================ 
   Floating Music Player Box — Legend Portfolio
   ============================================================ */

:root {
  --mp-bg: rgba(7, 10, 14, 0.90);
  --mp-border: rgba(223, 231, 224, 0.16);
  --mp-red: #e0231c;
  --mp-red-glow: rgba(224, 35, 28, 0.4);
  --mp-text: #dfe7e0;
  --mp-muted: #8b988f;
  --mp-surface: rgba(255, 255, 255, 0.04);
  --mp-surface-hover: rgba(255, 255, 255, 0.08);
}

/* Floating Root Container */
#legend-music-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  font-family: 'Cinzel', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  transform: translate3d(0, 0, 0);
  contain: layout style;
  will-change: transform;
}

/* Compact Pill Launcher */
.mp-launcher {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--mp-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--mp-border);
  border-radius: 40px;
  padding: 8px 16px 8px 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(224, 35, 28, 0.15);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--mp-text);
}

.mp-launcher:hover {
  border-color: rgba(224, 35, 28, 0.5);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 24px var(--mp-red-glow);
  transform: translateY(-2px);
}

/* Rotating Vinyl Disc */
.mp-vinyl-disc {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #111 0%, #222 30%, #0c0c0c 60%, #1a1a1a 100%);
  border: 2px solid rgba(223, 231, 224, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  flex-shrink: 0;
  transition: border-color 0.3s;
}

.mp-vinyl-center {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--mp-red);
  box-shadow: 0 0 8px var(--mp-red);
}

#legend-music-box.is-playing .mp-vinyl-disc {
  animation: mp-spin 4s linear infinite;
  border-color: var(--mp-red);
}

@keyframes mp-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Mini Audio Bars */
.mp-audio-wave {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.mp-wave-bar {
  width: 3px;
  background: var(--mp-muted);
  border-radius: 2px;
  height: 4px;
  transition: height 0.2s;
}

#legend-music-box.is-playing .mp-wave-bar:nth-child(1) { animation: mp-wave 0.8s ease-in-out infinite alternate; background: var(--mp-red); }
#legend-music-box.is-playing .mp-wave-bar:nth-child(2) { animation: mp-wave 0.6s ease-in-out infinite 0.2s alternate; background: var(--mp-red); }
#legend-music-box.is-playing .mp-wave-bar:nth-child(3) { animation: mp-wave 0.9s ease-in-out infinite 0.4s alternate; background: var(--mp-red); }
#legend-music-box.is-playing .mp-wave-bar:nth-child(4) { animation: mp-wave 0.7s ease-in-out infinite 0.1s alternate; background: var(--mp-red); }

@keyframes mp-wave {
  0% { height: 3px; }
  100% { height: 14px; }
}

.mp-launcher-info {
  display: flex;
  flex-direction: column;
  max-width: 140px;
  overflow: hidden;
}

.mp-launcher-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--mp-text);
}

.mp-launcher-sub {
  font-size: 9px;
  color: var(--mp-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mp-launcher-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mp-text);
  font-size: 11px;
  margin-left: 2px;
  transition: all 0.2s;
}

.mp-launcher-toggle:hover {
  background: var(--mp-red);
  border-color: var(--mp-red);
  color: #fff;
}

/* ============================================================
   Expanded Music Panel
   ============================================================ */

.mp-panel {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--mp-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--mp-border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(224, 35, 28, 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

#legend-music-box.is-expanded .mp-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#legend-music-box.is-expanded .mp-launcher {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Panel Header */
.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(223, 231, 224, 0.08);
}

.mp-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mp-red);
  font-weight: 600;
}

.mp-brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mp-red);
  box-shadow: 0 0 8px var(--mp-red);
}

.mp-close-btn {
  background: none;
  border: none;
  color: var(--mp-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1;
}

.mp-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Now Playing Card */
.mp-current-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--mp-surface);
  border: 1px solid rgba(223, 231, 224, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.mp-big-disc {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #181818 0%, #2a2a2a 40%, #0e0e0e 70%, #222 100%);
  border: 2px solid rgba(223, 231, 224, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(0,0,0,0.6);
}

.mp-big-disc-center {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mp-red);
  box-shadow: 0 0 12px var(--mp-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #fff;
}

#legend-music-box.is-playing .mp-big-disc {
  animation: mp-spin 4s linear infinite;
  border-color: var(--mp-red);
}

.mp-current-details {
  flex: 1;
  min-width: 0;
}

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

.mp-current-artist {
  font-size: 11px;
  color: var(--mp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Slider */
.mp-progress-container {
  margin-bottom: 14px;
}

.mp-scrubber {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 6px;
}

.mp-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e0231c, #ff6b57);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(224, 35, 28, 0.6);
  transition: width 0.1s linear;
}

.mp-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--mp-muted);
  font-variant-numeric: tabular-nums;
}

/* Transport Controls */
.mp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.mp-ctrl-btn {
  background: none;
  border: none;
  color: var(--mp-text);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  transition: all 0.2s;
}

.mp-ctrl-btn:hover {
  background: var(--mp-surface-hover);
  color: var(--mp-red);
}

.mp-ctrl-play {
  width: 44px;
  height: 44px;
  background: var(--mp-red);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 4px 16px rgba(224, 35, 28, 0.5);
}

.mp-ctrl-play:hover {
  background: #f0352e;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(224, 35, 28, 0.7);
  color: #fff;
}

/* Volume Slider Row */
.mp-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 14px;
  border-bottom: 1px solid rgba(223, 231, 224, 0.08);
  margin-bottom: 12px;
}

.mp-vol-icon {
  font-size: 12px;
  color: var(--mp-muted);
}

.mp-vol-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

.mp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--mp-text);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  transition: transform 0.1s;
}

.mp-vol-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--mp-red);
}

/* Playlist Area */
.mp-playlist-header {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mp-muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.mp-playlist {
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(223, 231, 224, 0.2) transparent;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mp-playlist::-webkit-scrollbar {
  width: 4px;
}

.mp-playlist::-webkit-scrollbar-thumb {
  background: rgba(223, 231, 224, 0.2);
  border-radius: 4px;
}

.mp-track-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--mp-text);
}

.mp-track-item:hover {
  background: var(--mp-surface-hover);
  border-color: rgba(223, 231, 224, 0.08);
}

.mp-track-item.is-active {
  background: rgba(224, 35, 28, 0.15);
  border-color: rgba(224, 35, 28, 0.35);
  color: #fff;
}

.mp-track-idx {
  font-size: 10px;
  color: var(--mp-muted);
  width: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mp-track-item.is-active .mp-track-idx {
  color: var(--mp-red);
  font-weight: bold;
}

.mp-track-info {
  flex: 1;
  min-width: 0;
}

.mp-track-name {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-track-sub {
  font-size: 9px;
  color: var(--mp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-track-item.is-active .mp-track-name {
  color: #ff9189;
}

.mp-track-playing-icon {
  display: none;
  font-size: 10px;
  color: var(--mp-red);
}

.mp-track-item.is-active.is-playing .mp-track-playing-icon {
  display: block;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
  #legend-music-box {
    bottom: 16px;
    right: 16px;
  }
  .mp-panel {
    width: calc(100vw - 32px);
    right: 0;
  }
}
