/* ============================================
   GENIUS-STYLE MUSIC PLAYER CSS
   Uses Wikipedia Theme Colors & Layout
   ============================================ */

/* Music Player Main Container */
.music-player-container {
  display: grid;
  grid-template-columns: 1fr 350px;  /* lyrics | annotations sidebar */
  grid-template-rows: 1fr;           /* content only - control bar is fixed */
  gap: 20px;
  min-height: calc(100vh - 250px);
  /* padding: 20px; */
  padding-bottom: 100px;  /* Space for fixed control bar */
  background-color: var(--background-color);
}

/* ============================================
   TRACK LISTING (music.html)
   ============================================ */

.track-listing {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.track-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  margin: 20px 50px 0px 0px;
  background-color: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.track-card:hover {
  border-color: var(--links-color);
  background-color: var(--hover-background, rgba(0, 0, 0, 0.02));
  transform: translateX(5px);
}

.track-info {
  flex: 1;
}

.track-title {
  margin: 0 0 5px 0;
  font-size: 1.1em;
  color: var(--links-color);
}

.track-artist {
  margin: 0 0 3px 0;
  color: var(--text-color);
  font-size: 0.95em;
}

.track-album {
  margin: 0;
  color: var(--dark-grey);
  font-size: 0.85em;
}

.track-play-icon {
  font-size: 1.5em;
  color: var(--links-color);
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.track-card:hover .track-play-icon {
  opacity: 1;
}

/* ============================================
   LYRICS CONTAINER (Left/Center)
   ============================================ */

.lyrics-container {
  grid-column: 1;
  grid-row: 1;
  overflow-y: auto;
  padding: 5px 5px;
  scroll-behavior: smooth;
  /* Fixed height for internal scrolling - user controls page scroll */
  max-height: calc(100vh - 300px);
}

.lyric-line {
  padding: 12px 20px;
  margin: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2em;
  line-height: 1.6;
  font-family: Georgia, serif;
  color: var(--text-color);
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lyric-line:hover {
  background-color: var(--hover-background, rgba(0, 0, 0, 0.05));
}

/* Active line (currently playing) - Genius yellow with Wikipedia theme */
.lyric-line.active-line {
  background-color: rgba(255, 255, 0, 0.15);  /* Soft yellow highlight */
  font-weight: 600;
  border-left: 4px solid rgba(255, 255, 0, 0.8);
  padding-left: 16px;
  box-shadow: inset 0 0 10px rgba(255, 255, 0, 0.1);
}

/* Dark mode adjustment for active line */
[data-theme="dark"] .lyric-line.active-line {
  background-color: rgba(255, 255, 0, 0.08);
  border-left-color: rgba(255, 255, 0, 0.6);
}

/* Lines with annotations - dotted underline */
.lyric-line[data-has-annotation="true"] {
  border-bottom: 2px dotted var(--links-color);
}

/* Annotation indicator emoji */
.annotation-indicator {
  margin-left: 10px;
  font-size: 0.8em;
  opacity: 0.5;
  flex-shrink: 0;
}

.lyric-line[data-has-annotation="true"]:hover .annotation-indicator {
  opacity: 1;
}

/* Temporary highlight when clicking annotation */
.lyric-line.annotation-focused {
  background-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .lyric-line.annotation-focused {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Placeholder text */
.placeholder-lyrics {
  text-align: center;
  color: var(--dark-grey);
  padding: 40px;
  font-style: italic;
}

/* ============================================
   ANNOTATIONS SIDEBAR (Right)
   ============================================ */

.annotations-sidebar {
  grid-column: 2;
  grid-row: 1;
  overflow-y: auto;
  padding: 20px;
  background-color: var(--card-background);
  border-left: 1px solid var(--border-color);
  scroll-behavior: smooth;
  /* Match lyrics container height for consistent scrolling */
  max-height: calc(100vh - 300px);
}

.annotations-title {
  margin-bottom: 20px;
  color: var(--text-color);
  font-size: 1.1em;
  font-weight: 600;
}

.annotation-card {
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.annotation-card:hover {
  border-color: var(--links-color);
  box-shadow: 0 2px 8px var(--shadow-color, rgba(0, 0, 0, 0.1));
}

.annotation-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.annotation-author {
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95em;
}

/* Verified artist annotations - golden highlight */
.annotation-author.verified {
  color: #f4c430;
  font-weight: 700;
}

.annotation-date {
  font-size: 0.85em;
  color: var(--dark-grey);
}

.annotation-quote {
  font-style: italic;
  color: var(--dark-grey);
  border-left: 3px solid var(--links-color);
  padding-left: 12px;
  margin: 12px 0;
  line-height: 1.5;
}

.annotation-content {
  font-size: 0.95em;
  line-height: 1.5;
  color: var(--text-color);
}

.annotation-content p {
  margin: 8px 0;
}

.annotation-content strong {
  font-weight: 600;
}

.annotation-footer {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.vote-btn {
  background-color: var(--hover-background, rgba(0, 0, 0, 0.05));
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.9em;
  color: var(--text-color);
  transition: all 0.2s ease;
}

.vote-btn:hover {
  background-color: var(--border-color);
  transform: scale(1.05);
}

.placeholder-annotations {
  text-align: center;
  color: var(--dark-grey);
  padding: 20px;
  font-style: italic;
}

/* ============================================
   CONTROL BAR (Fixed Bottom - snaps above footer)
   ============================================ */

.music-controls-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--card-background);
  border-top: 1px solid var(--border-color);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  z-index: 100;
  transition: bottom 0.1s ease-out;
}

/* When snapped above footer */
.music-controls-bar.snapped-above-footer {
  position: absolute;
  bottom: auto;
}

/* Left: Album art + playback controls */
.controls-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.control-album-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Center: Progress bar + time display */
.controls-center {
  flex: 1;
  display: flex;
  gap: 15px;
  align-items: center;
  min-width: 200px;
}

.time-current,
.time-total {
  font-size: 0.9em;
  font-family: monospace;
  color: var(--dark-grey);
  min-width: 45px;
  text-align: center;
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  min-width: 100px;
}

.progress-bar-filled {
  height: 100%;
  background-color: var(--links-color);
  border-radius: 4px;
  transition: width 0.05s linear;
  position: relative;
}

/* Progress bar thumb/dot for easy sliding */
.progress-bar-filled::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-color: var(--links-color);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.progress-bar-container:hover .progress-bar-filled::after {
  transform: translateY(-50%) scale(1.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* When dragging, keep thumb visible and larger */
.progress-bar-container:active .progress-bar-filled::after {
  transform: translateY(-50%) scale(1.3);
}

/* Right: Volume controls */
.controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume-slider {
  width: 80px;
  cursor: pointer;
  accent-color: var(--links-color);
}

/* Control buttons styling */
.control-btn {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: var(--text-color);
  transition: transform 0.2s ease;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-btn:hover {
  transform: scale(1.15);
}

.control-btn:active {
  transform: scale(0.95);
}

.play-btn {
  font-size: 2em;
}

/* Hidden audio element */
#audioPlayer {
  display: none;
}

/* ============================================
   ERROR & PLACEHOLDER STATES
   ============================================ */

.error-message {
  padding: 40px;
  text-align: center;
  color: #d32f2f;
  font-size: 1.1em;
}

.song-list {
  padding: 40px;
}

.song-list h2 {
  margin-bottom: 20px;
  color: var(--text-color);
}

.song-list-item {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.song-list-item:hover {
  background-color: var(--hover-background);
  border-color: var(--links-color);
}

.song-list-item h3 {
  margin: 0 0 5px 0;
  color: var(--text-color);
}

.song-list-item h3 a {
  color: var(--links-color);
  text-decoration: none;
}

.song-list-item h3 a:hover {
  text-decoration: underline;
}

.song-list-item p {
  margin: 0;
  color: var(--dark-grey);
  font-size: 0.95em;
}

/* ============================================
   MOBILE RESPONSIVE (≤ 850px)
   ============================================ */

@media (max-width: 850px) {
  .music-player-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 15px;
    min-height: auto;
    padding: 15px;
    padding-bottom: 20px;
  }

  .disambiguation {
    /* hidden on mobile */
    display: none;

  }

  /* Lyrics on mobile */
  .lyrics-container {
    grid-column: 1;
    grid-row: 1;
    padding: 20px 15px;
    max-height: calc(100vh - 280px);  /* Account for fixed control bar */
  }

  /* Track listing on mobile */
  .track-listing {
    padding-bottom: 20px;

  }

  .track-card {
    padding: 15px;
  }

  .track-title {
    font-size: 1em;
  }

  .lyric-line {
    padding: 10px 15px;
    font-size: 1.1em;
  }

  .lyric-line.active-line {
    padding-left: 11px;
  }

  /* Annotations toggle button */
  .annotations-toggle-btn {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    padding: 12px;
    background-color: var(--links-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s ease;
  }

  .annotations-toggle-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
  }

  /* Annotations on mobile - hidden by default */
  .annotations-sidebar {
    grid-column: 1;
    grid-row: 2;
    display: none;
    border-left: none;
    border-top: 1px solid var(--border-color);
    max-height: 250px;
    padding: 15px;
  }

  .annotations-sidebar.mobile-visible {
    display: block;
  }

  /* Control bar on mobile - still fixed */
  .music-controls-bar {
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
  }

  .controls-left,
  .controls-center,
  .controls-right {
    width: 100%;
  }

  .controls-center {
    gap: 10px;
  }

  .control-album-art {
    width: 30px;
    height: 30px;
  }

  .control-btn {
    font-size: 1.3em;
  }

  .play-btn {
    font-size: 1.8em;
  }

  .time-current,
  .time-total {
    font-size: 0.85em;
    min-width: 40px;
  }

  .progress-bar-container {
    min-width: 150px;
  }

  .volume-slider {
    width: 60px;
  }

  /* Smaller thumb on mobile */
  .progress-bar-filled::after {
    width: 12px;
    height: 12px;
    right: -5px;
  }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

.lyrics-container::-webkit-scrollbar,
.annotations-sidebar::-webkit-scrollbar {
  width: 8px;
}

.lyrics-container::-webkit-scrollbar-track,
.annotations-sidebar::-webkit-scrollbar-track {
  background-color: var(--background-color);
}

.lyrics-container::-webkit-scrollbar-thumb,
.annotations-sidebar::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 4px;
}

.lyrics-container::-webkit-scrollbar-thumb:hover,
.annotations-sidebar::-webkit-scrollbar-thumb:hover {
  background-color: var(--links-color);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lyric-line {
  animation: fadeIn 0.3s ease;
}

.annotation-card {
  animation: fadeIn 0.3s ease;
}
