/* ========================================================================
   Jukebox — neon arcade aesthetic
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Monoton&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #07060f;
  --bg2: #0e0b1f;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.09);
  --magenta: #ff2d9b;
  --cyan: #16f2e6;
  --gold: #ffd152;
  --text: #f4f1ff;
  --muted: #9b94c0;
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 12% -10%, #2a0f4a 0%, transparent 55%),
    radial-gradient(1000px 700px at 100% 0%, #052b3a 0%, transparent 50%),
    radial-gradient(900px 900px at 50% 120%, #2a0726 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--magenta); color: #fff; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 10px; }

/* --- Header / wordmark --------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 22px 28px;
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(180deg, rgba(7,6,15,.92), rgba(7,6,15,.55) 70%, transparent);
  backdrop-filter: blur(8px);
}
.wordmark {
  font-family: 'Monoton', cursive;
  font-size: clamp(26px, 4vw, 44px);
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255,45,155,.45));
  user-select: none;
}
.wordmark .bulb { color: var(--gold); -webkit-text-fill-color: var(--gold); }

.credits-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--panel-border);
  font-weight: 600; font-size: 18px;
}
.credits-pill b { color: var(--gold); font-size: 22px; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  font-family: inherit; font-weight: 600; font-size: 16px;
  border: 1px solid var(--panel-border); background: var(--panel);
  color: var(--text); padding: 12px 20px; border-radius: 12px;
  cursor: pointer; transition: transform .12s ease, box-shadow .2s ease, background .2s;
  display: inline-flex; align-items: center; gap: 9px;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn.primary {
  background: linear-gradient(120deg, var(--magenta), #ff5ab8);
  border: none; color: #fff; box-shadow: 0 8px 30px -8px var(--magenta);
}
.btn.cyan {
  background: linear-gradient(120deg, #0fb8af, var(--cyan));
  border: none; color: #042a28; box-shadow: 0 8px 30px -8px var(--cyan);
}
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* --- Layout -------------------------------------------------------------- */
.layout {
  display: grid; grid-template-columns: 1fr 380px;
  gap: 22px; padding: 0 28px 160px; max-width: 1500px; margin: 0 auto;
}
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.search-wrap { position: relative; margin-bottom: 22px; }
.search-input {
  width: 100%; font-family: inherit; font-size: 22px; font-weight: 500;
  padding: 22px 26px 22px 64px; border-radius: var(--radius);
  background: rgba(255,255,255,.05); border: 1.5px solid var(--panel-border);
  color: var(--text); outline: none; transition: border .2s, box-shadow .2s;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: var(--magenta); box-shadow: 0 0 0 4px rgba(255,45,155,.15); }
.search-icon { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); font-size: 24px; opacity: .6; }

/* --- Track grid ---------------------------------------------------------- */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.track-card {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .15s ease, border-color .2s, box-shadow .25s;
  position: relative;
}
.track-card:hover { transform: translateY(-4px); border-color: var(--magenta); box-shadow: 0 16px 40px -16px rgba(255,45,155,.6); }
.track-card .art { width: 100%; aspect-ratio: 1; object-fit: cover; background: #1a1530; display: block; }
.track-card .meta { padding: 14px 16px 16px; }
.track-card .t-name { font-weight: 600; font-size: 16px; line-height: 1.25; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.track-card .t-artist { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-card .add-badge {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%;
  background: var(--magenta); color: #fff; font-size: 24px; font-weight: 700;
  display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: .2s;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.track-card:hover .add-badge { opacity: 1; transform: scale(1); }

.hint { color: var(--muted); text-align: center; padding: 60px 20px; font-size: 18px; }
.hint .big { font-size: 26px; color: var(--text); margin-bottom: 8px; font-weight: 600; }

/* --- Queue panel --------------------------------------------------------- */
.queue-panel {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 20px; align-self: start;
  position: sticky; top: 110px; max-height: calc(100vh - 290px); overflow-y: auto;
}
.queue-panel h2 { font-size: 20px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.queue-count { background: var(--cyan); color: #042a28; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.queue-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.queue-item:last-child { border-bottom: none; }
.queue-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.queue-item .qi-meta { min-width: 0; flex: 1; }
.queue-item .qi-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .qi-pos { color: var(--gold); font-weight: 700; font-size: 14px; width: 22px; text-align: center; }
.queue-empty { color: var(--muted); text-align: center; padding: 30px 10px; }

/* --- Now playing bar ----------------------------------------------------- */
.nowbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px; padding: 16px 28px;
  background: linear-gradient(180deg, rgba(14,11,31,.4), rgba(7,6,15,.97));
  backdrop-filter: blur(14px); border-top: 1px solid var(--panel-border);
}
.nowbar.empty { color: var(--muted); justify-content: center; font-size: 16px; }
.nowbar .np-art { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; box-shadow: 0 6px 20px rgba(0,0,0,.5); flex-shrink: 0; }
.nowbar .np-info { min-width: 0; flex: 1; }
.np-label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--magenta); font-weight: 700; }
.np-title { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-progress { flex: 2; max-width: 460px; }
.np-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.np-bar > div { height: 100%; background: linear-gradient(90deg, var(--magenta), var(--cyan)); width: 0%; transition: width .9s linear; }
.np-time { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 5px; }

/* equalizer animation */
.eq { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; }
.eq span { width: 4px; background: var(--cyan); border-radius: 2px; animation: eq 1s infinite ease-in-out; }
.eq span:nth-child(2){ animation-delay:.2s } .eq span:nth-child(3){ animation-delay:.4s } .eq span:nth-child(4){ animation-delay:.1s }
@keyframes eq { 0%,100%{ height:4px } 50%{ height:18px } }

/* --- Toast --------------------------------------------------------------- */
#toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(120deg, var(--magenta), #ff5ab8); color: #fff;
  padding: 14px 26px; border-radius: 14px; font-weight: 600; font-size: 16px;
  box-shadow: 0 12px 40px -10px var(--magenta); opacity: 0; pointer-events: none;
  transition: .3s; z-index: 100; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: linear-gradient(120deg, #e23b5b, #ff7a8a); box-shadow: 0 12px 40px -10px #e23b5b; }

/* --- Setup / login overlay ---------------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(7,6,15,.85); backdrop-filter: blur(6px); padding: 24px;
}
.overlay .card {
  background: var(--bg2); border: 1px solid var(--panel-border); border-radius: 24px;
  padding: 40px; max-width: 540px; width: 100%; text-align: center;
}
.overlay .card h1 { font-family: 'Monoton', cursive; font-size: 34px; margin-bottom: 16px;
  background: linear-gradient(90deg, var(--magenta), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.overlay .card p { color: var(--muted); margin-bottom: 12px; line-height: 1.55; }
.overlay code { background: rgba(255,255,255,.08); padding: 3px 8px; border-radius: 6px; font-size: 13px; word-break: break-all; }

.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
