/* Shared player styles for the share page and the embed widget.
   Pages define the CSS variables (--bg, --text, --accent, etc.). */

#track-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--bar-height) + var(--safe-bottom));
}

.track {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--row-border);
  transition: background 0.1s;
  gap: 14px;
}

.track:hover { background: var(--bg-hover); }
.track:active { background: var(--bg-active); }

.track.active {
  background: var(--bg-active);
  color: var(--accent);
}

.track-index {
  width: 28px;
  text-align: right;
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.track.active .track-index { color: var(--accent); }

.track-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-duration {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Playlist share button (share page header and embed header). */
.share-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-line, var(--bar-border));
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.share-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.share-btn:active { opacity: 0.6; }

@media (max-width: 520px) {
  .share-btn { padding: 8px; }
  .share-btn-label { display: none; }
}

/* Per-track share button: revealed on row hover or keyboard focus; always
   visible where hover does not exist (touch). */
.track-share {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.track:hover .track-share,
.track:focus-within .track-share,
.track-share:focus-visible { opacity: 1; }
.track-share:hover { color: var(--text); }
.track-share:active { opacity: 0.6; }
.track-share svg { width: 16px; height: 16px; display: block; }

@media (hover: none) {
  .track-share { opacity: 1; }
}

#player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 11, 10, 0.66);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--bar-border, rgba(255,255,255,0.09));
  padding: 14px 24px calc(14px + var(--safe-bottom));
  z-index: 10;
}
#player-bar > * { max-width: 780px; margin-left: auto; margin-right: auto; }

#now-playing {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 18px;
}

#progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#progress-container {
  flex: 1;
  height: 6px;
  background: var(--progress-bg);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  touch-action: none;
}

#progress-loaded {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--progress-loaded);
  border-radius: 3px;
  pointer-events: none;
}

#progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--progress-fg);
  border-radius: 3px;
  pointer-events: none;
  transition: width 0.1s linear;
}

.time {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
}

.time-left { text-align: right; }
.time-right { text-align: left; }

#controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
}

#controls button {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.1s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

#controls button:active { opacity: 0.6; }

#prev svg, #next svg {
  width: 24px;
  height: 24px;
  fill: var(--text);
  display: block;
}

#play-pause {
  width: 52px;
  height: 52px;
  background: var(--accent);
  position: relative;
}

#play-pause:active { opacity: 0.75; }

#play-pause svg {
  width: 52px;
  height: 52px;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#icon-play  { opacity: 1;  transform: scale(1);    }
#icon-pause { opacity: 0;  transform: scale(0.85); }

.is-playing #icon-play  { opacity: 0;  transform: scale(0.85); }
.is-playing #icon-pause { opacity: 1;  transform: scale(1);    }

.player-toast {
  position: fixed;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-active);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 99;
}
