
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --background: #000;
  --panel: #121212;
  --panel-hover: #242424;
  --text: #fff;
  --muted: #a7a7a7;
  --accent: #1ed760;
}

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

body {
  font-family: Inter, Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* HEADER */

.topbar {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  background: #000;
}

.topbar h1 {
  font-size: 25px;
  font-weight: 800;
  white-space: nowrap;
}

#searchInput {
  width: 420px;
  max-width: 50%;
  padding: 14px 20px;
  border-radius: 30px;
  border: 1px solid transparent;
  outline: none;
  background: #242424;
  color: #fff;
  font-size: 14px;
}

#searchInput:focus {
  border-color: #777;
}

#contributeBtn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 12px 20px;
  border-radius: 25px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* MAIN LAYOUT */

.main-layout {
  display: grid;
  grid-template-columns:
    minmax(220px, 1fr)
    minmax(300px, 1.6fr)
    minmax(240px, 1fr);
  gap: 8px;
  padding: 0 8px;
  flex: 1;
  min-height: 0;
}

.library,
.home,
.now-playing {
  background: var(--panel);
  border-radius: 8px;
  padding: 24px;
  overflow-y: auto;
  min-width: 0;
}

.library h2,
.home h2,
.now-playing h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

/* LIBRARY */

.library button {
  background: #242424;
  color: #fff;
  border: none;
  border-radius: 25px;
  padding: 12px 18px;
  margin-bottom: 25px;
  cursor: pointer;
}

.library p {
  padding: 15px;
  border-radius: 6px;
  cursor: pointer;
  color: #ddd;
}

.library p:hover {
  background: var(--panel-hover);
}

/* HOME */

.home {
  background: linear-gradient(
    180deg,
    #173d2b 0%,
    #181818 38%,
    #121212 75%
  );
}

.home > p {
  color: var(--muted);
  margin-bottom: 25px;
}

#musicGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

.song-card {
  background: #1c1c1c;
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.song-card:hover,
.song-card:focus-visible {
  background: #292929;
  outline: 2px solid var(--accent);
}

.song-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 12px;
}

.song-card h3 {
  font-size: 14px;
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}

.song-card p {
  color: var(--muted);
  font-size: 12px;
}

/* NOW PLAYING */

.now-playing {
  background: #181818;
}

.now-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 18px;
}

.now-cover[hidden] {
  display: none;
}

#nowTitle {
  font-size: 20px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#nowArtist {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 18px;
}

#visualizer {
  width: 100%;
  height: 85px;
  display: block;
  margin-bottom: 18px;
  background: #202020;
  border-radius: 8px;
}

.lyrics-box {
  background: #292929;
  border-radius: 10px;
  padding: 18px;
}

.lyrics-box h3 {
  font-size: 17px;
  margin-bottom: 14px;
}

.lyrics-content {
  color: #bdbdbd;
  max-height: 210px;
  overflow-y: auto;
  line-height: 1.8;
  font-size: 15px;
}

.lyric-line {
  padding: 5px 0;
  transition: color 0.2s ease;
}

.lyric-line.active {
  color: var(--accent);
  font-weight: 800;
}

/* BOTTOM PLAYER */

.player {
  height: 90px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns:
    minmax(180px, 1fr)
    minmax(280px, 1.5fr)
    minmax(130px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 12px 18px;
  background: #000;
}

.player-song {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#playerCover {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
}

#playerCover[hidden] {
  display: none;
}

.player-song-details {
  min-width: 0;
}

#songInfo {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#playerArtist {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}

.player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.player-controls button {
  background: none;
  border: none;
  color: #b3b3b3;
  cursor: pointer;
  font-size: 19px;
}

.player-controls button:hover {
  color: white;
}

#playBtn {
  width: 34px;
  height: 34px;
  background: white;
  color: black;
  border-radius: 50%;
  font-size: 16px;
}

.progress-container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-container span {
  color: var(--muted);
  font-size: 11px;
  min-width: 30px;
}

#progress {
  flex: 1;
  width: 100%;
  min-width: 0;
}

.player-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

#volume {
  width: 100px;
}

.player input[type="range"] {
  accent-color: white;
  height: 4px;
  cursor: pointer;
}

#shuffleBtn.active,
#repeatBtn.active {
  color: var(--accent);
}

/* UPLOAD DIALOG */

.upload-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(450px, calc(100vw - 32px));
  max-height: 90vh;
  padding: 0;
  border: 1px solid #333;
  border-radius: 14px;
  background: #181818;
  color: white;
  overflow-y: auto;
}

.upload-dialog:not([open]) {
  display: none;
}

.upload-dialog::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.upload-box {
  position: relative;
  padding: 30px;
}

.upload-box h2 {
  font-size: 23px;
  margin-bottom: 8px;
}

.upload-description {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 13px;
}

.upload-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  color: #aaa;
  border: none;
  font-size: 30px;
  cursor: pointer;
}

#uploadForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#uploadForm > label:not(.upload-agreement) {
  font-size: 13px;
  font-weight: 600;
  margin-top: 8px;
}

#uploadForm input:not([type="checkbox"]) {
  width: 100%;
  padding: 12px;
  border-radius: 7px;
  border: 1px solid #444;
  background: #292929;
  color: white;
  font-size: 14px;
}

#uploadForm input[type="file"] {
  cursor: pointer;
}

.upload-agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #ccc;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 12px;
}

.upload-agreement input {
  margin-top: 3px;
}

#uploadStatus {
  font-size: 13px;
  min-height: 18px;
  color: var(--accent);
}

.upload-submit {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 30px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.upload-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* SCROLLBARS */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 8px;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
  .main-layout {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .now-playing {
    display: none;
  }
}

@media (max-width: 650px) {
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  #searchInput {
    min-width: 0;
    flex: 1;
    padding: 10px;
  }

  #contributeBtn {
    padding: 10px;
    font-size: 11px;
  }

  .main-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .library {
    display: none;
  }

  .home {
    padding: 16px;
  }

  .player {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px;
  }

  #playerCover {
    width: 42px;
    height: 42px;
  }

  .player-controls {
    gap: 8px;
  }

  .progress-container,
  .player-right {
    display: none;
  }

  .upload-box {
    padding: 24px;
  }
}

/* ONLINE LOGIN / SIGNUP */

#spotiAuth {
  margin: 18px 0;
  padding: 16px;
  background: #242424;
  border-radius: 10px;
}

#spotiAuth h3 {
  margin-bottom: 10px;
}

#authMessage {
  font-size: 13px;
  color: #b3b3b3;
  line-height: 1.5;
  margin-bottom: 12px;
}

#spotiAuth input {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  background: #333;
  border: 1px solid #555;
  border-radius: 6px;
  color: white;
}

.auth-actions {
  display: flex;
  gap: 10px;
}

.auth-actions button,
#authLogout {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 25px;
  background: #1ed760;
  color: black;
  font-weight: bold;
  cursor: pointer;
}

#authLogout {
  background: #444;
  color: white;
}

#spotiAuth [hidden],
#uploadForm[hidden] {
  display: none !important;
}
