/* =====================================================
   WAHE.WORLD — Mini YouTube Music Player Stylesheet
   Glassmorphic dark design tailored to the Nitnem companion.
   ===================================================== */

/* ── Root Widget Container ── */
.wahe-music-player {
  position: fixed;
  z-index: 1090; /* Floats above standard overlays (z-index 1000) */
  font-family: var(--font-body), sans-serif;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform, opacity;
  box-sizing: border-box;
}

/* Clear focus outlines except for keyboard accessibility */
.wahe-music-player button,
.wahe-music-player select {
  outline: none;
  font-family: inherit;
}

/* ── Show/Hide views via offscreen positioning to prevent iframe audio suspension ── */
.wahe-music-player.minimized #mp-expanded-view {
  position: absolute;
  top: -9999px;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}
.wahe-music-player.minimized #mp-minimized-view {
  position: relative;
  top: auto;
  left: auto;
  opacity: 1;
  pointer-events: auto;
}
.wahe-music-player.expanded #mp-minimized-view {
  position: absolute;
  top: -9999px;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}
.wahe-music-player.expanded #mp-expanded-view {
  position: relative;
  top: auto;
  left: auto;
  opacity: 1;
  pointer-events: auto;
}

/* ── Minimized Mode Layout ── */
.wahe-music-player.minimized {
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-gold-hi);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px var(--gold-glow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}



.wahe-music-player.minimized:hover {
  background: var(--bg-glass-hover);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 16px var(--gold-glow);
}

.mp-minimized-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  user-select: none;
}

/* Minimized Album Disc */
.mp-disc-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
  background: radial-gradient(circle, #201735 0%, #080310 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.mp-disc-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.mp-disc-fallback {
  font-size: 15px;
  color: var(--gold-bright);
  line-height: 1;
}

/* Rotation animation */
.wahe-music-player.playing .mp-disc-wrap {
  animation: mp-spin-disc 12s linear infinite;
}
.wahe-music-player.paused .mp-disc-wrap {
  animation: mp-spin-disc 12s linear infinite;
  animation-play-state: paused;
}

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

/* Ambient Breathing Glow (Halo) */
.mp-glow-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--gold-glow);
  opacity: 0.4;
  pointer-events: none;
}
.wahe-music-player.playing .mp-glow-ring {
  animation: mp-breath-glow 4s ease-in-out infinite alternate;
}

@keyframes mp-breath-glow {
  from { opacity: 0.2; box-shadow: 0 0 8px var(--gold-glow-lg); }
  to   { opacity: 0.7; box-shadow: 0 0 16px var(--gold-glow); }
}


/* ── Expanded Card Layout ── */
.wahe-music-player.expanded {
  bottom: 24px;
  right: 24px;
  width: 280px;
  background: hsla(245, 24%, 6%, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card), 0 0 25px rgba(38, 70, 186, 0.15);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}



/* Card Header */
.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mp-header-title {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-bright);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mp-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.mp-close-btn:hover {
  color: var(--text-primary);
  background: hsla(0, 0%, 100%, 0.06);
}

/* Hidden YouTube Video Container (Legally kept visible but small/aesthetic) */
.mp-iframe-container {
  width: 100%;
  height: 116px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #000;
  position: relative;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
  transition: height 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.mp-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Audio Track Meta Panel */
.mp-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 38px;
}

.mp-meta-title-wrapper {
  overflow: hidden;
  position: relative;
  width: 100%;
}

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

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

/* Custom Controls Panel */
.mp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mp-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  border: 1px solid transparent;
}

.mp-btn:hover {
  color: var(--gold-bright);
  background: hsla(0, 0%, 100%, 0.05);
  border-color: var(--border-light);
}

.mp-btn-play {
  font-size: 16px;
  color: var(--gold-bright);
  background: var(--gold-glow);
  border: 1px solid var(--border-gold);
}
.mp-btn-play:hover {
  background: hsla(38, 100%, 53%, 0.25);
  border-color: var(--border-gold-hi);
  transform: scale(1.08);
}

.mp-btn.active {
  color: var(--gold-bright);
  text-shadow: 0 0 8px var(--gold-glow);
  background: var(--gold-glow);
  border-color: var(--border-gold);
}

/* Custom Scrub/Progress Bar */
.mp-progress-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-muted);
  user-select: none;
}

.mp-time {
  min-width: 30px;
}

.mp-progress-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height 0.15s ease;
}
.mp-progress-bar-wrap:hover {
  height: 6px;
}

.mp-progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  width: 0%;
  position: relative;
  transition: width 0.1s linear;
}

.mp-progress-fill::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 0 6px var(--gold);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.mp-progress-bar-wrap:hover .mp-progress-fill::after {
  opacity: 1;
}

/* Custom Playlist Select Dropdown */
.mp-playlist-select {
  width: 100%;
  padding: 8px 10px;
  background: hsla(245, 24%, 10%, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%239e9ba8' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: calc(100% - 6px) center;
  background-size: 18px;
  padding-right: 28px;
}

.mp-playlist-select:hover {
  border-color: var(--border-gold);
  color: var(--text-primary);
}

.mp-playlist-select option {
  background: hsl(245, 24%, 6%);
  color: var(--text-secondary);
}

/* ── Custom HTML Tracklist Styling ── */
.mp-track-list {
  display: none;
  max-height: 150px;
  overflow-y: auto;
  margin-top: 8px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
  flex-direction: column;
  gap: 4px;
}
.wahe-music-player.show-tracks .mp-track-list {
  display: flex;
}
.mp-track-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  border: 1px solid transparent;
}
.mp-track-item:hover {
  background: hsla(0, 0%, 100%, 0.05);
  color: var(--gold-bright);
}
.mp-track-item.active {
  background: var(--gold-glow);
  color: var(--gold-bright);
  border: 1px solid var(--border-gold);
}
.mp-track-item-num {
  font-weight: bold;
  opacity: 0.6;
  min-width: 14px;
  font-size: 11px;
}
.mp-track-item-meta-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  text-align: left;
}
.mp-track-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.mp-track-item-author {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 1px;
}
.mp-track-item.active .mp-track-item-title {
  color: var(--gold-bright);
  font-weight: 600;
}
.mp-track-item.active .mp-track-item-author {
  color: hsla(43, 100%, 70%, 0.7);
}

/* ── Responsive Mobile Styling ── */
@media (max-width: 600px) {
  .wahe-music-player.minimized {
    bottom: 18px;
    right: 16px;
  }

  
  .wahe-music-player.expanded {
    width: calc(100% - 32px);
    left: 16px;
    right: 16px;
    bottom: 18px;
  }

}
