/* ============================================================ */
/* Step sequencer (pattern / session style)                     */
/* ============================================================ */

.seq-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-surface-2, #2a2a2a);
  color: var(--text-main, #eee);
  user-select: none;
  font-family: system-ui, -apple-system, sans-serif;
}
.step-sequencer-window .window-content {
  height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  padding: 0;
}
.seq-session-host.is-empty-msg {
  padding: 16px;
  opacity: 0.7;
}
.seq-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-elevated, #333);
  border-bottom: 1px solid var(--border-main, #333);
  flex-shrink: 0;
}

.seq-toolbar .seq-pattern-name {
  font-weight: 700;
  color: var(--accent, #00ff88);
  min-width: 120px;
}

.seq-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted, #aaa);
}

.seq-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.seq-lane-col {
  flex: 0 0 160px;
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--bg-surface-2, #2a2a2a);
  border-right: 2px solid #111;
  box-shadow: 2px 0 6px rgba(0,0,0,0.35);
}

.seq-lane-header,
.seq-lane-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  box-sizing: border-box;
  padding: 0 8px;
  border-bottom: 1px solid rgba(0,0,0,0.35);
}

.seq-lane-header {
  height: 28px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted, #888);
}

.seq-lane-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a3a1a;
  border: 1px solid #0a0a0a;
  flex-shrink: 0;
}
.seq-lane-led.on {
  background: #3dff6a;
  box-shadow: 0 0 6px rgba(61, 255, 106, 0.7);
}

.seq-lane-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  padding: 2px 4px;
  border-radius: 3px;
}
.seq-lane-name:focus {
  border-color: var(--accent, #00ff88);
  outline: none;
  background: var(--bg-darker, #111);
}

.seq-lane-btn {
  width: 22px;
  height: 20px;
  padding: 0;
  font-size: 10px;
  font-weight: 800;
  border-radius: 3px;
  border: 1px solid var(--border-light, #555);
  background: var(--bg-surface, #1e1e1e);
  color: var(--text-muted, #888);
  cursor: pointer;
}
.seq-lane-btn.active-mute {
  background: #ff4444;
  border-color: #ff4444;
  color: #111;
}
.seq-lane-btn.active-solo {
  background: #e6b800;
  border-color: #e6b800;
  color: #111;
}

.seq-grid-col {
  flex: 1;
  min-width: 0;
  overflow: auto;
}

.seq-grid-header,
.seq-grid-row {
  display: flex;
  height: 36px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(0,0,0,0.25);
}

.seq-grid-header {
  height: 28px;
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg-surface-2, #2a2a2a);
}

.seq-step {
  width: 28px;
  min-width: 28px;
  height: 100%;
  box-sizing: border-box;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.25);
  cursor: pointer;
  position: relative;
}
.seq-step:nth-child(4n) {
  border-right-color: rgba(255,255,255,0.14);
}
.seq-step:nth-child(16n) {
  border-right-color: rgba(255,255,255,0.28);
}
.seq-step:hover {
  background: rgba(255,255,255,0.08);
}
/* Legacy flat step kept only as fallback; prefer .seq-pad */
.seq-step.on:not(.seq-pad) {
  background: #5ecf55;
  box-shadow: inset 1px 1px 2px rgba(255,255,255,0.35);
  border-radius: 2px;
}
.seq-step.playhead:not(.seq-pad) {
  outline: 1px solid rgba(255, 0, 85, 0.85);
  outline-offset: -1px;
}

/* MC-303 pads inside StepSequencerWindow grid */
.seq-step.seq-pad {
  width: 28px;
  min-width: 28px;
  height: calc(100% - 4px);
  margin: 2px 1px;
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 2px;
  box-sizing: border-box;
  border: 1px solid #0a0a0c;
  background: linear-gradient(180deg, #4a4e58 0%, #2c2f36 45%, #1a1c20 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -2px 3px rgba(0,0,0,0.45),
    0 2px 3px rgba(0,0,0,0.5);
}
.seq-step.seq-pad:active {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
  transform: translateY(1px);
}
.seq-step.seq-pad.beat {
  background: linear-gradient(180deg, #555a66 0%, #32363f 45%, #1e2128 100%);
}
.seq-step.seq-pad.bar {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -2px 3px rgba(0,0,0,0.45),
    0 0 0 1px rgba(0, 200, 255, 0.25),
    0 2px 3px rgba(0,0,0,0.5);
}
.seq-step.seq-pad .seq-pad-led {
  position: absolute;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a0a0a;
  border: 1px solid #000;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}
.seq-step.seq-pad.on .seq-pad-led {
  background: #ff2a2a;
  box-shadow:
    0 0 6px rgba(255, 40, 40, 0.95),
    0 0 12px rgba(255, 60, 40, 0.5),
    inset 0 1px 0 rgba(255,255,255,0.35);
}
.seq-step.seq-pad.on.beat .seq-pad-led {
  background: #ffcc33;
  box-shadow:
    0 0 6px rgba(255, 200, 50, 0.95),
    0 0 12px rgba(255, 180, 40, 0.45);
}
.seq-step.seq-pad.on.bar .seq-pad-led {
  background: #33ff88;
  box-shadow:
    0 0 6px rgba(50, 255, 130, 0.95),
    0 0 14px rgba(40, 255, 120, 0.5);
}
.seq-step.seq-pad .seq-pad-label {
  font-size: 7px;
  font-weight: 700;
  color: rgba(255,255,255,0.28);
  line-height: 1;
  pointer-events: none;
}
.seq-step.seq-pad.on .seq-pad-label {
  color: rgba(255,255,255,0.55);
}
.seq-step.seq-pad.playhead {
  outline: 2px solid #ff3355;
  outline-offset: 0;
}
.seq-step-header {
  width: 28px;
  min-width: 28px;
  height: 100%;
  box-sizing: border-box;
  border-right: 1px solid rgba(255,255,255,0.06);
  font-size: 9px;
  color: var(--text-muted, #888);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 2px;
}
.seq-step-header:nth-child(4n) {
  color: #ccc;
}

.seq-footer {
  flex-shrink: 0;
  padding: 6px 12px;
  border-top: 1px solid var(--border-main, #333);
  font-size: 11px;
  color: var(--text-muted, #888);
  display: flex;
  gap: 12px;
  align-items: center;
}

/* view-mode-sequencer is transport chrome only; content is primary-view-slot */
.daw-app.view-mode-sequencer .seq-session-host {
  display: none; /* legacy host div if still in DOM */
}
.seq-session-host {
  display: none;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-base, #1a1a1a);
}

/* Align step rows with track-header heights */
.seq-session-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.seq-session-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--bg-elevated, #333);
  border-bottom: 1px solid var(--border-main, #333);
  flex-shrink: 0;
  min-height: 36px;
  box-sizing: border-box;
}

/* Header spacer is set in JS to match this toolbar; keep body rows = track-header height */
.seq-session-host-root .primary-view-body {
  align-items: stretch;
}
.track-headers-container.is-session-headers .track-headers-spacer {
  background: var(--bg-elevated, #333);
  border-bottom: 1px solid var(--border-main, #333);
  box-sizing: border-box;
}
.seq-session-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.seq-session-row {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border-main, #444);
  height: 120px;
  min-height: 120px;
  max-height: 120px;
}
.seq-session-row.is-child {
  opacity: 0.9;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
}
.seq-session-steps {
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%;
}

/* MC-303 style rubber pad + LED */
.seq-session-step.seq-pad {
  width: 32px;
  min-width: 32px;
  height: calc(100% - 6px);
  margin: 3px 2px;
  border-radius: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 3px;
  box-sizing: border-box;
  cursor: pointer;
  border: 1px solid #0a0a0c;
  background: linear-gradient(180deg, #4a4e58 0%, #2c2f36 45%, #1a1c20 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -2px 3px rgba(0,0,0,0.45),
    0 2px 3px rgba(0,0,0,0.5);
}
.seq-session-step.seq-pad:active {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
  transform: translateY(1px);
}
.seq-session-step.seq-pad.beat {
  background: linear-gradient(180deg, #555a66 0%, #32363f 45%, #1e2128 100%);
}
.seq-session-step.seq-pad.bar {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -2px 3px rgba(0,0,0,0.45),
    0 0 0 1px rgba(0, 200, 255, 0.25),
    0 2px 3px rgba(0,0,0,0.5);
}
.seq-pad-led {
  position: absolute;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a0a0a;
  border: 1px solid #000;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}
.seq-session-step.seq-pad.on .seq-pad-led {
  background: #ff2a2a;
  box-shadow:
    0 0 6px rgba(255, 40, 40, 0.95),
    0 0 12px rgba(255, 60, 40, 0.5),
    inset 0 1px 0 rgba(255,255,255,0.35);
}
.seq-session-step.seq-pad.on.beat .seq-pad-led {
  background: #ffcc33;
  box-shadow:
    0 0 6px rgba(255, 200, 50, 0.95),
    0 0 12px rgba(255, 180, 40, 0.45);
}
.seq-session-step.seq-pad.on.bar .seq-pad-led {
  background: #33ff88;
  box-shadow:
    0 0 6px rgba(50, 255, 130, 0.95),
    0 0 14px rgba(40, 255, 120, 0.5);
}
.seq-pad-label {
  font-size: 8px;
  font-weight: 700;
  color: rgba(255,255,255,0.28);
  line-height: 1;
  pointer-events: none;
}
.seq-session-step.seq-pad.on .seq-pad-label {
  color: rgba(255,255,255,0.55);
}
.seq-session-step.seq-pad.playhead {
  outline: 2px solid #ff3355;
  outline-offset: 0;
}
.seq-session-row.audio .seq-session-step.seq-pad.on .seq-pad-led {
  background: #ff9933;
  box-shadow: 0 0 8px rgba(255, 150, 40, 0.9);
}

/* Gate SVG kept for optional context-menu use later */
.seq-step-svg {
  position: absolute;
  inset: 3px 2px;
  width: calc(100% - 4px);
  height: calc(100% - 6px);
  pointer-events: none;
  overflow: visible;
}
.seq-gate-bar {
  fill: rgba(20, 40, 25, 0.85);
}
.seq-gate-cap-on {
  fill: #c8ffd0;
}
.seq-gate-cap-off {
  fill: #1a1a1a;
  stroke: rgba(0,0,0,0.5);
  stroke-width: 0.5;
}

/* Polyphonic mini-lane (timeline-like, not step pads) */
.seq-poly-lane {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.04) 0,
      rgba(255,255,255,0.04) 1px,
      transparent 1px,
      transparent 28px
    ),
    rgba(0,0,0,0.35);
  overflow: hidden;
}
.seq-poly-note {
  position: absolute;
  top: 20%;
  height: 60%;
  border-radius: 2px;
  background: #4a90e2;
  border: 1px solid #2a70c2;
  box-sizing: border-box;
  pointer-events: none;
  min-width: 3px;
}
.seq-poly-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff3355;
  pointer-events: none;
  z-index: 2;
}
.seq-lane-mode-tag {
  position: absolute;
  left: 4px;
  top: 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
  z-index: 1;
}
/* Side / tile panel for editors (piano roll, step seq, etc.) */
.editor-tile-host {
  display: flex;
  flex-direction: column;
  flex: 0 0 42%;
  min-width: 280px;
  max-width: 55%;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--border-main, #333);
  background: var(--bg-base, #1a1a1a);
}

.editor-tile-host > * {
  flex: 1;
  min-height: 0;
  min-width: 0;
}

/* When tiled, keep track headers + timeline + tile in one row */
.arrange-view {
  /* you already have display: flex; ensure it stays horizontal */
}

/* Optional: if tile should only show when populated */
.editor-tile-host:empty {
  display: none;
  flex-basis: 0;
  min-width: 0;
  border: none;
}

.editor-tile-host.is-primary-fill {
  flex: 1 1 auto;
  max-width: none;
  min-width: 0;
  border-left: none;
}
.daw-content-host {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  position: relative;
}