/* =============================================================
   Jaydr Music Player v2 — Full-Width Footer Bar
   Dark theme · Pink/Purple/Gold · Responsive
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=DM+Sans:wght@300;400;500&display=swap');

/* ---- CSS Custom Properties ---------------------------------- */
:root {
  --jp-accent:      #c850ff;
  --jp-accent2:     #ff3fa4;
  --jp-gold:        #f5c842;
  --jp-bg:          #0c0c12;
  --jp-surface:     #13131d;
  --jp-surface2:    #1c1c2a;
  --jp-border:      rgba(200, 80, 255, 0.15);
  --jp-text:        #f0eaff;
  --jp-muted:       #6b6485;
  --jp-radius:      14px;
  --jp-bar-height:  64px;
  --jp-ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --jp-transition:  0.32s var(--jp-ease);
}

/* ---- Theme Variations -------------------------------------- */
#jaydr-player-root[data-theme="light"] {
  --jp-accent:      #e91e63;
  --jp-accent2:     #f48fb1;
  --jp-gold:        #ff9800;
  --jp-bg:          #faf5f0;
  --jp-surface:     #ffffff;
  --jp-surface2:    #f5f0eb;
  --jp-border:      rgba(233, 30, 99, 0.2);
  --jp-text:        #2d2d2d;
  --jp-muted:       #666666;
}

#jaydr-player-root[data-theme="dark-red"] {
  --jp-accent:      #c62828;
  --jp-accent2:     #ff5722;
  --jp-gold:        #ff8a65;
  --jp-bg:          #1a1212;
  --jp-surface:     #241818;
  --jp-surface2:    #2d1f1f;
  --jp-border:      rgba(198, 40, 40, 0.25);
  --jp-text:        #f5f5f5;
  --jp-muted:       #9e9e9e;
}

#jaydr-player-root[data-theme="cyberpunk"] {
  --jp-accent:      #03d8f3;
  --jp-accent2:     #ff00ff;
  --jp-gold:        #fce0a8;
  --jp-bg:          #0a0a1a;
  --jp-surface:     #12122a;
  --jp-surface2:    #1a1a3e;
  --jp-border:      rgba(3, 216, 243, 0.25);
  --jp-text:        #e0e0ff;
  --jp-muted:       #7a7ab0;
}

#jaydr-player-root[data-theme="venom"] {
  --jp-accent:      #76ff03;
  --jp-accent2:     #b2ff59;
  --jp-gold:        #b71c1c;
  --jp-bg:          #0a0f0a;
  --jp-surface:     #0f1a0f;
  --jp-surface2:    #152215;
  --jp-border:      rgba(118, 255, 3, 0.25);
  --jp-text:        #e8f5e9;
  --jp-muted:       #4caf50;
}

#jaydr-player-root[data-theme="spider-gwen"] {
  --jp-accent:      #ff4081;
  --jp-accent2:     #00bcd4;
  --jp-gold:        #00bcd4;
  --jp-bg:          #f8f9fa;
  --jp-surface:     #ffffff;
  --jp-surface2:    #eceff1;
  --jp-border:      rgba(255, 64, 129, 0.2);
  --jp-text:        #2d2d2d;
  --jp-muted:       #607d8b;
}

/* ---- Root / Shell ------------------------------------------ */
#jaydr-player-root {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  pointer-events: none; /* children re-enable */
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.jp-shell {
  width: 100%;
  background: var(--jp-bg);
  border-top: 1px solid var(--jp-border);
  box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.6), 0 -1px 0 rgba(200, 80, 255, 0.08);
  pointer-events: all;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---- Expanded panel (slides down from top of shell) -------- */
.jp-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--jp-transition);
  background: var(--jp-surface);
  border-top: 1px solid transparent;
}
.jp-shell.is-open .jp-panel {
  max-height: 460px;
  border-top-color: var(--jp-border);
}

/* ---- Genre / source tabs ----------------------------------- */
.jp-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.jp-tabs::-webkit-scrollbar { display: none; }

.jp-tab {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 8px;
  border: 1px solid var(--jp-border);
  background: transparent;
  color: var(--jp-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}
.jp-tab:hover {
  color: var(--jp-text);
  border-color: rgba(200, 80, 255, 0.3);
}
.jp-tab.active {
  background: linear-gradient(135deg, rgba(200,80,255,0.22), rgba(255,63,164,0.12));
  border-color: rgba(200, 80, 255, 0.45);
  color: var(--jp-text);
  box-shadow: 0 0 12px rgba(200, 80, 255, 0.15);
}

/* ---- Search row -------------------------------------------- */
.jp-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--jp-border);
}

.jp-search-input {
  flex: 1;
  height: 36px;
  background: rgba(200, 80, 255, 0.07);
  border: 1px solid var(--jp-border);
  border-radius: 10px;
  color: var(--jp-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 0 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.jp-search-input::placeholder { color: var(--jp-muted); }
.jp-search-input:focus {
  border-color: rgba(200, 80, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(200, 80, 255, 0.1);
}

.jp-search-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--jp-border);
  background: rgba(200, 80, 255, 0.12);
  color: var(--jp-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.jp-search-btn:hover { background: rgba(200, 80, 255, 0.25); }
.jp-search-btn i { font-size: 13px; }

/* ---- Track list -------------------------------------------- */
.jp-tracklist {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,80,255,0.25) transparent;
}
.jp-tracklist::-webkit-scrollbar { width: 4px; }
.jp-tracklist::-webkit-scrollbar-thumb {
  background: rgba(200,80,255,0.3);
  border-radius: 99px;
}

.jp-track-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(200,80,255,0.05);
  transition: background 0.15s;
  position: relative;
}
.jp-track-item:hover  { background: rgba(255, 255, 255, 0.05); }
.jp-track-item.active { background: rgba(200, 80, 255, 0.12); }

.jp-playlist-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.2s;
}

.jp-playlist-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.jp-playlist-cover {
  width: 50px;
  height: 50px;
  margin-right: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.jp-playlist-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.jp-playlist-info {
  flex: 1;
  min-width: 0;
}

.jp-playlist-name {
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jp-playlist-meta {
  font-size: 0.8rem;
  opacity: 0.7;
}

.jp-track-thumb {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--jp-surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--jp-muted);
  font-size: 14px;
  position: relative;
}
.jp-track-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.jp-track-thumb .jp-playing-glow {
  position: absolute;
  inset: 0;
  background: rgba(200, 80, 255, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}
.jp-track-item.active .jp-playing-glow { display: flex; }

.jp-track-meta { flex: 1; min-width: 0; }
.jp-track-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--jp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jp-track-item.active .jp-track-title { color: var(--jp-accent); }
.jp-track-artist {
  font-size: 11px;
  color: var(--jp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jp-track-actions {
  display: flex;
  gap: 8px;
  margin-right: 12px;
}
.jp-action-btn {
  background: transparent;
  border: none;
  color: var(--jp-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 12px;
}
.jp-action-btn:hover {
  color: var(--jp-text);
  background: rgba(255, 255, 255, 0.05);
}
.jp-action-btn.jp-active {
  color: var(--jp-accent2);
}
.jp-track-dur {
  font-size: 11px;
  color: var(--jp-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.jp-track-plays {
  font-size: 10px;
  color: var(--jp-gold);
  flex-shrink: 0;
  margin-right: 6px;
}

/* ---- Status / loading state -------------------------------- */
.jp-status {
  padding: 22px 16px;
  text-align: center;
  color: var(--jp-muted);
  font-size: 13px;
}
.jp-spinner {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(200,80,255,0.15);
  border-top-color: var(--jp-accent);
  border-radius: 50%;
  animation: jp-spin 0.75s linear infinite;
  margin: 0 auto 8px;
}
@keyframes jp-spin {
  to { transform: rotate(360deg); }
}

/* ---- Panel footer (badge + shuffle) ----------------------- */
.jp-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  border-top: 1px solid var(--jp-border);
  background: var(--jp-bg);
}
.jp-badge {
  font-size: 10px;
  color: var(--jp-muted);
  letter-spacing: 0.04em;
}
.jp-badge strong { color: var(--jp-accent); font-weight: 600; }
.jp-shuffle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--jp-muted);
  font-size: 11px;
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  transition: color 0.2s;
}
.jp-shuffle-btn:hover     { color: var(--jp-gold); }
.jp-shuffle-btn.on        { color: var(--jp-gold); }
.jp-shuffle-btn i         { font-size: 11px; }

/* ===================================================================
   PERSISTENT FOOTER BAR  (always visible)
=================================================================== */
.jp-bar {
  height: var(--jp-bar-height);
  display: grid;
  /* left: art + info | center: controls | right: progress + extras */
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px 5px 16px;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

/* ---- User account tabs visibility --------------------------------------- */
.jp-tab[data-tab="favorites"],
.jp-tab[data-tab="history"],
.jp-tab[data-tab="playlists"],
.jp-tab[data-tab="recommended"] {
  display: none;
}

.jaydr-has-user-id .jp-tab[data-tab="favorites"],
.jaydr-has-user-id .jp-tab[data-tab="history"],
.jaydr-has-user-id .jp-tab[data-tab="playlists"],
.jaydr-has-user-id .jp-tab[data-tab="recommended"] {
  display: inline-block;
}

/* ---- Collapsed strip --------------------------------------- */
/*
  When the panel is NOT open AND the user has previously toggled
  collapse, we shrink the bar to a thin strip.
  jp-shell.is-collapsed  →  slim strip
  default (no class)     →  full bar
*/
.jp-shell.is-collapsed .jp-bar {
  height: 36px;
}
.jp-shell.is-collapsed .jp-bar-progress-wrap,
.jp-shell.is-collapsed .jp-bar-right        { display: none; }
.jp-shell.is-collapsed .jp-disc             { width: 26px; height: 26px; }
.jp-shell.is-collapsed .jp-now-track-name   { font-size: 12px; }
.jp-shell.is-collapsed .jp-now-artist       { display: none; }

/* ---- Progress bar row (sits inside the bar visually) ------- */
.jp-bar-progress-wrap {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(200,80,255,0.12);
  cursor: pointer;
}
.jp-bar-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--jp-accent), var(--jp-gold));
  transition: width 0.5s linear;
  position: relative;
}
.jp-bar-progress-fill::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jp-gold);
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow: 0 0 6px var(--jp-gold);
}
.jp-bar-progress-wrap:hover .jp-bar-progress-fill::after { opacity: 1; }

/* ---- Now-playing (left col) -------------------------------- */
.jp-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Vinyl disc */
.jp-disc {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(200,80,255,0.3);
  box-shadow: 0 0 10px rgba(200,80,255,0.25);
  position: relative;
  transition: width 0.3s, height 0.3s;
}
.jp-disc img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.jp-disc.spinning img {
  animation: jp-disc-spin 6s linear infinite;
}
.jp-disc::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--jp-bg);
  border: 1px solid rgba(200,80,255,0.35);
}
@keyframes jp-disc-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.jp-disc-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--jp-surface2);
  color: var(--jp-muted);
  font-size: 16px;
  border-radius: 50%;
}

.jp-now-info { min-width: 0; }
.jp-now-idle {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, var(--jp-accent), var(--jp-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.jp-now-track-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--jp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.jp-now-artist {
  font-size: 11px;
  color: var(--jp-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* ---- Centre controls -------------------------------------- */
.jp-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.jp-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--jp-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s, transform 0.15s;
  font-size: 14px;
}
.jp-btn:hover { color: var(--jp-text); background: rgba(200,80,255,0.1); }
.jp-btn.play-btn {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--jp-accent), var(--jp-accent2));
  color: #fff;
  box-shadow: 0 0 18px rgba(200,80,255,0.4);
  font-size: 16px;
}
.jp-btn.play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 28px rgba(200,80,255,0.6);
}

/* ---- Right col ------------------------------------------- */
.jp-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

/* Volume */
.jp-volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.jp-volume-icon { color: var(--jp-muted); font-size: 13px; }
.jp-volume-slider {
  width: 80px;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 99px;
  background: rgba(200,80,255,0.18);
  outline: none;
  cursor: pointer;
}
.jp-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--jp-accent);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(200,80,255,0.5);
}
.jp-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--jp-accent);
  border: none;
  cursor: pointer;
}

/* Time display */
.jp-time-display {
  font-size: 11px;
  color: var(--jp-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Like btn */
.jp-like-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--jp-muted);
  font-size: 14px;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.2s, transform 0.15s;
}
.jp-like-btn:hover       { transform: scale(1.2); }
.jp-like-btn.is-liked    { color: var(--jp-accent2); }

/* Toggle panel chevron */
.jp-toggle-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--jp-border);
  background: rgba(200,80,255,0.08);
  color: var(--jp-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 11px;
}
.jp-toggle-btn:hover { background: rgba(200,80,255,0.2); color: var(--jp-accent); }
.jp-toggle-btn i {
  transition: transform var(--jp-transition);
}
.jp-shell.is-open .jp-toggle-btn i {
  transform: rotate(180deg);
}

/* Collapse (thin strip) toggle — separate small handle */
.jp-collapse-btn {
  width: 32px;
  height: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--jp-muted);
  font-size: 9px;
  transition: color 0.2s;
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--jp-surface);
  border: 1px solid var(--jp-border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 0 6px;
  z-index: 1;
}
.jp-collapse-btn:hover { color: var(--jp-accent); }
.jp-collapse-btn i {
  transition: transform var(--jp-transition);
}
.jp-shell.is-collapsed .jp-collapse-btn i {
  transform: rotate(180deg);
}

/* ===================================================================
   DIAGNOSTICS PANEL
=================================================================== */
.jp-diagnostics {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 260px;
  background: rgba(12, 12, 18, 0.96);
  border: 1px solid rgba(200, 80, 255, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: 'DM Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: #a0eaff;
  z-index: 99999;
  backdrop-filter: blur(10px);
  pointer-events: all;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.jp-diag-title {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--jp-accent);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(200,80,255,0.15);
  padding-bottom: 6px;
}
.jp-diag-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
}
.jp-diag-label { color: var(--jp-muted); flex-shrink: 0; }
.jp-diag-value { color: #d0ffb0; text-align: right; word-break: break-all; }
.jp-diag-value.error   { color: #ff6b8a; }
.jp-diag-value.playing { color: #a0ffa0; }
.jp-diag-value.warn    { color: var(--jp-gold); }
.jp-diag-value.warning { color: #ff6b6b; font-weight: 600; }

.jp-diag-section {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: var(--jp-accent);
  letter-spacing: 0.05em;
  margin: 10px 0 6px 0;
  border-top: 1px solid rgba(200,80,255,0.15);
  padding-top: 6px;
}

/* ===================================================================
   RESPONSIVE
=================================================================== */
@media (max-width: 640px) {
  .jp-bar {
    grid-template-columns: 1fr auto;
    padding: 0 10px;
    gap: 8px;
  }
  /* Hide right col on small screens */
  .jp-bar-right { display: none; }

  .jp-now-track-name,
  .jp-now-artist { max-width: 160px; }

  .jp-tab { font-size: 10px; padding: 4px 10px; }

  .jp-diagnostics { width: calc(100vw - 24px); top: auto; bottom: 80px; right: 12px; }
}

@media (max-width: 400px) {
  .jp-controls .jp-btn:not(.play-btn) { display: none; }
  .jp-controls .jp-btn[data-action="prev"],
  .jp-controls .jp-btn[data-action="next"] { display: none; }
}
