/* ============================================================
   KitaMusik — design tokens
   Bahasa desain dari referensi: ink-dark, aksen lime,
   blob gradasi lavender-pink, radius pill, cover sirkular.
   ============================================================ */
:root {
  --bg:        #0A0A0F;
  --surface:   #14141B;
  --surface-2: #1C1C25;
  --line:      #26262F;
  --text:      #F4F4F6;
  --muted:     #8B8B98;
  --lime:      #CDF463;
  --lime-ink:  #0A0A0F;
  --lav:       #D9B8F0;
  --pink:      #F0BBD4;
  --r-card: 24px;
  --r-pill: 999px;
  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --dock-h: 64px;
  --mini-h: 68px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* jangan sampai kalah dari display:flex class */
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100dvh;
  overflow-x: hidden;
}
img { display: block; }
button { font-family: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: currentColor; }

/* Blob gradasi — signature dari referensi */
.bg-blob {
  position: fixed; top: -220px; left: -160px;
  width: 560px; height: 560px;
  background:
    radial-gradient(circle at 35% 35%, rgba(217,184,240,.45), transparent 60%),
    radial-gradient(circle at 65% 55%, rgba(240,187,212,.30), transparent 65%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.app { position: relative; z-index: 1; }

/* ---------- Rail (desktop) ---------- */
.rail {
  display: none;
  position: fixed; inset: 0 auto 0 0;
  width: 84px; padding: 24px 0;
  flex-direction: column; align-items: center; gap: 28px;
  border-right: 1px solid var(--line);
  background: rgba(10,10,15,.7);
  backdrop-filter: blur(14px);
  z-index: 40;
}
.rail-logo {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: var(--text); text-decoration: none; letter-spacing: -1px;
}
.rail-logo span { color: var(--lime); }
.rail-links { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.rail-btn, .dock-btn {
  width: 48px; height: 48px; border-radius: var(--r-pill);
  border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center;
  transition: background .18s, color .18s;
}
.rail-btn:hover { color: var(--text); background: var(--surface-2); }
.rail-btn.active, .dock-btn.active { background: var(--lime); color: var(--lime-ink); }
.rail-admin { color: var(--muted); text-decoration: none; font-size: 18px; }
.rail-admin:hover { color: var(--text); }

/* ---------- View ---------- */
.view {
  padding: 28px 20px calc(var(--dock-h) + var(--mini-h) + 40px);
  max-width: 1080px; margin: 0 auto;
  outline: none;
}

/* Greeting / heading */
.greet-eyebrow { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.greet {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(26px, 5vw, 40px); margin: 0 0 20px; letter-spacing: -0.5px;
}
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 0 14px;
}
.section-head h2 { font-size: 19px; font-weight: 800; margin: 0; }
.section-head a { color: var(--muted); font-size: 13px; text-decoration: none; }
.section-head a:hover { color: var(--lime); }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: var(--r-pill);
  padding: 9px 18px; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background .18s, color .18s;
}
.chip.active { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }

/* Kartu feature (Discover weekly) */
.feature {
  margin-top: 18px;
  background: linear-gradient(120deg, var(--lav), var(--pink) 85%);
  color: #221A2C;
  border-radius: var(--r-card);
  padding: 22px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  position: relative; overflow: hidden;
}
.feature::after {
  content: ""; position: absolute; right: -6px; top: 12px; bottom: 12px; width: 10px;
  background: var(--lime); border-radius: var(--r-pill);
}
.feature h3 { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.feature p { font-size: 13px; margin: 0; opacity: .75; max-width: 32ch; }
.feature-play {
  width: 52px; height: 52px; flex: none;
  border-radius: var(--r-pill); border: 0;
  background: var(--lime); color: var(--lime-ink);
  display: grid; place-items: center;
}

/* Grid kartu track */
.card-row {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.tcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 12px;
  text-align: left; color: var(--text);
  transition: background .18s, transform .18s;
}
.tcard:hover { background: var(--surface-2); transform: translateY(-2px); }
.tcard img, .tcard .ph {
  width: 100%; aspect-ratio: 1; border-radius: 18px; object-fit: cover; margin-bottom: 10px;
}
.tcard strong { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* List track (row) */
.tlist { display: flex; flex-direction: column; gap: 6px; }
.trow {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: 0; color: var(--text);
  padding: 8px 10px; border-radius: 18px; text-align: left;
  transition: background .15s;
}
.trow:hover { background: var(--surface); }
.trow.playing { background: var(--surface); }
.trow.playing strong { color: var(--lime); }
.trow img, .trow .ph { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; flex: none; }
.trow-meta { flex: 1; min-width: 0; }
.trow-meta strong { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow-meta span { font-size: 12px; color: var(--muted); }
.trow-side { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.trow-play {
  width: 38px; height: 38px; border-radius: var(--r-pill); border: 0; flex: none;
  background: var(--surface-2); color: var(--text);
  display: grid; place-items: center;
}
.trow-play svg { width: 16px; height: 16px; }
.trow:hover .trow-play { background: var(--lime); color: var(--lime-ink); }

/* Placeholder cover: gradasi dari id */
.ph { display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: rgba(10,10,15,.65); }

/* Search */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 12px 18px; margin-bottom: 20px;
}
.searchbar svg { color: var(--muted); flex: none; }
.searchbar input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--text); font-size: 15px; font-family: inherit;
}
.empty { color: var(--muted); font-size: 14px; padding: 30px 0; text-align: center; line-height: 1.6; }

/* Playlist hero */
.pl-hero { display: flex; gap: 18px; align-items: flex-end; margin-bottom: 22px; }
.pl-hero img, .pl-hero .ph { width: 140px; height: 140px; border-radius: var(--r-card); object-fit: cover; }
.pl-hero h1 { font-family: var(--font-display); font-size: clamp(22px, 4vw, 34px); margin: 0 0 6px; }
.pl-hero p { color: var(--muted); font-size: 13px; margin: 0; }
.pl-actions { margin: 0 0 20px; display: flex; gap: 10px; }
.btn-solid {
  background: var(--lime); color: var(--lime-ink); border: 0;
  border-radius: var(--r-pill); padding: 12px 24px; font-weight: 800; font-size: 14px;
}
.btn-ghost {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 12px 24px; font-weight: 700; font-size: 14px;
}

/* ---------- Dock (mobile) ---------- */
.dock {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 4px; padding: 6px;
  background: rgba(20,20,27,.85); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  z-index: 50;
}

/* ---------- Mini player ---------- */
.miniplayer {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(var(--dock-h) + 20px + env(safe-area-inset-bottom));
  background: rgba(28,28,37,.92); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 22px;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; z-index: 45; overflow: hidden;
}
.mini-progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgba(255,255,255,.08); }
.mini-progress-fill { height: 100%; width: 0%; background: var(--lime); border-radius: var(--r-pill); }
.mini-open { flex: 1; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--text); min-width: 0; text-align: left; }
.mini-open img { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.mini-meta { min-width: 0; }
.mini-meta strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-meta span { font-size: 11px; color: var(--muted); }
.mini-actions { display: flex; align-items: center; gap: 4px; }
.mini-actions button { background: none; border: 0; color: var(--text); width: 38px; height: 38px; display: grid; place-items: center; }
.mini-actions svg { width: 18px; height: 18px; }
.mini-play { background: var(--lime) !important; color: var(--lime-ink) !important; border-radius: var(--r-pill); }

/* ---------- Now Playing ---------- */
.nowplaying {
  position: fixed; inset: 0; z-index: 60;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(217,184,240,.22), transparent 60%),
    var(--bg);
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 24px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.np-top { width: 100%; max-width: 460px; display: flex; align-items: center; justify-content: space-between; }
.np-top button { background: var(--surface); border: 1px solid var(--line); color: var(--text); width: 42px; height: 42px; border-radius: var(--r-pill); display: grid; place-items: center; }
.np-top button.liked { color: var(--lime); }
.np-label { font-size: 14px; font-weight: 700; }

.np-art-wrap { margin: 4vh 0 3vh; }
.np-art {
  width: min(62vw, 300px); height: min(62vw, 300px);
  border-radius: 50%; object-fit: cover;
  border: 6px solid rgba(255,255,255,.06);
  box-shadow: 0 30px 80px rgba(217,184,240,.15);
  animation: spin 24s linear infinite;
  animation-play-state: paused;
}
.np-art.spinning { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .np-art { animation: none; } }

.np-title { font-family: var(--font-display); font-size: clamp(20px, 5vw, 28px); margin: 0; text-align: center; }
.np-artist { color: var(--muted); font-size: 14px; margin: 6px 0 0; text-align: center; }

.np-seek { width: 100%; max-width: 460px; margin-top: 26px; }
.np-seek input[type=range] {
  width: 100%; appearance: none; height: 5px; border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--lime) var(--fill, 0%), rgba(255,255,255,.12) var(--fill, 0%));
  outline: none;
}
.np-seek input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--lime); border: 3px solid var(--bg);
}
.np-times { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 8px; }

.np-controls { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.np-controls button { background: none; border: 0; color: var(--text); width: 48px; height: 48px; display: grid; place-items: center; position: relative; }
.np-controls button.on { color: var(--lime); }
.np-play {
  width: 68px !important; height: 68px !important;
  background: var(--lime) !important; color: var(--lime-ink) !important;
  border-radius: var(--r-pill);
}
.np-play svg { width: 26px; height: 26px; }
.repeat-one {
  position: absolute; top: 6px; right: 6px; font-size: 9px; font-weight: 800;
  background: var(--lime); color: var(--lime-ink);
  width: 13px; height: 13px; border-radius: 50%; display: none; place-items: center; line-height: 13px;
}
button.repeat-1 .repeat-one { display: grid; }

.np-queue-toggle {
  margin-top: 20px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--r-pill); padding: 10px 22px; font-size: 13px; font-weight: 700;
}
.np-queue { width: 100%; max-width: 460px; margin-top: 14px; }

/* Fokus keyboard */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--lime); outline-offset: 2px;
}

/* ---------- Desktop ---------- */
@media (min-width: 860px) {
  .rail { display: flex; }
  .dock { display: none; }
  .view { padding-left: 116px; padding-right: 32px; padding-bottom: calc(var(--mini-h) + 40px); }
  .miniplayer { left: 104px; right: 20px; bottom: 16px; max-width: none; }
  :root { --dock-h: 0px; }
}
