/* VirtualTracks Jukebox – compact dark theme (CLEAN PATCH for Link column + stable rows) */

:root {
  --bg:        #0b0d10;
  --card:      #14181f;
  --ink:       #e8eef7;
  --muted:     #a9b4c2;
  --accent:    #4da3ff;
  --soft:      #1b2230;
  --panel:     #222c3b;
  --row-h:     46px;
  --text-size: 13px;
}

* { box-sizing: border-box; }

/* --- VT Navigation Bar --- */
.vt-nav {
  width: 100%;
  background: #14181f;
  padding: 10px;
  display: flex;
  gap: 10px;
  justify-content: center;
  border-bottom: 1px solid #222c3b;
}

.vt-btn {
  padding: 6px 14px;
  background: #1b2230;
  color: #e8eef7;
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: 0.2s;
}
.vt-btn:hover {
  background: #4da3ff;
  color: #0b0d10;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--text-size)/1.5 system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

/* Layout shells */

.container {
  max-width: 1120px;
  margin: 18px auto;
  padding: 0 12px;
}

.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, #101520, #0b0d10);
  border-bottom: 1px solid #1e2633;
}

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

.footer {
  max-width: 1120px;
  margin: 18px auto;
  padding: 12px;
  color: var(--muted);
  border-top: 1px solid #222;
}

/* Controls */

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}

select,
input[type="search"],
button {
  background: var(--soft);
  border: 1px solid #263244;
  color: var(--ink);
  padding: 6px 8px;
  border-radius: 8px;
  outline: none;
  font-size: var(--text-size);
}

input[type="search"] {
  flex: 1;
  min-width: 200px;
}

.sort-select { min-width: 140px; }

.small {
  font-size: 11px;
  color: var(--muted);
}

/* Shuffle toggle button */
.btn-shuffle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  font-size: 12px;
}
.btn-shuffle.is-on {
  background: var(--accent);
  color: #000;
}

/* List */

#listwrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1f2734;
  background: var(--card);
}

/* IMPORTANT: Row grid now matches HTML header:
   Cover | Title/Songwriter | Link | Artist | 7-Day | Total */
.row {
  display: grid;
  grid-template-columns: 60px 3fr 46px 1.6fr 70px 70px;
  align-items: center;
  column-gap: 8px;

  /* KEY: stable height prevents “tight then huge” flicker on JS re-render */
  height: var(--row-h);
  min-height: var(--row-h);

  padding: 6px 10px;
  font-size: var(--text-size);
  border-bottom: 1px solid #1c2432;
}

.row.header {
  background: #1b2230;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  grid-template-columns: 60px 3fr 46px 1.6fr 70px 70px;
}

.row:last-child { border-bottom: none; }

.row:nth-child(odd):not(.header):not(.mobile-note) { background: #151a23; }
.row:nth-child(even):not(.header):not(.mobile-note) { background: #11151d; }
.row:hover:not(.header):not(.mobile-note) { background: #1a2130; }
.row.active { background: #222d40; }

#listscroller {
  max-height: 520px;
  overflow-y: auto;
}

/* Cells */

.title-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.title-main {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playcell,
.linkcell {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Link column header alignment */
.col-link {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Link button (JS will render this in the Link cell) */
.link-btn {
  appearance: none;
  border: 1px solid #2a3a55;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;

  /* Prevent stacking bugs */
  position: static !important;
  transform: none !important;
}
.link-btn:hover { border-color: var(--accent); }

/* generic row play button */
.rowplay {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #2a3a55;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rowplay:hover { border-color: var(--accent); }

/* Cover + play overlay */

.cover-wrap {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.cover-wrap .cover {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: cover;
  background: #000;
}

.cover-wrap .rowplay {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #2a3a55;
  background: rgba(0,0,0,0.6);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-wrap .rowplay:hover { border-color: var(--accent); }

.cover {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  background: #000;
}

.cover.hidden { display: none !important; }

.meta-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.muted {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #182233;
  color: var(--ink);
  font-size: 11px;
}

.badge.total { background: #1d2839; }

/* Playing Now bar */

.playerbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid #1e2633;
  background: var(--panel);
  position: sticky;
  bottom: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.playerbar .label {
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.playbtn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid #2a3a55;
  cursor: pointer;
  background: var(--soft);
  padding: 0;
}

.playbtn svg {
  width: 16px;
  height: 16px;
  fill: var(--ink);
}

.playbtn.paused svg {
  transform: scale(0.9);
  opacity: 0.9;
}

.nowinfo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  flex-wrap: wrap;
}

.nowinfo .meta-title { font-weight: 600; }
.nowinfo .muted { color: var(--muted); }

/* Progress row in player bar */

.playerbar .progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

.playerbar .time {
  font-size: 11px;
  color: var(--muted);
  width: 40px;
  text-align: center;
}

.playerbar input[type="range"]#now-progress {
  flex: 1;
  max-width: 280px;
}

/* Basic range styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: #161e2b;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  margin-top: -4px;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

/* Utility */
.hidden { display: none !important; }

/* Mobile note row */
.row.mobile-note {
  grid-template-columns: 1fr !important;
  background: #131922;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 10px;
  text-align: center;
  border-bottom: 1px solid #1c2432;
}
@media (min-width: 720px) {
  .row.mobile-note { display: none; }
}

/* Small screens:
   - Keep: Cover | Title | Link | Artist
   - Hide: 7-Day + Total visually (logic still works) */
@media (max-width: 720px) {
  .row,
  .row.header {
    grid-template-columns: 60px 2.2fr 44px 1.2fr 0 0;
  }
  .row > div:nth-child(5),
  .row > div:nth-child(6),
  .row.header > div:nth-child(5),
  .row.header > div:nth-child(6) {
    display: none;
  }
}

/* Hide plays in the Now Playing bar (your preference) */
#now-plays { display: none !important; }

/* Toast */
.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: rgba(20, 24, 31, 0.95);
  border: 1px solid #2a3a55;
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}
/* =========================
   HIDE COUNT COLUMNS (7-Day + Total)
   - Keeps sorting logic working
   ========================= */

/* Hide headers */
#listwrap .row.header > div:nth-child(5),
#listwrap .row.header > div:nth-child(6) {
  display: none !important;
}

/* Hide values in rows */
#listwrap #list .row > div:nth-child(5),
#listwrap #list .row > div:nth-child(6) {
  display: none !important;
}

/* Reclaim the space by switching grid to: Cover | Title | Link | Artist */
#listwrap .row,
#listwrap .row.header {
  grid-template-columns: 60px 3fr 46px 1.6fr !important;
}
/* TEMP: Hide Rolling Window selector */
.window-bar {
  display: none !important;
}
