/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--accent-gold);
  color: var(--bg-primary);
  border-color: var(--accent-gold);
}
.btn-primary:hover {
  background: var(--accent-gold-bright);
  color: var(--bg-primary);
  box-shadow: var(--shadow-gold-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}
.btn-outline:hover {
  background: rgba(212, 162, 76, 0.12);
  color: var(--accent-gold-bright);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--accent-gold); }

.btn-large {
  padding: 16px 32px;
  font-size: 17px;
}

/* ============ ICON BUTTON ============ */
.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--accent-gold); background: rgba(212, 162, 76, 0.1); }
.icon-btn.active { color: var(--accent-gold); }
.icon-btn.active svg { fill: var(--accent-gold); }

.icon-btn.large { width: 56px; height: 56px; }
.icon-btn.large svg { width: 28px; height: 28px; }

.icon-btn.xlarge { width: 80px; height: 80px; background: var(--accent-gold); color: var(--bg-primary); }
.icon-btn.xlarge svg { width: 32px; height: 32px; }
.icon-btn.xlarge:hover { background: var(--accent-gold-bright); transform: scale(1.04); box-shadow: var(--shadow-gold-glow); }

/* ============ ALBUM CARD ============ */
.album-card {
  display: block;
  position: relative;
  cursor: pointer;
  transition: transform var(--duration-normal) var(--ease-emphasis),
              filter var(--duration-normal) var(--ease-standard);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
}

.album-card:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 0 24px rgba(212, 162, 76, 0.4));
}
.album-card:hover .album-card-art { box-shadow: var(--shadow-card-hover); }
.album-card:hover .album-card-info { transform: translateY(-3px); }
.album-card:hover .border-trace { stroke-dashoffset: 0; }

.album-card-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-secondary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: box-shadow var(--duration-normal) var(--ease-standard);
}
.album-card-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.album-card .border-trace {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
}
.album-card .border-trace rect {
  fill: none;
  stroke: var(--accent-gold);
  stroke-width: 1;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  transition: stroke-dashoffset 600ms var(--ease-emphasis);
}

.album-card-info {
  padding: 12px 4px 4px;
  transition: transform var(--duration-normal) var(--ease-emphasis);
}
.album-card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0 0 4px;
}
.album-card-meta {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============ TRACK ROW ============ */
.track-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 6px;
  border-bottom: 1px solid var(--separator);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-standard);
  position: relative;
}
.track-row:hover { background: rgba(212, 162, 76, 0.06); }
.track-row.playing { background: rgba(212, 162, 76, 0.1); }
.track-row.playing::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent-gold);
  border-radius: 0 2px 2px 0;
}

.track-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}
.track-row.playing .track-num { display: none; }
.track-row.playing .playing-indicator { display: inline-flex; }

.playing-indicator {
  display: none;
  gap: 2px;
  align-items: end;
  height: 14px;
  justify-content: center;
}
.playing-indicator span {
  display: block;
  width: 2px;
  background: var(--accent-gold);
  border-radius: 1px;
  animation: bars 1s ease-in-out infinite;
}
.playing-indicator span:nth-child(1) { height: 60%; animation-delay: 0s; }
.playing-indicator span:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.playing-indicator span:nth-child(3) { height: 40%; animation-delay: 0.4s; }
@keyframes bars {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

.track-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-row.playing .track-title { color: var(--accent-gold); }

.track-duration {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  min-width: 50px;
}

.track-action {
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  border-radius: 50%;
  transition: color var(--duration-fast) var(--ease-standard);
}
.track-action svg { width: 18px; height: 18px; }
.track-action:hover { color: var(--accent-gold); background: rgba(212, 162, 76, 0.1); }
.track-action.active { color: var(--accent-gold); }
.track-action.active svg { fill: var(--accent-gold); }

.track-lyrics {
  grid-column: 2 / -1;
  display: none;
  padding: 16px 0 8px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
}
.track-row.expanded .track-lyrics {
  display: block;
  animation: reveal-lyrics 350ms var(--ease-standard);
}
.track-lyrics .marker {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-sans);
  display: block;
  margin-top: 12px;
}
.track-lyrics mark {
  background: var(--accent-gold);
  color: var(--bg-primary);
  padding: 0 4px;
  border-radius: 2px;
}

@keyframes reveal-lyrics {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .track-row { grid-template-columns: 24px 1fr auto auto; gap: 10px; padding: 10px 8px; }
  .track-row .lyrics-toggle { display: none; }
}

/* ============ PLAYER BAR ============ */
.player-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--player-bar-height);
  background: rgba(20, 20, 26, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--hairline-gold);
  z-index: 90;
  display: none;
  flex-direction: column;
  transition: transform var(--duration-normal) var(--ease-emphasis);
}
body.has-player .player-bar { display: flex; }

.player-progress {
  width: 100%;
  height: 3px;
  background: var(--bg-tertiary);
  cursor: pointer;
  position: relative;
  transition: height var(--duration-fast) var(--ease-standard);
}
.player-progress:hover { height: 6px; }
.player-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gold);
  transition: width 100ms linear;
  box-shadow: 0 0 8px rgba(212, 162, 76, 0.5);
}

.player-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
}

.player-track {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  min-width: 0;
}
.player-track:hover .player-track-title { color: var(--accent-gold); }

.player-art {
  width: 56px; height: 56px;
  border-radius: 4px;
  border: 1px solid var(--hairline-gold);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg-tertiary);
}

.player-track-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.player-track-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--duration-fast) var(--ease-standard);
}
.player-track-album {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-secondary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.player-secondary .volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-secondary .volume {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 2px;
  cursor: pointer;
}
.player-secondary .volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px; height: 12px;
  background: var(--accent-gold);
  border-radius: 50%;
  cursor: pointer;
}
.player-secondary .volume::-moz-range-thumb {
  width: 12px; height: 12px;
  background: var(--accent-gold);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

@media (max-width: 720px) {
  .player-main { grid-template-columns: 1fr auto; }
  .player-secondary { display: none; }
  .player-controls .shuffle-btn,
  .player-controls .repeat-btn { display: none; }
}

/* The breathing waveform overlay above the player progress */
.player-waveform {
  position: absolute;
  left: 0; right: 0;
  top: -1px;
  pointer-events: none;
  height: 16px;
  opacity: 0.5;
  display: none;
}
body.has-player.is-playing .player-waveform { display: block; }
.player-waveform path {
  fill: none;
  stroke: var(--accent-gold);
  stroke-width: 1;
  stroke-dasharray: 8 6;
  animation: wave-dash 4s linear infinite;
}
@keyframes wave-dash {
  to { stroke-dashoffset: -56; }
}

/* ============ NOW PLAYING ============ */
.now-playing {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 150;
  display: none;
  overflow-y: auto;
  animation: fade-up 350ms var(--ease-emphasis);
}
.now-playing.open { display: block; }

.np-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.4) saturate(1.2);
  transform: scale(1.1);
  z-index: 0;
}
.np-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,10,15,0.6), rgba(10,10,15,0.9));
}

.np-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.np-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  border-radius: 50%;
}
.np-close:hover { color: var(--accent-gold); background: rgba(212, 162, 76, 0.12); }
.np-close svg { width: 24px; height: 24px; }

.np-art {
  width: min(360px, 80vw);
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--hairline-gold);
  object-fit: cover;
  margin: 32px 0;
  box-shadow: 0 0 40px rgba(212, 162, 76, 0.25), 0 12px 48px rgba(0,0,0,0.6);
  transition: transform 60s linear;
}
body.is-playing .np-art {
  animation: spin-art 60s linear infinite, glow-pulse 4s ease-in-out infinite;
}
@keyframes spin-art {
  to { transform: rotate(360deg); }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(212, 162, 76, 0.25), 0 12px 48px rgba(0,0,0,0.6); }
  50% { box-shadow: 0 0 60px rgba(212, 162, 76, 0.45), 0 12px 48px rgba(0,0,0,0.6); }
}

.np-title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  color: var(--text-primary);
  margin: 8px 0 4px;
}

.np-album {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
}
.np-album:hover { color: var(--accent-gold); }

.np-scrubber {
  width: 100%;
  margin: 32px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.np-scrubber-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}
.np-scrubber-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gold);
  border-radius: 2px;
  transition: width 100ms linear;
}
.np-scrubber-bar::after {
  content: "";
  position: absolute;
  top: -16px; bottom: -16px;
  left: 0; right: 0;
}
.np-scrubber-times {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
}

.np-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0 16px;
}

.np-secondary {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 24px;
}

.np-lyrics {
  width: 100%;
  margin-top: 32px;
  padding: 24px;
  border-top: 1px solid var(--hairline-gold);
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  text-align: left;
  display: none;
}
.np-lyrics.open {
  display: block;
  animation: reveal-lyrics 400ms var(--ease-standard);
}
.np-lyrics .marker {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-sans);
  display: block;
  margin-top: 16px;
}
.np-lyrics .line {
  opacity: 0;
  animation: line-rise 400ms var(--ease-emphasis) forwards;
}

@keyframes line-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ FORM ============ */
.search-input {
  width: 100%;
  font-family: var(--font-serif);
  font-size: 28px;
  padding: 18px 8px;
  border-bottom: 1px solid var(--separator);
  caret-color: var(--accent-gold);
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.search-input::placeholder { color: var(--text-tertiary); font-style: italic; }
.search-input:focus { border-bottom-color: var(--accent-gold); outline: none; }

/* ============ BADGE / CHIP ============ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--accent-gold);
  background: transparent;
  border: 1px solid var(--hairline-gold);
  border-radius: 999px;
}
.chip:hover { background: rgba(212, 162, 76, 0.1); }
.chip.active { background: var(--accent-gold); color: var(--bg-primary); border-color: var(--accent-gold); }
