/* Vibe DJ - tmavý klubový pult. Vlastný dizajn, žiadne cudzie logá. */
:root {
  --bg-0: #0b0c0f;
  --bg-1: #15171c;
  --bg-2: #1e2128;
  --metal: linear-gradient(180deg, #2a2e37, #16181d);
  --accent-a: #35d0ff;
  --accent-b: #ff6a3d;
  --accent-live: #ff3d6a;
  --led-off: #2a2d33;
  --text: #e8e9ec;
  --text-dim: #8a8f9a;
  --danger: #ff4d4d;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg-0); color: var(--text); overflow: hidden; }
button { font-family: inherit; cursor: pointer; }
input[type="range"] { accent-color: var(--accent-a); }

#app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--metal); border-bottom: 1px solid #000;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.brand { font-weight: 800; letter-spacing: 2px; font-size: 18px; }
.brand span { color: var(--accent-a); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.pill-btn {
  background: var(--bg-2); border: 1px solid #333; color: var(--text);
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
}
.pill-btn:hover { border-color: var(--accent-a); }
.pill-btn.rec { color: var(--danger); border-color: var(--danger); }
.pill-btn.rec.recording { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; color: var(--text-dim); }
.user-badge { color: var(--text-dim); font-size: 12px; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.pult {
  flex: 1; display: grid; grid-template-columns: 1fr 420px 1fr; gap: 10px;
  padding: 10px; min-height: 0;
  /* Na nižších obrazovkách (napr. 1366×768) sa spodok pultu — hot cues, slučky, AUTO MIX,
     master — nezmestí; html/body majú overflow: hidden, takže sa musí dať posúvať pult. */
  overflow-y: auto;
}

.deck {
  background: var(--metal); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px;
  border: 1px solid #000; box-shadow: inset 0 0 30px rgba(0,0,0,.4);
  min-height: 0;
}
.deck-header { display: flex; justify-content: space-between; align-items: baseline; }
.deck-label { font-weight: 700; color: var(--accent-a); letter-spacing: 1px; }
.deck-track-title { color: var(--text-dim); font-size: 13px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

canvas.waveform { width: 100%; background: #05060a; border-radius: 6px; display: block; cursor: pointer; }

.deck-time { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 12px; }

.deck-main { display: flex; gap: 16px; align-items: center; flex: 1; }

.jogwheel {
  width: 150px; height: 150px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a3e47, #0c0d10 70%);
  border: 6px solid #000; position: relative; touch-action: none; user-select: none;
  box-shadow: 0 0 0 2px #333, 0 8px 20px rgba(0,0,0,.6);
  flex-shrink: 0;
}
.jogwheel-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; color: rgba(255,255,255,.08); }
.jogwheel-needle { position: absolute; top: 6px; left: 50%; width: 3px; height: 20px; background: var(--accent-a); transform-origin: 50% 69px; }

.deck-controls { display: flex; gap: 10px; flex: 1; align-items: center; }
.transport { display: flex; flex-direction: column; gap: 6px; }
.ctrl-btn {
  background: var(--led-off); color: var(--text); border: 1px solid #000; border-radius: 6px;
  padding: 10px 14px; font-weight: 700; min-width: 60px;
}
.ctrl-btn.play.active { background: var(--accent-a); color: #001318; box-shadow: 0 0 12px var(--accent-a); }
.ctrl-btn.cue:active, .ctrl-btn.cue.active { background: var(--accent-b); color: #200; }
.ctrl-btn.sync.active { background: #6dff8a; color: #002400; }
.ctrl-btn.fx-on.active { background: var(--accent-b); box-shadow: 0 0 12px var(--accent-b); }

.pitch { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pitch input[type="range"][orient="vertical"] { writing-mode: vertical-lr; direction: rtl; width: 24px; height: 100px; }
.pitch-range { display: flex; flex-direction: column; gap: 4px; }

.mini-btn {
  background: var(--bg-2); border: 1px solid #333; color: var(--text-dim);
  border-radius: 5px; padding: 4px 8px; font-size: 11px;
}
.mini-btn.toggle.active { background: var(--accent-a); color: #001318; border-color: var(--accent-a); }

.hotcues { display: flex; gap: 6px; }
.hotcue {
  flex: 1; padding: 8px 0; background: var(--led-off); border: 1px solid #000; border-radius: 6px;
  color: var(--text-dim); font-weight: 700;
}
.hotcue.set { background: #ffcf3d; color: #201800; box-shadow: 0 0 8px #ffcf3d; }

.loops { display: flex; gap: 4px; flex-wrap: wrap; }

.stems { display: flex; gap: 8px; }
.stems[hidden] { display: none; } /* bez tohto display:flex prebije atribút hidden */
.stem { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--text-dim); }
.stem input[type="range"] { width: 100%; }

.mixer {
  background: var(--metal); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid #000;
}
.fx-panel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--bg-1); border-radius: 8px; padding: 8px; }
.fx-header { font-weight: 700; color: var(--accent-b); width: 100%; }
.fx-panel select { background: var(--bg-2); color: var(--text); border: 1px solid #333; border-radius: 4px; }

.channels { display: flex; gap: 8px; flex: 1; min-height: 0; min-width: 0; }
.channel {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg-1); border-radius: 8px; padding: 8px; min-height: 0;
  min-width: 0; /* bez toho kanál nevie byť užší než posuvník (~130 px) a mixér pretečie */
}
.channel.live { border: 1px solid var(--accent-live); }
.channel-label { font-weight: 700; color: var(--text-dim); }
.channel.live .channel-label { color: var(--accent-live); }
.eq { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.eq label { display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: var(--text-dim); gap: 4px; }
.eq input { flex: 1; min-width: 0; }
.filter-knob input, .gain-knob input { width: 100%; min-width: 0; }
.live-source, .live-source select { max-width: 100%; }
.eq .kill { width: 18px; height: 18px; padding: 0; border-radius: 50%; background: var(--led-off); border: 1px solid #333; font-size: 9px; }
.eq .kill.active { background: var(--danger); }
.filter-knob, .gain-knob { font-size: 10px; color: var(--text-dim); width: 100%; display: flex; flex-direction: column; gap: 2px; }
.vu { width: 14px; flex: 1; background: #05060a; border-radius: 4px; position: relative; overflow: hidden; min-height: 40px; }
.vu::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--level, 0%);
  background: linear-gradient(0deg, #2dff5c, #ffe83d 70%, #ff3d3d 92%);
}
.channel-fader { writing-mode: vertical-lr; direction: rtl; width: 30px; height: 120px; }
.cue-toggle.active { background: var(--accent-a); color: #001318; }
.live-source { display: flex; flex-direction: column; gap: 4px; }
.live-source select { background: var(--bg-2); color: var(--text); border: 1px solid #333; font-size: 10px; }

.crossfader-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#crossfader { width: 100%; }
.crossfader-marks { display: flex; justify-content: space-between; width: 100%; font-size: 11px; color: var(--text-dim); }

.automix { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; margin-top: 8px; width: 100%; }
.automix-btn { font-size: 11px; padding: 4px 10px; }
.automix-btn.active { background: var(--accent-b); color: #1a0a04; }
.automix select { background: var(--bg-2); color: var(--text); border: 1px solid #333; font-size: 10px; }
.automix-status { flex-basis: 100%; text-align: center; font-size: 10px; color: var(--text-dim); min-height: 12px; }

.master { display: flex; gap: 10px; align-items: center; justify-content: center; }
.master label { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--text-dim); }
#master-volume { writing-mode: vertical-lr; direction: rtl; height: 100px; }
.master-vu { height: 100px; }
.headphone-mix input { width: 80px; }

.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; height: 40vh; background: var(--bg-1);
  border-top: 2px solid var(--accent-a); transform: translateY(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; padding: 12px; z-index: 20;
}
.drawer.open { transform: translateY(0); }
.drawer.side { left: auto; right: 0; width: 360px; height: 100vh; bottom: 0; top: 0; transform: translateX(100%); }
.drawer.side.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: center; }
.library-count { color: var(--text-dim); font-size: 13px; font-weight: 400; }
/* Zbalená knižnica: len úzky pásik s názvom a tlačidlami — pult pod ňou je voľný. */
#library-panel.minimized { height: auto; padding: 6px 12px; }
#library-panel.minimized h2 { font-size: 15px; margin: 0; }
#library-panel.minimized .library-toolbar > :not(.keep),
#library-panel.minimized .library-local,
#library-panel.minimized .upload-progress,
#library-panel.minimized .library-dropzone,
#library-panel.minimized .library-table { display: none !important; }
body:has(#library-panel.open.minimized) .pult { padding-bottom: 56px; }

.library-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.library-toolbar input[type="search"] { background: var(--bg-2); border: 1px solid #333; color: var(--text); padding: 6px 10px; border-radius: 6px; }
.library-toolbar select { background: var(--bg-2); color: var(--text); border: 1px solid #333; border-radius: 6px; }
.library-dropzone { border: 2px dashed #333; border-radius: 8px; padding: 10px; text-align: center; color: var(--text-dim); font-size: 12px; margin: 8px 0; }
.library-dropzone.dragover { border-color: var(--accent-a); color: var(--accent-a); }
.upload-progress { height: 4px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.upload-progress > div { height: 100%; background: var(--accent-a); width: 0%; }

.library-table { width: 100%; border-collapse: collapse; overflow: auto; display: block; flex: 1; }
.library-table thead { color: var(--text-dim); font-size: 11px; text-transform: uppercase; }
.library-table td, .library-table th { padding: 6px 8px; border-bottom: 1px solid #222; font-size: 13px; }
.library-table tr[draggable="true"] { cursor: grab; }
.library-table tr:hover { background: rgba(255,255,255,.03); }
.library-table .load-btn { display: flex; gap: 4px; }

.assistant-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.assistant-messages .msg { padding: 8px 10px; border-radius: 8px; font-size: 13px; max-width: 90%; }
.assistant-messages .msg.user { background: var(--bg-2); align-self: flex-end; }
.assistant-messages .msg.assistant { background: #14232b; align-self: flex-start; }
.assistant-confirm { background: #2a1e14; border: 1px solid var(--accent-b); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.assistant-confirm .row { display: flex; gap: 8px; }
.assistant-form { display: flex; gap: 6px; }
.assistant-form input { flex: 1; background: var(--bg-2); border: 1px solid #333; color: var(--text); padding: 8px; border-radius: 6px; }

#autodj-brief { flex: 1; background: var(--bg-2); border: 1px solid #333; color: var(--text); border-radius: 6px; padding: 8px; resize: none; }
.autodj-controls { display: flex; gap: 8px; }
.autodj-status { font-size: 12px; color: var(--text-dim); white-space: pre-wrap; }

.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--accent-a); color: var(--text);
  padding: 10px 18px; border-radius: 8px; z-index: 50; font-size: 13px;
}

@media (max-width: 1100px) {
  .pult { grid-template-columns: 1fr; grid-auto-rows: min-content; overflow-y: auto; }
}

/* ---------- Režimy: súkromný pult (bez atribútu) vs. verejný (<html data-mode="public">) ---------- */
.public-only { display: none !important; }
html[data-mode="public"] .private-only { display: none !important; }
html[data-mode="public"] .public-only:not(.start-overlay):not(.mobile-notice) { display: revert !important; }
a.pill-btn { text-decoration: none; display: inline-flex; align-items: center; }
html[data-mode="public"] .topbar a.pill-btn.public-only { display: inline-flex !important; }

.library-local { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 12px; }
.library-local[hidden] { display: none; }
.library-local .local-status { color: var(--text-dim); }
.library-local .local-spacer { flex: 1; }
.pill-btn.attention { border-color: var(--accent-b); color: var(--accent-b); }
.mini-select { background: var(--bg-2); color: var(--text-dim); border: 1px solid #333; border-radius: 4px; font-size: 11px; max-width: 110px; }

/* Úvodná obrazovka verejného pultu — prvé kliknutie zároveň spustí zvuk (autoplay pravidlá). */
.start-overlay, .mobile-notice {
  position: fixed; inset: 0; z-index: 100; background: rgba(11, 12, 15, .94);
  align-items: center; justify-content: center; padding: 16px;
}
html[data-mode="public"] .start-overlay { display: flex !important; }
.start-card { max-width: 480px; text-align: center; background: var(--bg-1); border: 1px solid #333; border-radius: 12px; padding: 28px 24px; }
.start-card h1 { margin: 0 0 12px; font-size: 24px; letter-spacing: 1px; }
.start-card h1 span { color: var(--accent-a); }
.start-card p { color: var(--text-dim); line-height: 1.5; font-size: 14px; }
.start-card a { color: var(--accent-a); }
.start-btn { background: var(--accent-a); color: #000; border: none; border-radius: 999px; padding: 12px 28px; font-size: 16px; font-weight: 700; margin: 8px 0; }
.start-hint { font-size: 12px !important; }

/* Na telefóne sa pult nedá rozumne ovládať — verejná verzia ukáže len oznam. */
@media (max-width: 900px) {
  html[data-mode="public"] .mobile-notice { display: flex !important; z-index: 200; background: var(--bg-0); }
}

/* ---------- Demo režim ---------- */
.start-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.demo-start-btn { background: transparent; color: var(--accent-a); border: 2px solid var(--accent-a); }
#btn-demo { border-color: var(--accent-b); color: var(--accent-b); }

.demo-panel {
  position: fixed; bottom: 64px; width: min(440px, calc(100vw - 32px)); z-index: 60;
  background: var(--bg-1); border: 2px solid var(--accent-b); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.demo-panel.side-left { left: 16px; }
.demo-panel.side-right { right: 16px; }
.demo-head { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-dim); }
.demo-badge { background: var(--accent-b); color: #1a0a04; font-weight: 800; letter-spacing: 1px; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.demo-panel h3 { margin: 8px 0 4px; font-size: 17px; }
.demo-panel p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: var(--text); }
.demo-progress { height: 4px; background: var(--bg-2); border-radius: 2px; overflow: hidden; margin-bottom: 10px; }
.demo-progress > div { height: 100%; width: 0; background: var(--accent-b); transition: width .1s linear; }
.demo-panel.paused .demo-progress > div { background: var(--text-dim); }
.demo-actions { display: flex; gap: 8px; justify-content: flex-end; }
.demo-next { background: var(--accent-b); color: #1a0a04; border-color: var(--accent-b); font-weight: 700; }

/* Ovládač, o ktorom demo práve hovorí. */
.demo-focus {
  outline: 3px solid var(--accent-b) !important; outline-offset: 3px; border-radius: 6px;
  animation: demo-glow 1.4s ease-in-out infinite;
}
@keyframes demo-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 106, 61, .0); }
  50% { box-shadow: 0 0 18px 6px rgba(255, 106, 61, .55); }
}

/* ---------- Profi funkcie (30. 9. 2026) ---------- */
/* Beat jump + BRAKE/SPINBACK pod slučkami */
.deck-extra { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.deck-extra-spacer { flex: 1; }
.jump-size { background: var(--bg-2); color: var(--text); border: 1px solid #333; border-radius: 4px; font-size: 11px; }
.ag { font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* QUANTIZE / AUTO GAIN */
.mix-toggles { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.mix-toggles .mini-btn { font-size: 10px; letter-spacing: .5px; }

/* Sampler */
.sampler-panel { background: var(--bg-1); border-radius: 8px; padding: 6px 8px; }
.sampler-head { display: flex; align-items: center; gap: 8px; }
.sampler-head .fx-header { width: auto; flex: 1; }
.sampler-collapse { background: none; border: none; color: var(--text-dim); font-size: 12px; padding: 0 2px; }
.sampler-vol { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-dim); }
.sampler-vol input { width: 80px; }
.sampler-pads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.sampler-panel.collapsed .sampler-pads { display: none; }
.pad { position: relative; min-width: 0; }
.pad-hit {
  width: 100%; height: 38px; border-radius: 6px; border: 1px solid #3a2f55;
  background: linear-gradient(160deg, #2a2440, #17141f); color: var(--text);
  font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 6px;
  transition: transform .05s, box-shadow .1s, background .1s;
}
.pad-hit:hover { border-color: var(--accent-b); }
.pad-hit:active { transform: scale(.96); }
.pad-hit:disabled { opacity: .4; cursor: default; }
.pad.hit .pad-hit { background: var(--accent-b); color: #1a0a04; box-shadow: 0 0 14px var(--accent-b); }
.pad.custom .pad-hit { border-color: var(--accent-a); }
.pad-edit {
  position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; padding: 0; border-radius: 50%;
  border: 1px solid #444; background: var(--bg-2); color: var(--text-dim); font-size: 10px; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.pad:hover .pad-edit, .pad-edit:focus-visible, .pad.custom .pad-edit { opacity: 1; }

/* Harmonický pomocník v knižnici */
.match { font-size: 12px; }
.match-perfect { color: #3ee37a; }
.match-tempo { color: #f5c542; }
.match-legend { color: var(--text-dim); font-size: 12px; font-weight: 400; margin-left: 10px; }
#library-panel.minimized .match-legend { display: none; }
