/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:    #1DB954;
  --green-dk: #158a3e;
  --bg:       #0d0d0d;
  --surface:  #181818;
  --surface2: #242424;
  --border:   #333;
  --text:     #e8e8e8;
  --muted:    #888;
  --radius:   12px;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  padding-bottom: 2rem;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green);
}

.logo svg { width: 28px; height: 28px; fill: var(--green); }

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── Now Playing ─────────────────────────────────────────────────────── */
#now-playing-section {
  padding: 1.5rem 0 0.5rem;
}

.now-playing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.now-playing-card .album-art {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}

.now-playing-card .album-art-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 2rem;
}

.now-playing-info { flex: 1; min-width: 0; }
.now-playing-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.now-playing-title {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-playing-artist {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-bar-wrap {
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  margin-top: 0.6rem;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  transition: width 1s linear;
}

.nothing-playing {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 0.5rem 0;
  width: 100%;
}

/* ── Search ──────────────────────────────────────────────────────────── */
#search-section { padding: 1.25rem 0 0.5rem; }

.search-label {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

.search-wrap {
  display: flex;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text);
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--green); }

.btn {
  border: none;
  border-radius: 99px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-green  { background: var(--green); color: #000; }
.btn-green:hover  { background: var(--green-dk); }
.btn-ghost  { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover  { border-color: var(--green); color: var(--green); }
.btn-red    { background: #c0392b; color: #fff; }
.btn-red:hover    { background: #96281b; }
.btn:disabled { opacity: 0.45; cursor: default; }

#search-results {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ── Track card ──────────────────────────────────────────────────────── */
.track-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: background 0.1s;
}
.track-card:hover { background: var(--surface2); }

.track-card img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}

.track-info { flex: 1; min-width: 0; }
.track-name {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.added-by {
  font-size: 0.72rem;
  color: var(--green);
  margin-top: 0.1rem;
  opacity: 0.8;
}

/* ── Vote Queue ──────────────────────────────────────────────────────── */
#queue-section { padding: 1.25rem 0 0.5rem; }

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.queue-count {
  background: var(--green);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
}

#queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.queue-empty {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem 0;
}

.queue-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: background 0.1s;
  animation: slideIn 0.2s ease;
}
.queue-item.rank-1 { border-color: var(--green); }
.queue-item.rank-2 { border-color: #b8b800; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.queue-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.queue-rank.top { color: var(--green); }

.queue-item img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 42px;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.vote-btn:hover { background: var(--green); border-color: var(--green); color: #000; }
.vote-btn.voted  { background: var(--green); border-color: var(--green); color: #000; cursor: default; }
.vote-btn .arrow { font-size: 1rem; line-height: 1; }
.vote-btn .count { line-height: 1.2; }

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.65rem 1.25rem;
  border-radius: 99px;
  font-size: 0.88rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { border-color: var(--green); color: var(--green); }
#toast.error   { border-color: #c0392b; color: #e74c3c; }

/* ── Host banner ─────────────────────────────────────────────────────── */
.host-banner {
  background: var(--surface2);
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.host-banner h3 { font-size: 0.95rem; font-weight: 700; color: var(--green); flex: 1; }

.host-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.pin-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  width: 90px;
  outline: none;
}
.pin-input:focus { border-color: var(--green); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .now-playing-card { flex-wrap: wrap; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
