/* === Theme Variables === */
:root {
  --bg: #f0f0f0;
  --text: #111;
  --card: #ffffff;
  --accent: #ff5e57;
  --secondary: #e2e2e2;
  --input: #ccc;
  --hover: #ff5e57;
}

body.dark {
  --bg: #121212;
  --text: #fff;
  --card: #1e1e1e;
  --accent: #ff5e57;
  --secondary: #2c2c2c;
  --input: #444;
  --hover: #ff5e57;
}

body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  padding: 30px 20px;
  text-align: center;
  transition: background 0.4s ease, color 0.4s ease;
}

* {
  transition: background 0.3s ease, color 0.3s ease, border 0.3s ease;
}

/* === Header === */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2.5rem;
  font-weight: bold;
  background: linear-gradient(90deg, #ff6a00, #ee0979, #00c3ff);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 5px rgba(255,255,255,0.3), 0 0 15px var(--accent);
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    text-shadow: 0 0 5px rgba(255,255,255,0.3), 0 0 15px var(--accent);
  }
  50% {
    text-shadow: 0 0 10px rgba(255,255,255,0.6), 0 0 25px var(--accent);
  }
}

/* === Theme Toggle === */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--input);
  transition: 0.4s;
  border-radius: 50px;
}

.theme-switch .slider:before {
  position: absolute;
  content: "";
  height: 20px; width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text);
  transition: 0.4s;
  border-radius: 50%;
}

.theme-switch input:checked + .slider {
  background-color: var(--accent);
}

.theme-switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* === Main Player === */
.main-player {
  max-width: 400px;
  margin: auto;
  background: var(--card);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

#cover {
  width: 100%;
  border-radius: 15px;
  margin-bottom: 10px;
  opacity: 1;
  transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

#cover.fade-out {
  opacity: 0;
  transform: scale(0.95);
}

#cover.fade-in {
  opacity: 1;
  transform: scale(1);
}

.song-info h2 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--text);
}

.song-info p {
  margin: 5px 0;
  color: var(--text);
  opacity: 0.8;
  font-size: 0.9rem;
}

/* === Controls === */
.controls button {
  font-size: 24px;
  margin: 0 15px;
  background: var(--secondary);
  border: none;
  padding: 10px 15px;
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  transition: 0.3s;
}

.controls button:hover {
  background: var(--hover);
  color: #fff;
}

/* === Progress === */
.progress-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
}

#progress {
  flex: 1;
  margin: 0 10px;
  accent-color: var(--accent);
}

/* === Volume === */
.volume-container {
  margin-top: 15px;
}

.volume-container input {
  width: 100px;
  accent-color: var(--accent);
}

/* === Playlist === */
.playlist {
  margin-top: 50px;
  padding: 0 20px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.playlist h3 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  color: var(--text);
}

#search {
  padding: 10px;
  width: 100%;
  max-width: 400px;
  border-radius: 10px;
  border: none;
  margin: 0 auto 20px;
  background: var(--input);
  color: var(--text);
  display: block;
}

#trackList {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 600px;
}

#trackList li {
  background: var(--secondary);
  padding: 12px 20px;
  margin: 10px 0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#trackList li:hover {
  background: var(--hover);
  color: #fff;
}

/* === Add Song Button === */
#addSongBtn {
  display: block;
  margin: 30px auto 0;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease;
}

#addSongBtn:hover {
  background: #e64e48;
}

/* === Add Song Form === */
.add-song-form {
  display: none; /* Hidden by default, toggled by JS */
  margin: 40px auto;
  max-width: 400px;
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  text-align: left;
}

.add-song-form input {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: var(--input);
  color: var(--text);
}

.add-song-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.3s ease;
  width: 100%;
  font-size: 1rem;
}

.add-song-form button:hover {
  background: #e64e48;
}

/* === Responsive === */
@media screen and (max-width: 768px) {
  .main-player {
    width: 100%;
  }

  #search {
    width: 100%;
  }

  .controls button {
    font-size: 20px;
    padding: 8px 12px;
  }

  .progress-container span {
    font-size: 0.8rem;
  }
}
