/* Musik-Dashboard – dunkles Design */
:root {
  --bg: #0d1017;
  --bg2: #111622;
  --card: #161c28;
  --card2: #1c2332;
  --line: #262f40;
  --text: #e8ecf3;
  --muted: #8a94a8;
  --accent: #8b5cf6;
  --accent2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(34, 211, 238, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
h1, h2 { margin: 0; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.muted { color: var(--muted); }
.error { color: var(--err); min-height: 1.4em; margin: 10px 0 0; }

/* Buttons & Eingaben */
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600;
  cursor: pointer; color: var(--text); background: var(--card2); transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6d4ce0); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.small { padding: 6px 12px; font-size: 13px; text-decoration: none; }
.btn.wide { width: 100%; margin-top: 10px; }
input:not([type]), input[type="text"], input[inputmode] {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); font: inherit; outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .25); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px 28px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.login-card form { text-align: left; }
.logo {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.logo svg { width: 32px; height: 32px; color: #fff; }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
#in-code { font-size: 26px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }

/* Kopfzeile */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: rgba(13, 16, 23, .7);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.brand-icon svg { width: 18px; height: 18px; color: #fff; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, .2); }
.status-dot.away { background: var(--warn); }
.status-dot.off { background: var(--err); }

.banner { margin: 16px 24px 0; padding: 12px 16px; border-radius: 12px; font-size: 14px; }
.banner.info { background: rgba(139, 92, 246, .12); border: 1px solid rgba(139, 92, 246, .35); }
.banner.warn { background: rgba(251, 191, 36, .1); border: 1px solid rgba(251, 191, 36, .35); color: #fde68a; }

/* Raster */
.grid { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 20px; padding: 20px 24px 40px; max-width: 1280px; margin: 0 auto; }
.col-left, .col-right { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chip { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--card2); color: var(--muted); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { color: var(--muted); font-weight: 500; }

/* Player */
.cover { position: relative; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #20283a, #151b27); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #3a4560; }
.cover-empty svg { width: 64px; height: 64px; stroke-width: 1.5; }
.np-state { position: absolute; left: 10px; top: 10px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(0, 0, 0, .65); }
.np-meta { margin-top: 14px; min-height: 48px; }
.np-title { font-size: 18px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-artist { color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { margin-top: 14px; }
.bar { height: 6px; border-radius: 999px; background: var(--card2); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; transition: width .25s linear; }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; }
.icon-btn { border: 0; background: transparent; color: var(--text); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s, transform .1s; }
.icon-btn:hover { background: var(--card2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.active { color: var(--accent2); }
.icon-btn.play { width: 60px; height: 60px; background: linear-gradient(135deg, var(--accent), #6d4ce0); color: #fff; box-shadow: 0 8px 24px rgba(139, 92, 246, .35); }
.icon-btn.play svg { width: 26px; height: 26px; }
.volume { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); }
.vol-icon svg { width: 20px; height: 20px; }
.vol-val { width: 28px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
input[type="range"] { flex: 1; accent-color: var(--accent); height: 4px; }

/* Channel */
.members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.member.me { background: rgba(139, 92, 246, .1); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.member-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; }
.members .empty, .empty { color: var(--muted); font-size: 14px; list-style: none; text-align: center; margin: 14px 0 6px; }

/* Suche */
.search-row { display: flex; gap: 10px; align-items: center; position: relative; }
.search-icon { position: absolute; left: 12px; color: var(--muted); display: grid; }
.search-icon svg { width: 18px; height: 18px; }
.search-row input { padding-left: 40px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0 0; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.results { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.results-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.results-loading { color: var(--muted); padding: 10px 2px; }

/* Listen (Ergebnisse, Warteschlange) */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; transition: background .15s; }
.row:hover { background: var(--card2); }
.row.added { opacity: .55; }
.pos { width: 20px; text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.thumb { width: 64px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--card2); flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meta { flex: 1; min-width: 0; }
.meta .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.actions { display: flex; gap: 4px; flex: none; }
.mini { border: 0; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; }
.mini svg { width: 17px; height: 17px; }
.mini:hover { background: var(--line); color: var(--text); }
.mini.accent { color: var(--accent2); }
.mini.danger:hover { color: var(--err); }
.mini:disabled { opacity: .4; cursor: default; }

/* Ladeaufträge */
.job { background: rgba(34, 211, 238, .06); }
.job.fehler { background: rgba(248, 113, 113, .08); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent2); animation: spin .8s linear infinite; flex: none; margin: 0 10px; }
.job-icon { width: 20px; height: 20px; border-radius: 50%; flex: none; margin: 0 10px; }
.job-icon.ok { background: var(--ok); }
.job-icon.err { background: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Nur-Lesen-Modus (nicht im Channel) */
body.readonly .controls .icon-btn, body.readonly .actions .mini, body.readonly #btn-clear, body.readonly #vol { opacity: .45; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 12px; background: #2a1c24; border: 1px solid rgba(248, 113, 113, .4);
  color: #fecaca; transition: opacity .2s, transform .2s; max-width: min(92vw, 520px); z-index: 20; font-size: 14px;
}
.toast.ok { background: #13261f; border-color: rgba(52, 211, 153, .4); color: #bbf7d0; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Mobil: Player, Suche, Warteschlange, Channel untereinander */
@media (max-width: 860px) {
  .grid { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 14px; }
  .col-left, .col-right { display: contents; }
  .player { order: 1; } .search { order: 2; } .queue { order: 3; } .channel { order: 4; }
  .brand { font-size: 15px; min-width: 0; }
  .brand #site-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #admin-link { display: none; }
  .me-name { max-width: 28vw; }
  .topbar { padding: 12px 14px; }
  .banner { margin: 12px 14px 0; }
  .search-row .btn { padding: 10px 12px; }
  .thumb { width: 52px; height: 34px; }
  .dur { display: none; }
}
