/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #0d0d0d;
  --surface: #181818;
  --surface2: #222;
  --surface-hover: #2a2a2a;
  --border: #2a2a2a;
  --green: #1ed760;
  --green-dim: #158a3a;
  --text: #ffffff;
  --text-secondary: #a7a7a7;
  --text-muted: #535353;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}
img { display: block; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input { outline: none; font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo svg { width: 24px; height: 24px; fill: var(--green); }
.user-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-chip span { color: var(--text); font-weight: 500; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 99px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.1s, opacity 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--green);
  color: #000;
}
.btn-primary:hover { background: #22e860; }
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger {
  background: transparent;
  color: #e05252;
  border: 1px solid #e05252;
}
.btn-danger:hover { background: rgba(224, 82, 82, 0.1); }
.btn-sm {
  padding: 7px 14px;
  font-size: 0.8rem;
}
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  text-align: center;
}
.modal-box h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.modal-box p {
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.95rem;
}
.modal-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* ── Inputs ────────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 14px 16px;
  font-size: 1rem;
  transition: border-color 0.2s;
  margin-bottom: 12px;
}
.input:focus { border-color: var(--green); }
.input::placeholder { color: var(--text-muted); }

/* ── Search ────────────────────────────────────────────────────────────────── */
.search-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.search-wrap .input {
  margin-bottom: 0;
  flex: 1;
}

/* ── Section ───────────────────────────────────────────────────────────────── */
.section {
  margin: 24px auto;
  max-width: 680px;
  padding: 0 16px;
}
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-green {
  background: rgba(30, 215, 96, 0.15);
  border-color: var(--green-dim);
  color: var(--green);
}

/* ── Now Playing ───────────────────────────────────────────────────────────── */
.now-playing-card {
  background: linear-gradient(135deg, #1a2e1a, #181818);
  border: 1px solid var(--green-dim);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
}
.now-playing-card.empty {
  background: var(--surface);
  border-color: var(--border);
  justify-content: center;
  padding: 32px;
}
.now-playing-card.empty p {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.now-playing-art {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}
.now-playing-info { flex: 1; min-width: 0; }
.now-playing-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--green);
  margin-bottom: 6px;
}
.now-playing-title {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-playing-artist {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}
.now-playing-by {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  width: 0%;
  transition: width 1s linear;
}

/* ── Track Card ────────────────────────────────────────────────────────────── */
.track-list { display: flex; flex-direction: column; gap: 4px; }
.track-card {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.track-card:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}
.track-art {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}
.track-info { flex: 1; min-width: 0; }
.track-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-artist {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-duration {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.track-add-btn {
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 99px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}
.track-add-btn:hover { background: #22e860; transform: scale(1.1); }
.track-add-btn.added {
  background: var(--surface2);
  color: var(--green);
  cursor: default;
  transform: none;
}

/* ── Queue items ───────────────────────────────────────────────────────────── */
.queue-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.queue-num {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.queue-art {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}
.queue-info { flex: 1; min-width: 0; }
.queue-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-artist {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.queue-by {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.queue-remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.queue-remove-btn:hover { color: #e05252; background: rgba(224, 82, 82, 0.1); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state p { font-size: 0.9rem; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  white-space: nowrap;
}
.toast.success { border-color: var(--green-dim); color: var(--green); }
.toast.error { border-color: #7a2222; color: #e05252; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Status indicator ──────────────────────────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}
.status-dot.online { background: var(--green); animation: pulse 2s infinite; }
.status-dot.offline { background: #e05252; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Host/Admin specific ───────────────────────────────────────────────────── */
.page-center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.card-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: block;
}
.form-group { margin-bottom: 16px; }
hr.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

/* ── Countdown ─────────────────────────────────────────────────────────────── */
.countdown {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ── Now playing row (combined view) ───────────────────────────────────────── */
.now-playing-row {
  background: linear-gradient(135deg, #1a2e1a, #181818);
  border: 1px solid var(--green-dim);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  position: relative;
  overflow: hidden;
}
.now-playing-row::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--green);
  width: var(--progress, 0%);
  transition: width 1s linear;
  border-radius: 0 99px 99px 0;
}
.np-art {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}
.np-info { flex: 1; min-width: 0; }
.np-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--green);
  margin-bottom: 3px;
}
.np-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-artist {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-by { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ── Host player ───────────────────────────────────────────────────────────── */
.host-layout {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px;
}
.host-player-card {
  background: linear-gradient(135deg, #1a2e1a, #181818);
  border: 1px solid var(--green-dim);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
}
.host-art {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  object-fit: cover;
  margin: 0 auto 20px;
  background: var(--surface2);
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}
.host-track-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.host-track-artist {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.host-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .modal-box { padding: 28px 20px; }
  .card { padding: 24px 18px; }
  .host-art { width: 120px; height: 120px; }
}
