/* BruceMusicBot web panel. Tokens and rules: design-system/brucemusicbot-webui/MASTER.md */

:root {
  color-scheme: dark;
  --bg: #1E1F22;
  --surface: #2B2D31;
  --surface-raised: #313338;
  --border: #35373C;
  --border-strong: #3F4147;
  --divider: #3A3C42;
  --hover: #393C43;
  --row-hover: #35373C;
  --btn: #383A40;
  --btn-hover: #404249;
  --btn-border-hover: #4E5058;
  --text: #F2F3F5;
  --text-muted: #B5BAC1;
  --text-soft: #DBDEE1;
  --text-faint: #80848E;
  --accent: #5865F2;
  --on-accent: #FFFFFF;
  --online: #23A55A;
  --danger-text: #FCA5A5;
  --danger-bg: #4A2A2E;
  --danger-border: #5A3034;
  --danger-hover: #3E2A2D;
  --backdrop: rgba(0, 0, 0, 0.6);
  --toast-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --thumb-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  --role-dj-bg: #3C4270;
  --role-dj-text: #DEE0FC;

  /* artwork placeholders and requester avatars without a picture */
  --art-0: #2E3A5C; --art-1: #4A2F4F; --art-2: #2F4A44; --art-3: #4D3B26;
  --art-4: #2B4157; --art-5: #41324F; --art-6: #4F2E33; --art-7: #2C4A33;
  --req-0: #7C8CFF; --req-1: #F59E8B; --req-2: #5FD3C6; --req-3: #E3B341;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font-body);
}

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

button {
  font: 600 15px/1 var(--font-body);
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.btn-secondary { background: var(--btn); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--btn-hover); border-color: var(--btn-border-hover); }

.page { max-width: 1360px; margin: 0 auto; padding: 24px; }

.header { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.brand { font: 700 28px/1.15 var(--font-display); letter-spacing: -0.015em; margin: 0; flex: 1; }
.brand span { color: var(--accent); }
.user { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  margin-top: 24px;
}
.card h2 { font: 700 20px/1.2 var(--font-display); margin: 0 0 12px; }
.muted { color: var(--text-muted); }
code { font-family: var(--font-mono); font-size: 13px; color: var(--text-soft); }

.guilds { list-style: none; margin: 0; padding: 0; }
.guilds li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--divider); }
.guilds li:first-child { border-top: 0; }
.guild-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--btn); }
.guild-name { flex: 1; font-weight: 600; }
.badge { font-size: 13px; padding: 2px 10px; border-radius: 9px; background: var(--btn); color: var(--text-muted); }
.badge.dj, .badge.admin { background: var(--role-dj-bg); color: var(--role-dj-text); }

.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.centered .card { max-width: 440px; width: 100%; margin: 0; text-align: center; }

/* ---- player (phase 2) ---- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.mono { font-family: var(--font-mono); font-size: 13px; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

.header { flex-wrap: wrap; }
.switcher select {
  font: 600 15px/1 var(--font-body);
  min-height: 44px; padding: 0 12px; max-width: 260px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px;
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--online); }
.user-name { color: var(--text-soft); }

.columns { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 24px; align-items: flex-start; }
.columns .card { margin-top: 0; }
.np { flex: 1 1 380px; min-width: 0; }
.side { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.queue { min-width: 0; }

.np-head, .queue-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.np-head h2, .queue-head h2 { margin: 0; flex: 1; }
.voice-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
  padding: 4px 10px; border: 1px solid var(--divider); border-radius: 9px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.dot.online { background: var(--online); }

.art { position: relative; overflow: hidden; display: grid; place-items: center; border-radius: 10px; flex: none; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art-letter { font: 700 1em/1 var(--font-display); color: var(--text); }
.art-large { width: 100%; aspect-ratio: 16 / 9; font-size: 56px; border-radius: 14px; }
.art-small { width: 44px; height: 44px; font-size: 18px; }
.tint-0 { background: var(--art-0); } .tint-1 { background: var(--art-1); }
.tint-2 { background: var(--art-2); } .tint-3 { background: var(--art-3); }
.tint-4 { background: var(--art-4); } .tint-5 { background: var(--art-5); }
.tint-6 { background: var(--art-6); } .tint-7 { background: var(--art-7); }

.np-title {
  font: 700 28px/1.15 var(--font-display); letter-spacing: -0.015em;
  margin: 16px 0 4px; overflow-wrap: anywhere;
}
.np-author { margin: 0; color: var(--text-muted); font-size: 14px; }
.np-requester { margin-top: 12px; }
.np-idle .np-title { margin-top: 0; }

.progress { height: 4px; margin-top: 20px; border-radius: 2px; background: var(--border-strong); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); }
.times { display: flex; justify-content: space-between; margin-top: 8px; font: 400 12px/1 var(--font-mono); color: var(--text-muted); }

.requester { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); min-width: 0; }
.requester span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font: 700 11px/1 var(--font-body); color: var(--bg);
}
.req-tint-0 { background: var(--req-0); } .req-tint-1 { background: var(--req-1); }
.req-tint-2 { background: var(--req-2); } .req-tint-3 { background: var(--req-3); }

.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; border-radius: 12px;
  transition: background-color 120ms;
}
.queue-row:hover, .queue-row:focus-within { background: var(--row-hover); }
.pos { width: 24px; text-align: right; color: var(--text-muted); flex: none; }
.row-text { flex: 1; min-width: 0; }
.row-title, .row-author { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title { font-weight: 600; }
/* room inside the ellipsis clip for the title link's focus ring (2px + 2px offset), same layout */
.row-title { padding: 4px; margin: -4px; }
.row-author { font-size: 13px; color: var(--text-muted); }
.row-requester { width: 160px; flex: none; }
.row-length { width: 56px; text-align: right; color: var(--text-muted); flex: none; }
.empty { margin: 0; }

/* ---- controls (phase 3) ---- */

button:disabled { cursor: default; opacity: 0.35; }
button svg { flex: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; min-height: 0; padding: 0;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--text-muted);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }

.btn-play {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; padding: 0;
  border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
}
.btn-play svg { fill: currentColor; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--text-muted);
  border: 1px solid transparent; padding: 0 12px;
}
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.repeat.active { color: var(--text); }
.repeat.active svg { color: var(--accent); }

.btn-secondary, .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-destructive { color: var(--danger-text); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.btn-danger:hover { background: var(--danger-hover); }

.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg); border-radius: 12px; }
.segmented button {
  min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-muted); font-size: 14px;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--btn-hover); color: var(--text); }

.np-playing .progress { margin-top: 20px; }
.transport { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 16px; }
.np-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider);
}
.volume-row { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; min-width: 0; }
.volume-icon { display: inline-grid; color: var(--text-muted); }
.volume-value { width: 44px; text-align: right; color: var(--text-muted); }

/* the visible track is drawn by divs; the real range input lies on top at opacity 0 */
.slider { position: relative; height: 24px; flex: 1; min-width: 0; border-radius: 6px; }
.slider.seek { margin-top: 10px; }
.slider-track {
  position: absolute; left: 0; right: 0; top: 10px; height: 4px;
  border-radius: 2px; background: var(--border-strong);
}
.slider-fill { height: 100%; width: 0; border-radius: 2px; background: var(--accent); }
.volume .slider-fill { background: var(--text-soft); }
.slider-tick {
  position: absolute; left: calc(100% * 100 / 150); top: -3px;
  width: 2px; height: 10px; border-radius: 1px; background: var(--text-faint);
}
.slider-thumb {
  position: absolute; top: 5px; left: 0; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--on-accent); box-shadow: var(--thumb-shadow);
  pointer-events: none;
}
.slider input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer;
}
.slider:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.slider.disabled { opacity: 0.35; }
.slider input:disabled { cursor: default; }
.slider.disabled .slider-thumb { display: none; }

.queue-head { flex-wrap: wrap; }
.queue-head h2 { flex: 1 1 auto; }
.queue-row { position: relative; }
.queue-row[draggable="true"] { cursor: grab; }
.queue-row.dragging { opacity: 0.5; }
.queue-row.drop-before::before, .queue-row.drop-after::after {
  content: ""; position: absolute; left: 8px; right: 8px; height: 2px;
  border-radius: 1px; background: var(--accent);
}
.queue-row.drop-before::before { top: -1px; }
.queue-row.drop-after::after { bottom: -1px; }
.grip { display: inline-grid; color: var(--text-faint); flex: none; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; flex: none; min-width: 36px; }
.row-actions .icon-btn { width: 36px; height: 36px; }
.narrow-only, .row-length-inline { display: none; }
.row-author { display: flex; min-width: 0; }
.row-author span:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row-length-inline { flex: none; white-space: pre; }

/* ---- add bar (the chat play / playnext / search) ---- */

.add-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.add-bar { display: flex; flex-wrap: wrap; gap: 10px; }
.add-field {
  flex: 1 1 320px; min-width: 0; height: 48px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: 12px;
}
.add-field:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.add-input {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  border: 0; outline: none; background: transparent;
  color: var(--text); font: 400 15px/1.5 var(--font-body);
}
.add-input::placeholder { color: var(--text-muted); }
.add-bar .segmented { border: 1px solid var(--border-strong); }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; border: 0;
  background: var(--accent); color: var(--on-accent);
}
.add-next {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  min-height: 32px; font-size: 14px; color: var(--text-soft); cursor: pointer;
}
.add-next input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: inherit; }
.add-next.disabled { opacity: 0.35; cursor: default; }
.results { padding-top: 12px; border-top: 1px solid var(--divider); }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.results-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--text-soft); }
.results-head .icon-btn { width: 36px; height: 36px; }
.result-list { list-style: none; margin: 4px 0 0; padding: 0; }
.result-row {
  display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px;
  transition: background-color 120ms;
}
.result-row:hover, .result-row:focus-within { background: var(--row-hover); }
.result-length { flex: none; white-space: pre; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; flex: none; }

.toasts {
  position: fixed; left: 24px; bottom: 24px; z-index: 10;
  display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 48px));
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 16px; min-height: 48px;
  background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--toast-shadow);
}
.toast.error svg { color: var(--danger-text); }
.toast-text { flex: 1; overflow-wrap: anywhere; }
.toast-action {
  min-height: 36px; padding: 0 12px;
  background: var(--btn); color: var(--text); border: 1px solid var(--border-strong);
}
.toast-action:hover { background: var(--btn-hover); }

.dialog {
  width: min(420px, calc(100vw - 32px)); padding: 24px;
  background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 20px;
}
.dialog::backdrop { background: var(--backdrop); }
.dialog h2 { font: 700 20px/1.2 var(--font-display); margin: 0 0 8px; overflow-wrap: anywhere; }
.dialog p { margin: 0; color: var(--text-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.sheet form { display: flex; flex-direction: column; gap: 8px; }
.sheet-actions { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.sheet-action {
  display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: transparent; color: var(--text); border: 0; text-align: left;
}
.sheet-action:hover:not(:disabled) { background: var(--hover); }

@media (max-width: 760px) {
  .page { padding: 16px; }
  .row-requester { display: none; }
  .np-title { font-size: 24px; }
  .card { padding: 16px; }
  .add-bar .segmented { flex: 1 1 auto; }
  .add-bar .segmented button { flex: 1; }
  .add-bar .btn-primary { flex: 1 1 auto; }
  .queue-row { gap: 8px; padding: 8px 4px; }
  .grip, .row-length, .wide-only { display: none; }
  .narrow-only { display: inline-grid; }
  .row-length-inline { display: inline; }
  .toasts { left: 16px; bottom: 16px; max-width: calc(100vw - 32px); }
  .sheet { margin: auto auto 16px; }

  /* touch: every target at least 44px (desktop keeps MASTER's dense 36px rows) */
  .row-actions .icon-btn, .results-head .icon-btn { width: 44px; height: 44px; }
  .btn-small, .toast-action, .segmented button, .add-next { min-height: 44px; }
  .slider { height: 44px; }
  .slider.seek { margin-top: 0; }
  .slider-track { top: 20px; }
  .slider-thumb { top: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
