/* ============================================================
   Dynamic Persistent Audio Player — v1.0.1
   Fixed-bottom player bar injected on every front-end page.
   ============================================================ */

:root {
  --dpa-bg:       #0c0c1a;
  --dpa-surface:  #131326;
  --dpa-border:   #2b2b4e;
  --dpa-primary:  #ff6b35;
  --dpa-secondary:#f7931e;
  --dpa-grad:     linear-gradient(135deg,#ff6b35,#f7931e);
  --dpa-text:     #e2e2f0;
  --dpa-muted:    #7a7a9e;
  --dpa-white:    #ffffff;
  --dpa-t:        .18s ease;
  --dpa-h:        68px;
}

/* ── Soft-nav loading indicator ───────────────────────────── */
/* Subtle body fade + progress cursor while fetching a page  */
html.dpa-loading {
  cursor: progress;
}
html.dpa-loading body {
  opacity: .92;
  transition: opacity .15s ease;
  pointer-events: none;  /* block accidental double-clicks */
}
/* Always keep the player bar interactive during loads */
html.dpa-loading #dpa-bar {
  pointer-events: auto;
}

/* ── Bar ──────────────────────────────────────────────────── */
#dpa-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  height: var(--dpa-h);
  background: var(--dpa-bg);
  border-top: 1px solid var(--dpa-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -6px 30px rgba(0,0,0,.55);
  box-sizing: border-box;
}

#dpa-bar.dpa-visible {
  transform: translateY(0);
}

/* push page content up so nothing hides behind the bar */
body.dpa-active {
  padding-bottom: var(--dpa-h) !important;
  transition: padding-bottom 0.3s cubic-bezier(.4,0,.2,1);
}

/* ── Album art ────────────────────────────────────────────── */
#dpa-art {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--dpa-surface);
  border: 1px solid var(--dpa-border);
}

#dpa-art[src=""] { visibility: hidden; }

/* ── Track info ───────────────────────────────────────────── */
#dpa-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

#dpa-title {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: .88em;
  font-weight: 700;
  color: var(--dpa-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#dpa-artist {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: .74em;
  color: var(--dpa-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Transport controls ───────────────────────────────────── */
#dpa-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.dpa-btn {
  background: none;
  border: none;
  color: var(--dpa-text);
  font-size: .95em;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dpa-t), color var(--dpa-t);
  line-height: 1;
  flex-shrink: 0;
  font-family: inherit;
}

.dpa-btn:hover {
  background: rgba(255,107,53,.15);
  color: var(--dpa-primary);
}

.dpa-btn--play {
  background: var(--dpa-grad);
  color: var(--dpa-white) !important;
  width: 40px;
  height: 40px;
  font-size: 1em;
  box-shadow: 0 2px 10px rgba(255,107,53,.4);
}

.dpa-btn--play:hover {
  background: var(--dpa-grad) !important;
  opacity: .88;
}

.dpa-btn--play.dpa-playing::before {
  /* swap icon via JS — CSS just ensures correct color */
  color: var(--dpa-white);
}

/* ── Progress bar ─────────────────────────────────────────── */
#dpa-progress-wrap {
  flex: 2;
  min-width: 80px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#dpa-progress,
#dpa-volume {
  -webkit-appearance: none;
  appearance: none;
  background: var(--dpa-border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  height: 4px;
  width: 100%;
  transition: background var(--dpa-t);
}

/* Filled track colour — updated via JS custom property */
#dpa-progress {
  background: linear-gradient(
    to right,
    var(--dpa-primary) 0%,
    var(--dpa-primary) var(--dpa-pct, 0%),
    var(--dpa-border)  var(--dpa-pct, 0%),
    var(--dpa-border)  100%
  );
}

#dpa-progress::-webkit-slider-thumb,
#dpa-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--dpa-primary);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px rgba(255,107,53,.5);
}

#dpa-progress::-moz-range-thumb,
#dpa-volume::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--dpa-primary);
  cursor: pointer;
  border: none;
}

#dpa-time {
  display: flex;
  justify-content: space-between;
  font-family: 'Segoe UI', sans-serif;
  font-size: .66em;
  color: var(--dpa-muted);
  user-select: none;
}

/* ── Volume ───────────────────────────────────────────────── */
#dpa-vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#dpa-mute { font-size: .85em; width: 28px; height: 28px; }

#dpa-volume { width: 72px; }

/* ── Track counter ────────────────────────────────────────── */
#dpa-track-counter {
  font-family: 'Segoe UI', sans-serif;
  font-size: .7em;
  color: var(--dpa-muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 32px;
  text-align: center;
}

/* ── Close ────────────────────────────────────────────────── */
#dpa-close {
  color: var(--dpa-muted);
  font-size: .78em;
  width: 28px;
  height: 28px;
}

#dpa-close:hover { color: #ef5350; background: rgba(239,83,80,.12); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 680px) {
  #dpa-progress-wrap { display: none; }
  #dpa-vol-wrap { display: none; }
  #dpa-track-counter { display: none; }
  #dpa-bar { gap: 8px; padding: 0 12px; }
}

@media (max-width: 400px) {
  #dpa-art { width: 38px; height: 38px; }
}
