.playlist-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  padding: 32px;
  max-width: 900px;
  margin: 0 auto;
}

.now-playing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.now-playing-img {
  width: 240px;
  height: 240px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.volume-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

/* Scrollable Sidebar Tracklist */
.tracklist-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.track-list {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--panel-bg);
}

.track-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.track-item:last-child {
  border-bottom: none;
}

.track-item:hover,
.track-item.active {
  background-color: var(--bg-color);
  color: var(--accent);
  font-weight: bold;
}

/* Animated pulse effect when music plays */
.now-playing-img.playing {
  animation: pulse-glow 2s infinite alternate ease-in-out;
}

@keyframes pulse-glow {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
  }
  100% {
    transform: scale(1.03);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
  }
}

/* Core Desktop CSS Grid Layout */
.playlist-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  padding: 2rem;
}

/* Media Query 1: Tablet View */
@media (max-width: 900px) {
  .playlist-layout {
    grid-template-columns: 1fr; /* Stacks player on top of tracklist */
    gap: 1.5rem;
  }
}

/* Media Query 2: Mobile View */
@media (max-width: 480px) {
  .playlist-layout {
    padding: 1rem;
  }
  .controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
}