/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* BODY */
body {
  font-family: 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;

  background: linear-gradient(135deg, #ff7eb3, #4facfe, #ffbc00);
  background-size: 300% 300%;
  animation: bg 10s ease infinite;

  color: white;
}

@keyframes bg {
  0% { background-position: 0% }
  50% { background-position: 100% }
  100% { background-position: 0% }
}

/* APP LAYOUT */
.app {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* ================= PLAYER ================= */
.music-player {
  width: 320px;
  height: 550px;
  padding: 20px;
  border-radius: 20px;
  backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.1);
  text-align: center;
  box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

/* ALBUM */
#album-cover {
  width: 90%;
  border-radius: 50%;
  transition: 0.4s;
}
.music-player.playing #album-cover {
  animation: spin 8s linear infinite;
}
#album-cover:hover { transform: scale(1.05); }
@keyframes spin { to { transform: rotate(360deg); } }

/* SONG TITLE */
#song-title {
  margin-top: 10px;  
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(90deg, #962e59, #1e64a1);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ARTIST */
#song-artist {
  font-size: 14px;
  margin-top: 4px;
  background: linear-gradient(90deg, #9c7300, #ca0155);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* CONTROLS */
.controls {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.controls button {
  flex: 0 0 auto;
  padding: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  transition: 0.25s;
  min-width: 44px; /* thumb-friendly */
}
.controls button:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ACTIVE BUTTONS */
#shuffle-button.active,
#repeat-button.active {
  background: linear-gradient(135deg, #ff7eb3, #4facfe);
  box-shadow: 0 0 10px rgba(255, 126, 179, 0.6);
  transform: scale(1.1);
}

/* PROGRESS BAR */
#progress-bar {
  appearance: none;
  width: 100%;
  height: 6px;
  margin-top: 20px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ff7eb3, #4facfe, #ffbc00);
  background-size: 300% 300%;
  transition: background-position 0.3s linear;
  cursor: pointer;
}
#progress-bar::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

/* TIME */
#time-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 3px;
}

/* VOLUME */
.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
}
#volume { flex: 1; }

/* ================= PLAYLIST ================= */
.playlist {
  width: 300px;
  height: 480px;
  padding: 15px;
  border-radius: 20px;
  backdrop-filter: blur(15px);
  background: #4b1ea12b;
  display: flex;
  flex-direction: column;
}
.playlist h3 {
  position: sticky;
  top: 0;
  color: #74133a;
  background: rgba(71, 71, 71, 0.07);
  padding: 5px;
  z-index: 10;
}

/* SEARCH */
#search {
  width: 100%;
  padding: 8px;
  margin: 10px 0;
  border-radius: 10px;
  border: none;
  outline: none;
}

/* SCROLL AREA */
.song-container {
  max-height: 480px;
  overflow-y: auto;
}

/* SONG ITEM */
.song-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  margin-bottom: 5px;
  cursor: pointer;
  background: rgba(255,255,255,0.08);
  transition: 0.25s;
}
.song-item:hover {
  background: rgba(255,255,255,0.2);
  transform: translateX(6px);
}
.song-item img { width: 40px; border-radius: 8px; }
.song-info { display: flex; flex-direction: column; }

/* ACTIVE SONG */
.song-item.active {
  background: linear-gradient(90deg, #fd8ebc, #83c3fb);
  transform: scale(1.03);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
  border: 2px solid #fff;
  animation: pulse 1.5s infinite;
}

/* SONG TITLE */
.song-title {
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(90deg, #7c3630, #6d5a0f);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* SONG ARTIST */
.song-artist {
  font-size: 12px;
  background: linear-gradient(90deg, #112d46, #0b5558);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes pulse {
  0% { box-shadow: 0 0 10px rgba(255,255,255,0.6); }
  50% { box-shadow: 0 0 20px rgba(255,255,255,0.9); }
  100% { box-shadow: 0 0 10px rgba(255,255,255,0.6); }
}

/* EMPTY STATE */
#empty-state { text-align: center; display: none; margin-top: 10px; }

/* SCROLLBAR */
.song-container::-webkit-scrollbar { width: 5px; }
.song-container::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.4);
  border-radius: 10px;
}

/* 📱 Mobile layout: player above, playlist below */
@media (max-width: 768px) {
  .app {
    flex-direction: column;   
    align-items: center;
    gap: 20px;
    padding: 10px;
  }

  .music-player {
    position: relative;       
    width: 100%;
    max-width: 400px;
    height: 580px;
    margin-bottom: 20px;      
    border-radius: 15px;
  }

  .playlist {
    width: 100%;
    max-width: 400px;
    height: 450px;
    margin-bottom: 20px;
    max-height: calc(100vh - 300px); 
    overflow-y: auto;
  }
}
