/* ================================================================
   WP Music Player — player.css
   Distinctive design: vinyl record aesthetic, deep indigo palette,
   signature element: animated vinyl disc that spins during playback
   ================================================================ */

/* ── Token System ────────────────────────────────────────────────── */
.wpmp-player {
  /* Dark theme (default) */
  --c-bg:       #0f0e17;
  --c-surface:  #1a1825;
  --c-surface2: #232131;
  --c-surface3: #2c2a3d;
  --c-border:   rgba(255,255,255,.07);
  --c-accent:   #6c63ff;
  --c-accent-h: #8b85ff;
  --c-accent-g: rgba(108,99,255,.3);
  --c-text:     #efefef;
  --c-text-2:   #9896b8;
  --c-text-3:   #55536e;
  --c-active:   rgba(108,99,255,.15);
  --c-hover:    rgba(255,255,255,.04);
  --c-vinyl-bg: #1a1825;
  --c-vinyl-groove: rgba(255,255,255,.06);
  --c-shadow:   0 20px 60px rgba(0,0,0,.6);
  --radius:     16px;
  --radius-s:   10px;
  --ease:       cubic-bezier(.4,0,.2,1);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

.wpmp-player.wpmp-theme-light {
  --c-bg:       #f0eeff;
  --c-surface:  #ffffff;
  --c-surface2: #f4f2ff;
  --c-surface3: #ece9ff;
  --c-border:   rgba(0,0,0,.07);
  --c-accent:   #5b52e8;
  --c-accent-h: #7b74ff;
  --c-accent-g: rgba(91,82,232,.2);
  --c-text:     #16142b;
  --c-text-2:   #5a5870;
  --c-text-3:   #a8a6c0;
  --c-active:   rgba(91,82,232,.1);
  --c-hover:    rgba(0,0,0,.03);
  --c-vinyl-bg: #e8e5ff;
  --c-vinyl-groove: rgba(0,0,0,.08);
  --c-shadow:   0 20px 60px rgba(0,0,0,.14);
}

/* ── Shell ───────────────────────────────────────────────────────── */
.wpmp-player {
  display: flex;
  background: var(--c-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--c-shadow);
  color: var(--c-text);
  position: relative;
  min-height: 480px;
  isolation: isolate;
}

/* ── Now Playing ─────────────────────────────────────────────────── */
.wpmp-now-playing {
  width: 288px;
  min-width: 260px;
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 22px;
  gap: 18px;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

/* ── Vinyl Disc (signature element) ─────────────────────────────── */
.wpmp-vinyl-wrap {
  position: relative;
  width: 192px;
  height: 192px;
  flex-shrink: 0;
}
.wpmp-vinyl {
  width: 100%; height: 100%;
  transition: filter .4s;
}
.wpmp-vinyl-disc {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    var(--c-vinyl-bg) 0%,
    #111 20%,
    #1a1a1a 22%,
    #0d0d0d 40%,
    #1a1a1a 42%,
    #0d0d0d 60%,
    #1a1a1a 62%,
    #0d0d0d 80%,
    #1a1a1a 82%,
    #080808 100%
  );
  box-shadow: 0 0 0 2px rgba(255,255,255,.06), 0 8px 32px rgba(0,0,0,.6);
  position: relative;
  overflow: hidden;
  animation: wpmp-spin 18s linear infinite paused;
}
.wpmp-player.wpmp-is-playing .wpmp-vinyl-disc {
  animation-play-state: running;
}

/* Grooves overlay */
.wpmp-vinyl-groove {
  position: absolute; inset: 0; border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50%,
    transparent 0px,
    transparent 4px,
    var(--c-vinyl-groove) 4px,
    var(--c-vinyl-groove) 5px
  );
}

/* Centre label */
.wpmp-vinyl-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--c-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px rgba(0,0,0,.5), 0 0 20px var(--c-accent-g);
  overflow: hidden;
}
.wpmp-vinyl-label-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.wpmp-vinyl-note {
  font-size: 1.5rem; color: rgba(255,255,255,.8);
  display: block;
}
.wpmp-vinyl-label.has-cover .wpmp-vinyl-note { display: none; }

/* Needle arm (decorative) */
.wpmp-vinyl-wrap::after {
  content: '';
  position: absolute;
  top: -8px; right: -4px;
  width: 3px; height: 56px;
  background: linear-gradient(180deg, #888 0%, #555 100%);
  border-radius: 2px;
  transform-origin: top center;
  transform: rotate(-18deg);
  transition: transform .6s var(--ease);
  box-shadow: 1px 1px 4px rgba(0,0,0,.5);
}
.wpmp-player.wpmp-is-playing .wpmp-vinyl-wrap::after {
  transform: rotate(-2deg);
}

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

/* ── Track Info ──────────────────────────────────────────────────── */
.wpmp-np-info { width: 100%; text-align: center; }
.wpmp-np-title {
  font-size: 1rem; font-weight: 700;
  color: var(--c-text); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  margin-bottom: 4px;
}
.wpmp-np-artist {
  font-size: .82rem; font-weight: 600;
  color: var(--c-accent-h); margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wpmp-np-album {
  font-size: .76rem; color: var(--c-text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Progress ────────────────────────────────────────────────────── */
.wpmp-progress-wrap {
  display: flex; align-items: center; gap: 8px; width: 100%;
}
.wpmp-time {
  font-size: .7rem; color: var(--c-text-3);
  min-width: 30px; font-variant-numeric: tabular-nums;
}
.wpmp-progress {
  flex: 1; position: relative; cursor: pointer;
  padding: 10px 0; /* hit area */
  margin: -10px 0;
}
.wpmp-progress-track {
  height: 3px; background: var(--c-surface3);
  border-radius: 2px; overflow: hidden;
  transition: height .18s var(--ease);
}
.wpmp-progress:hover .wpmp-progress-track { height: 5px; }
.wpmp-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-h));
  border-radius: 2px; transition: width .08s linear;
}
.wpmp-progress-thumb {
  position: absolute; top: 50%;
  width: 13px; height: 13px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 6px rgba(0,0,0,.4);
  transform: translate(-50%, -50%) scale(0);
  transition: transform .15s; pointer-events: none;
}
.wpmp-progress:hover .wpmp-progress-thumb { transform: translate(-50%, -50%) scale(1); }

/* ── Controls ────────────────────────────────────────────────────── */
.wpmp-controls {
  display: flex; align-items: center; gap: 4px;
}
.wpmp-btn-ctrl {
  width: 42px; height: 42px; border-radius: 50%;
  border: none; background: transparent; cursor: pointer;
  color: var(--c-text-2);
  display: flex; align-items: center; justify-content: center;
  transition: color .18s, background .18s, transform .12s;
  padding: 0; flex-shrink: 0;
}
.wpmp-btn-ctrl svg { width: 20px; height: 20px; fill: currentColor; }
.wpmp-btn-ctrl:hover { color: var(--c-text); background: var(--c-hover); }
.wpmp-btn-ctrl:active { transform: scale(.92); }
.wpmp-btn-ctrl.is-active { color: var(--c-accent-h); }

/* Play/Pause — centrepiece */
.wpmp-play-pause {
  width: 56px; height: 56px;
  background: var(--c-accent);
  color: #fff;
  box-shadow: 0 4px 20px var(--c-accent-g);
}
.wpmp-play-pause svg { width: 26px; height: 26px; }
.wpmp-play-pause:hover {
  background: var(--c-accent-h); color: #fff;
  transform: scale(1.07);
  box-shadow: 0 6px 28px var(--c-accent-g);
}

/* ── Volume + Speed ──────────────────────────────────────────────── */
.wpmp-secondary-ctrl {
  display: flex; align-items: center; gap: 12px; width: 100%;
  flex-wrap: wrap;
}
.wpmp-vol-group {
  display: flex; align-items: center; gap: 6px; flex: 1;
}
.wpmp-vol-group .wpmp-btn-ctrl { width: 28px; height: 28px; flex-shrink: 0; }
.wpmp-vol-group .wpmp-btn-ctrl svg { width: 16px; height: 16px; }
.wpmp-vol-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 3px; background: var(--c-surface3);
  border-radius: 2px; outline: none; cursor: pointer;
}
.wpmp-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: var(--c-accent-h); border-radius: 50%;
}
.wpmp-vol-slider::-moz-range-thumb {
  width: 12px; height: 12px;
  background: var(--c-accent-h); border-radius: 50%; border: none;
}
.wpmp-speed-group {
  display: flex; align-items: center; gap: 5px;
}
.wpmp-speed-label { font-size: .7rem; color: var(--c-text-3); }
.wpmp-speed-select {
  font-size: .75rem; padding: 3px 6px;
  background: var(--c-surface3); border: 1px solid var(--c-border);
  color: var(--c-text); border-radius: 6px; cursor: pointer; outline: none;
}

/* ── Visualiser ──────────────────────────────────────────────────── */
.wpmp-visualiser {
  display: flex; align-items: flex-end; gap: 3px;
  height: 22px; opacity: 0; transition: opacity .3s;
}
.wpmp-player.wpmp-is-playing .wpmp-visualiser { opacity: 1; }
.wpmp-vis-bar {
  width: 3px; background: var(--c-accent); border-radius: 2px;
  animation: wpmp-bar 1.1s ease-in-out infinite;
}
.wpmp-vis-bar:nth-child(1) { animation-delay: 0s;    animation-duration: .9s;  }
.wpmp-vis-bar:nth-child(2) { animation-delay: .15s;  animation-duration: 1.1s; }
.wpmp-vis-bar:nth-child(3) { animation-delay: .3s;   animation-duration: .8s;  }
.wpmp-vis-bar:nth-child(4) { animation-delay: .1s;   animation-duration: 1.2s; }
.wpmp-vis-bar:nth-child(5) { animation-delay: .25s;  animation-duration: .95s; }
.wpmp-vis-bar:nth-child(6) { animation-delay: .05s;  animation-duration: 1.0s; }
.wpmp-vis-bar:nth-child(7) { animation-delay: .35s;  animation-duration: .85s; }
@keyframes wpmp-bar {
  0%, 100% { height: 3px; }
  50%       { height: 20px; }
}

/* ── Playlist Panel ──────────────────────────────────────────────── */
.wpmp-playlist-panel {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--c-bg);
}

.wpmp-pl-toolbar {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  display: flex; flex-direction: column; gap: 10px;
}

/* Search */
.wpmp-search-box {
  position: relative; display: flex; align-items: center;
}
.wpmp-search-ico {
  position: absolute; left: 10px;
  width: 16px; height: 16px; fill: var(--c-text-3);
  pointer-events: none;
}
.wpmp-search-input {
  width: 100%; padding: 9px 34px;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-s);
  color: var(--c-text); font-size: .84rem; outline: none;
  transition: border-color .18s;
  box-sizing: border-box;
}
.wpmp-search-input:focus { border-color: var(--c-accent); }
.wpmp-search-input::placeholder { color: var(--c-text-3); }
.wpmp-search-clear {
  position: absolute; right: 10px;
  background: none; border: none; color: var(--c-text-3);
  cursor: pointer; font-size: .8rem; padding: 2px 4px;
  transition: color .15s;
}
.wpmp-search-clear:hover { color: var(--c-text); }

/* Filters */
.wpmp-filter-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.wpmp-filter-sel {
  flex: 1; min-width: 110px;
  padding: 7px 10px;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-s);
  color: var(--c-text); font-size: .8rem; cursor: pointer; outline: none;
}
.wpmp-filter-sel:focus { border-color: var(--c-accent); }

/* Meta bar */
.wpmp-pl-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--c-border);
  font-size: .76rem; color: var(--c-text-2);
}
.wpmp-play-all {
  padding: 4px 14px; border-radius: 20px;
  border: none; background: var(--c-accent); color: #fff;
  font-size: .76rem; cursor: pointer; transition: background .18s;
}
.wpmp-play-all:hover { background: var(--c-accent-h); }

/* Scroll area */
.wpmp-pl-scroll { overflow-y: auto; flex: 1; }
.wpmp-pl-scroll::-webkit-scrollbar { width: 4px; }
.wpmp-pl-scroll::-webkit-scrollbar-thumb { background: var(--c-surface3); border-radius: 2px; }

/* Loading */
.wpmp-pl-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 48px 24px;
  color: var(--c-text-2); font-size: .88rem;
}
.wpmp-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--c-surface3);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: wpmp-spin .7s linear infinite;
}

/* Empty */
.wpmp-pl-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding: 64px 24px;
  text-align: center; color: var(--c-text-2);
}
.wpmp-pl-empty-icon { font-size: 2.5rem; opacity: .4; }

/* Playlist list */
.wpmp-pl-list { list-style: none; margin: 0; padding: 0; }

/* Song row */
.wpmp-pl-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  position: relative;
  transition: background .15s;
}
.wpmp-pl-item:hover { background: var(--c-hover); }
.wpmp-pl-item.is-active {
  background: var(--c-active);
}
.wpmp-pl-item.is-active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--c-accent); border-radius: 0 2px 2px 0;
}

.wpmp-item-n {
  min-width: 22px; text-align: center;
  font-size: .72rem; color: var(--c-text-3);
}
.wpmp-item-playing {
  display: none; min-width: 22px; text-align: center;
  color: var(--c-accent-h); font-size: .9rem;
}
.is-active .wpmp-item-n       { display: none; }
.is-active .wpmp-item-playing { display: block; }

.wpmp-item-art {
  width: 42px; height: 42px; border-radius: 7px;
  overflow: hidden; flex-shrink: 0;
  background: var(--c-surface2);
  display: flex; align-items: center; justify-content: center;
}
.wpmp-item-art img { width: 100%; height: 100%; object-fit: cover; }
.wpmp-item-art-ph { color: var(--c-text-3); font-size: 1.1rem; }

.wpmp-item-meta { flex: 1; min-width: 0; }
.wpmp-item-title {
  font-size: .86rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--c-text); transition: color .15s;
}
.is-active .wpmp-item-title { color: var(--c-accent-h); }
.wpmp-item-sub {
  font-size: .74rem; color: var(--c-text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

.wpmp-item-dur {
  font-size: .72rem; color: var(--c-text-3);
  white-space: nowrap; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .wpmp-player {
    flex-direction: column;
    border-radius: var(--radius-s);
  }
  .wpmp-now-playing {
    width: 100%; min-width: unset; border-right: none;
    border-bottom: 1px solid var(--c-border);
    max-height: none; overflow: visible;
    padding: 20px 16px 18px;
  }
  .wpmp-vinyl-wrap { width: 150px; height: 150px; }
  .wpmp-controls { gap: 2px; }
  .wpmp-play-pause { width: 50px; height: 50px; }
  .wpmp-filter-row { flex-direction: column; }
  .wpmp-filter-sel { min-width: unset; width: 100%; }
}

@media (max-width: 420px) {
  .wpmp-vinyl-wrap { width: 120px; height: 120px; }
  .wpmp-btn-ctrl svg { width: 18px; height: 18px; }
  .wpmp-pl-item { padding: 8px 12px; gap: 8px; }
  .wpmp-item-art { width: 36px; height: 36px; }
}

/* ── Accessibility / Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .wpmp-vinyl-disc { animation: none !important; }
  .wpmp-vis-bar { animation: none !important; height: 10px !important; }
  .wpmp-spinner { animation: none; }
  .wpmp-progress-fill { transition: none; }
  .wpmp-vinyl-wrap::after { transition: none; }
}

.wpmp-btn-ctrl:focus-visible,
.wpmp-search-input:focus-visible,
.wpmp-progress:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
