/* ==========================================================================
   BEAT STUDIO - STYLESHEET
   Cyber Synth Aesthetic / DAW Mixing Console
   ========================================================================== */

:root {
  --bg-dark: #0a0b10;
  --bg-surface: #12141e;
  --bg-card: #181b29;
  --bg-card-hover: #1f2335;
  --border-color: #262a3f;
  --border-bright: #3c4263;

  --neon-cyan: #00f0ff;
  --neon-cyan-glow: rgba(0, 240, 255, 0.4);
  --neon-magenta: #ff3366;
  --neon-magenta-glow: rgba(255, 51, 102, 0.4);
  --neon-gold: #ffd12a;
  --neon-gold-glow: rgba(255, 209, 42, 0.4);
  --neon-purple: #9d4edd;
  --neon-purple-glow: rgba(157, 78, 221, 0.4);
  --neon-green: #00f59b;
  --neon-green-glow: rgba(0, 245, 155, 0.4);

  --text-main: #f0f2fd;
  --text-muted: #8c93b0;
  --text-dim: #545b7a;

  --pad-idle: #1b1e2d;
  --pad-idle-border: #282c42;
  --pad-beat-group: #202436;

  --font-display: 'Cabinet Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(121, 40, 202, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 10% 20%, rgba(0, 240, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 51, 102, 0.08) 0%, transparent 40%);
}

.app-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ==========================================================================
   HEADER & BRANDING
   ========================================================================== */

.studio-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon-pulse {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
  padding: 2px;
}

.logo-icon-pulse .bar {
  width: 5px;
  background: var(--neon-cyan);
  border-radius: 2px;
  animation: pulseBar 1.2s ease-in-out infinite alternate;
}

.logo-icon-pulse .b1 { height: 40%; animation-delay: 0.1s; }
.logo-icon-pulse .b2 { height: 90%; animation-delay: 0.3s; background: var(--neon-magenta); }
.logo-icon-pulse .b3 { height: 60%; animation-delay: 0.2s; background: var(--neon-gold); }
.logo-icon-pulse .b4 { height: 100%; animation-delay: 0.4s; background: var(--neon-green); }

@keyframes pulseBar {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1); }
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  font-weight: 900;
  background: linear-gradient(135deg, #fff 20%, var(--neon-cyan) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--neon-cyan);
  display: block;
}

/* ==========================================================================
   TRANSPORT BAR
   ========================================================================== */

.transport-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-transport {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-transport:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateY(-1px);
}

.btn-transport:active {
  transform: translateY(1px);
}

.btn-primary-play {
  background: linear-gradient(135deg, #00d2ff, #0088ff);
  border-color: #00d2ff;
  color: #000;
  font-weight: 800;
  min-width: 100px;
  justify-content: center;
}

.btn-primary-play:hover {
  box-shadow: 0 0 16px var(--neon-cyan-glow);
  transform: translateY(-1px) scale(1.02);
}

.btn-primary-play.playing {
  background: linear-gradient(135deg, var(--neon-magenta), #d90429);
  border-color: var(--neon-magenta);
  color: #fff;
  animation: playPulse 1.6s infinite alternate;
}

@keyframes playPulse {
  0% { box-shadow: 0 0 8px rgba(255, 51, 102, 0.4); }
  100% { box-shadow: 0 0 22px rgba(255, 51, 102, 0.9); }
}

.btn-accent-glow {
  border-color: var(--neon-purple);
  color: #e0b0ff;
}

.btn-accent-glow:hover {
  background: rgba(157, 78, 221, 0.2);
  box-shadow: 0 0 12px var(--neon-purple-glow);
}

.transport-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color);
  margin: 0 4px;
}

/* Control Boxes (BPM & Swing) */
.control-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.control-val {
  color: var(--neon-cyan);
  font-weight: 700;
  font-size: 0.85rem;
}

.tempo-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-btn:hover {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.tap-btn {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.1s;
}

.tap-btn.tapped {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 10px var(--neon-cyan);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-action:hover {
  color: #fff;
  border-color: var(--text-muted);
}

/* ==========================================================================
   VISUALIZER SECTION
   ========================================================================== */

.visualizer-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.visualizer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.viz-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.live-dot {
  color: var(--neon-green);
  font-size: 1.2rem;
  line-height: 0;
  animation: blinkLive 1.5s infinite;
}

@keyframes blinkLive {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.viz-modes {
  display: flex;
  gap: 6px;
}

.viz-mode-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.viz-mode-btn:hover {
  color: var(--text-main);
  border-color: var(--border-bright);
}

.viz-mode-btn.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 120px;
  background: #090a10;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

#visualizer-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   PRESETS BAR
   ========================================================================== */

.presets-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.presets-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.preset-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-pill:hover {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-bright);
}

.preset-pill.active {
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.3), rgba(0, 240, 255, 0.2));
  border-color: var(--neon-cyan);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

/* ==========================================================================
   FX RACK (SOUND SLIDERS)
   ========================================================================== */

.fx-rack-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.fx-rack-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.fx-rack-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: #fff;
}

.fx-rack-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fx-sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.fx-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fx-card:hover {
  border-color: var(--border-bright);
}

.fx-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fx-name {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.fx-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.fx-hint {
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Custom Range Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #0d0f17;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* Slider Color Themes */
.slider-cyan::-webkit-slider-thumb {
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}

.slider-magenta::-webkit-slider-thumb {
  background: var(--neon-magenta);
  box-shadow: 0 0 8px var(--neon-magenta);
}

.slider-red::-webkit-slider-thumb {
  background: #ff4757;
  box-shadow: 0 0 8px #ff4757;
}

.slider-purple::-webkit-slider-thumb {
  background: var(--neon-purple);
  box-shadow: 0 0 8px var(--neon-purple);
}

.slider-gold::-webkit-slider-thumb {
  background: var(--neon-gold);
  box-shadow: 0 0 8px var(--neon-gold);
}

.slider-green::-webkit-slider-thumb {
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
}

/* ==========================================================================
   SEQUENCER GRID
   ========================================================================== */

.sequencer-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.sequencer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.seq-heading {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: #fff;
}

.seq-help {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sequencer-scroll-container {
  overflow-x: auto;
  padding-bottom: 8px;
}

.sequencer-scroll-container::-webkit-scrollbar {
  height: 8px;
}

.sequencer-scroll-container::-webkit-scrollbar-track {
  background: var(--bg-surface);
}

.sequencer-scroll-container::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}

/* Step Header Row */
.step-headers-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  min-width: 820px;
}

.track-header-spacer {
  width: 170px;
  flex-shrink: 0;
}

.step-header-cell {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 4px 0;
  border-radius: 4px;
  margin: 0 2px;
  transition: all 0.1s;
}

.step-header-cell.beat-start {
  color: var(--text-muted);
  font-weight: 700;
}

.step-header-cell.current-step {
  color: #fff;
  background: rgba(0, 240, 255, 0.25);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

/* Grid Rows */
.grid-rows-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 820px;
}

.track-row {
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.015);
  transition: background 0.1s;
}

.track-row:hover {
  background: rgba(255, 255, 255, 0.035);
}

.track-row.row-hit {
  background: rgba(0, 240, 255, 0.05);
}

.track-row.dimmed-row {
  opacity: 0.25;
}

.track-row.muted-row {
  opacity: 0.35;
}

/* Track Info Header */
.track-info {
  width: 170px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 12px;
}

.track-preview-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.track-preview-btn:hover {
  background: var(--bg-card);
}

.track-preview-btn.preview-pulse {
  transform: scale(1.08);
  color: var(--neon-cyan);
}

.track-icon {
  font-size: 0.95rem;
}

.track-actions {
  display: flex;
  gap: 4px;
}

.track-btn-mute,
.track-btn-solo {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.track-btn-mute:hover,
.track-btn-solo:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

.track-btn-mute.active {
  background: #ff4757;
  border-color: #ff4757;
  color: #fff;
}

.track-btn-solo.active {
  background: var(--neon-gold);
  border-color: var(--neon-gold);
  color: #000;
}

/* Track Pads */
.track-pads {
  display: flex;
  flex: 1;
  gap: 4px;
}

.pad-cell {
  flex: 1;
  height: 38px;
  background: var(--pad-idle);
  border: 1px solid var(--pad-idle-border);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  transition: transform 0.08s, background-color 0.12s, box-shadow 0.12s, border-color 0.12s;
}

/* Beat grouping contrast (subtle darker / lighter alternation every 4 steps) */
.pad-cell.beat-group-2,
.pad-cell.beat-group-4 {
  background: var(--pad-beat-group);
}

.pad-cell.beat-start {
  border-left: 2px solid var(--border-bright);
}

.pad-cell:hover {
  border-color: #555c82;
  transform: scale(1.03);
  z-index: 2;
}

/* Running Playhead Beam */
.pad-cell.current-step {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 8px rgba(0, 240, 255, 0.4);
}

.pad-cell.current-step::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  pointer-events: none;
}

/* Category Colors for Active Pads */

/* 1. Drums (Kick, Snare, Clap, Tom) -> Neon Red/Orange */
.track-cat-drums .pad-cell.active {
  background: linear-gradient(135deg, #ff3366, #ff6b35);
  border-color: #ff6b35;
  box-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
}

/* 2. Hats (Hi-Hat C, Hi-Hat O) -> Neon Gold/Yellow */
.track-cat-hats .pad-cell.active {
  background: linear-gradient(135deg, #ffd12a, #ff9f1c);
  border-color: #ffd12a;
  box-shadow: 0 0 10px rgba(255, 209, 42, 0.5);
}

/* 3. Bass -> Neon Violet/Purple */
.track-cat-bass .pad-cell.active {
  background: linear-gradient(135deg, #7928ca, #9d4edd);
  border-color: #9d4edd;
  box-shadow: 0 0 10px rgba(157, 78, 221, 0.5);
}

/* 4. Synths -> Neon Cyan/Turquoise */
.track-cat-synth .pad-cell.active {
  background: linear-gradient(135deg, #00f0ff, #0077b6);
  border-color: #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* Accent Pads (Right-click or Velocity 2) */
.pad-cell.active.accent {
  box-shadow: 0 0 16px #fff, 0 0 24px currentColor;
  border-color: #fff;
}

.pad-cell.active.accent::before {
  content: '⚡';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  color: #fff;
  text-shadow: 0 0 4px #000;
  pointer-events: none;
}

/* Hit Flash (when playing this exact step) */
.pad-cell.hit-flash {
  filter: brightness(1.7);
  transform: scale(1.1);
}

/* ==========================================================================
   FOOTER & SHORTCUTS
   ========================================================================== */

.studio-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 4px 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.shortcuts-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.legend-title {
  color: var(--text-muted);
  font-weight: 600;
}

.shortcut-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

kbd {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.footer-credit {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 900px) {
  .studio-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .transport-bar {
    width: 100%;
    justify-content: flex-start;
  }
}
