/* Reset some defaults */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(to right, #fbc2eb, #a6c1ee);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  transition: background 0.3s, color 0.3s;
  color: #333;
}

.player {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  text-align: center;
  width: 90%;
  max-width: 420px;
  transition: background 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#playlistForm {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0;
}

#playlistName {
  flex: 1;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

#playlistForm button {
  padding: 0.5rem 1rem;
  background: #a57aff;
  color: white;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

#playlistForm button:hover:not(:disabled) {
  background: #8e63e8;
}

#playlistSelector {
  width: 100%;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
  margin-bottom: 1rem;
}

#fileInput {
  margin-bottom: 1rem;
  width: 100%;
}

#playlist {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #ccc;
}

#playlist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 8px;
  background: #f3f3f3;
  margin: 4px 0;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
}

#playlist li:hover {
  background: #d3c0ff;
}

#playlist li.active {
  background: #a57aff;
  color: white;
  font-weight: bold;
}

.song-name {
  flex: 1;
  text-align: left;
  user-select: none; /* prevent accidental selection */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#playlist li button {
  font-size: 1rem;
  padding: 2px 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #555;
  transition: color 0.2s;
}

#playlist li button:hover {
  color: #a57aff;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

#progress {
  width: 100%;
  cursor: pointer;
}

button {
  font-size: 1.5rem;
  padding: 0.5rem 1rem;
  border: none;
  background: #a57aff;
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

button:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.playlist-controls {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist-controls button {
  font-size: 1rem;
  padding: 0.3rem 0.5rem;
  background: #f3f3f3;
  color: #333;
  border-radius: 6px;
  border: 1px solid #ccc;
  transition: background 0.2s;
}

.playlist-controls button:hover {
  background: #ddd;
}

/* Grouped controls */
.main-controls {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin: 1rem 0 0.5rem 0;
}

.extras {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.extras input[type="range"] {
  width: 80px;
  cursor: pointer;
}

#toggleTheme {
  padding: 0.3rem 0.6rem;
  font-size: 1.2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.3s;
}

#toggleTheme:hover {
  color: #a57aff;
}

/* Dark Mode */
body.dark {
  background: linear-gradient(to right, #1f1c2c, #928dab);
  color: white;
}

body.dark .player {
  background: #2e2c3a;
  color: white;
}

body.dark button {
  background: #6d6b8d;
  color: white;
}

body.dark #playlist {
  border-color: #555;
}

body.dark #playlist li {
  background: #413f57;
  color: white;
}

body.dark #playlist li.active {
  background: #a57aff;
  color: white;
}
