/* Music Player Styles - HTML5 audio player with responsive playlist
 * Adapted from player/style.css and optimized for Rails app theme
 */

/* Audio Player Wrapper */
#music-player-wrap {
  max-width: 900px;
  margin: 0 auto 40px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
}

/* Now Playing Bar */
#nowPlay {
  background: var(--bg-tertiary);
  padding: 21px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

#npAction {
  color: var(--text-secondary);
  font-size: 16px;
}

#npTitle {
  color: var(--text-primary);
  font-size: 16px;
  flex: 1;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 20px;
}

/* Audio Controls Wrapper */
#audiowrap {
  background: var(--bg-tertiary);
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
}

#audio0 {
  margin-bottom: 10px;
}

audio {
  width: 100%;
  outline: none;
}

/* Previous/Next Buttons */
#tracks {
  min-height: 60px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
}

a[id^="btn"] {
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 24px;
  width: 60px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
}

#btnDownload {
  font-size: 20px;
}

a[id^="btn"]:hover,
a[id^="btn"]:active {
  background: var(--border-color);
  transform: scale(1.05);
}

/* Playlist Wrapper */
#plwrap {
  max-height: calc(100vh - 450px);
  overflow-y: auto;
  scrollbar-width: thin;
}

#plwrap::-webkit-scrollbar {
  width: 8px;
}

#plwrap::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

#plwrap::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

#plwrap::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Playlist */
#plList {
  margin: 0;
  padding: 0;
  list-style: none;
}

#plList li {
  background: var(--bg-secondary);
  cursor: pointer;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s;
}

#plList li:hover {
  background: var(--bg-tertiary);
}

#plList li:last-child {
  border-bottom: none;
}

/* Playlist Item */
.plItem {
  position: relative;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 21px;
}

.plNum {
  width: 40px;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
}

.plTitle {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 16px;
}

.plTags {
  color: var(--text-secondary);
  font-size: 13px;
  flex-shrink: 0;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Selected Track */
.plSel,
.plSel:hover {
  background: var(--accent) !important;
  cursor: default !important;
}

.plSel .plNum,
.plSel .plTitle,
.plSel .plTags {
  color: #0d1824 !important;
  font-weight: 500;
}

/* Responsive Design */
@media only screen and (max-width: 768px) {
  #music-player-wrap {
    margin: 0 0 40px;
  }

  #nowPlay {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  #npTitle {
    text-align: left;
    margin-left: 0;
  }

  .plTags {
    display: none;
  }

  a[id^="btn"] {
    font-size: 40px;
    padding: 0 20px 8px;
  }

  #tracks {
    min-height: 50px;
  }
}

@media only screen and (max-width: 480px) {
  .plItem {
    padding: 0 15px;
  }

  .plNum {
    width: 35px;
    font-size: 14px;
  }

  .plTitle {
    font-size: 14px;
  }

  a[id^="btn"] {
    font-size: 35px;
    padding: 0 15px 6px;
  }
}
