/* ============================================================
   BEAT MAKER - style.css
   The cool neon look for your beat maker! 🥁
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 20% 20%, #1a1a2e, #0b0b1a 60%, #0f0f22);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #eee;
  padding: 20px;
}

.container {
  text-align: center;
  max-width: 90%;
}

h1 {
  font-size: 3.2em;
  margin-bottom: 5px;
  color: #e94560;
  text-shadow: 0 0 12px rgba(233, 69, 96, 0.9), 0 0 35px rgba(233, 69, 96, 0.5), 0 0 70px rgba(233, 69, 96, 0.25);
  letter-spacing: 2px;
  animation: neonPulse 2.6s ease-in-out infinite;
}

@keyframes neonPulse {
  0%, 100% { text-shadow: 0 0 12px rgba(233,69,96,0.9), 0 0 35px rgba(233,69,96,0.5); }
  50% { text-shadow: 0 0 16px rgba(233,69,96,1), 0 0 50px rgba(233,69,96,0.7), 0 0 90px rgba(233,69,96,0.4); }
}

.subtitle {
  margin-bottom: 25px;
  opacity: 0.85;
  color: #c8c8ff;
}

/* ---- Control panel ---- */
.controls {
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.06);
  padding: 14px 22px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 8px 24px rgba(0,0,0,0.3);
}

.color-control {
  gap: 12px;
}

input[type="range"] {
  width: 180px;
  cursor: pointer;
  accent-color: #e94560;
  filter: drop-shadow(0 0 6px rgba(233,69,96,0.6));
}

#tempo-value {
  font-weight: bold;
  color: #e94560;
  min-width: 70px;
}

#volume-value {
  font-weight: bold;
  color: #6ef08a;
  min-width: 45px;
}

/* ---- Beat color control ---- */
#beat-color {
  width: 48px;
  height: 34px;
  border: 2px solid #3a4a6b;
  border-radius: 6px;
  cursor: pointer;
  background: #1a1a2e;
  padding: 2px;
}

.cycle-btn {
  background: #ffd166;
  color: #16213e;
}

.cycle-btn:hover {
  background: #ffe07d;
}

.cycle-btn.on {
  background: #e94560;
  color: #fff;
}

.color-status {
  font-weight: bold;
  color: #6ef08a;
  min-width: 34px;
}

/* ---- 8 / 16 step toggle ---- */
.steps-toggle {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.steps-toggle .btn.active {
  background: #e94560;
  border-color: #e94560;
}

/* ---- The pad grid ----
   The number of columns is set by JS via the --steps variable,
   so we can switch between 8 and 16 steps easily. */
#pads {
  display: grid;
  grid-template-columns: repeat(var(--steps, 8), 55px);
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
}

.pad {
  width: 55px;
  height: 55px;
  border: none;
  border-radius: 10px;
  background: #2a2a4a;
  color: #eee;
  font-weight: bold;
  font-size: 0.75em;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.4), 0 3px 0 rgba(0,0,0,0.3);
}

.pad:hover {
  transform: scale(1.05) translateY(-1px);
  box-shadow: 0 0 14px rgba(255,255,255,0.15);
}

/* Different colors for each instrument row */
.pad[data-row="0"] { background: #3b2e5a; } /* kick (low) */
.pad[data-row="1"] { background: #3a4a6b; } /* snare */
.pad[data-row="2"] { background: #2f5e4e; } /* hihat */
.pad[data-row="3"] { background: #6b3a44; } /* open hat */
.pad[data-row="4"] { background: #5a4a2e; } /* clap */

/* An "on" pad glows. Color comes from a CSS variable set by JS. */
.pad.on {
  background: var(--beat-color, #e94560);
  box-shadow: 0 0 12px var(--beat-color, #e94560), 0 0 28px var(--beat-color, #e94560), inset 0 -3px 0 rgba(0,0,0,0.25);
}

/* The current beat step flashes white */
.pad.step {
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 30px rgba(255, 255, 255, 0.6);
}

/* ---- Transport buttons (Play / Record / Clear) ---- */
.transport {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 28px;
  font-size: 1.1em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: #e94560;
  color: #fff;
  font-weight: bold;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 16px rgba(233,69,96,0.4);
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(233,69,96,0.7);
}

.btn.small {
  padding: 6px 14px;
  font-size: 0.9em;
  background: #6ec3ff;
  color: #16213e;
}

.btn.small:hover {
  background: #8fd0ff;
}

.btn.danger {
  background: #444;
}

.btn.danger:hover {
  background: #555;
}

.btn.record {
  background: #dc3545;
}

.btn.record:hover {
  background: #e94b5b;
}

.btn.record.recording {
  background: #ff073a;
  animation: pulse 1s infinite;
  box-shadow: 0 0 20px rgba(255, 7, 58, 0.8);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* A plain Download button (no renaming) */
.download-link {
  display: inline-block;
  margin-top: 15px;
  padding: 12px 28px;
  border-radius: 8px;
  background: #6ec3ff;
  color: #16213e;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1em;
  cursor: pointer;
  transition: background 0.2s;
}

.download-link:hover {
  background: #8fd0ff;
}

/* ---- Song Library ---- */
.library {
  margin-top: 25px;
  background: rgba(255, 255, 255, 0.06);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 30px rgba(0,0,0,0.35);
}

.library h2 {
  color: #ffd166;
  font-size: 1.3em;
  margin-bottom: 15px;
  text-shadow: 0 0 12px rgba(255, 209, 102, 0.4);
}

.save-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.song-name {
  padding: 12px 14px;
  font-size: 1em;
  border: 2px solid #3a4a6b;
  border-radius: 8px;
  background: #1a1a2e;
  color: #eee;
  width: 220px;
  outline: none;
}

.song-name:focus {
  border-color: #ffd166;
}

.btn.save {
  background: #28a745;
}

.btn.save:hover {
  background: #2ebd4f;
}

.save-status {
  margin-top: 10px;
  font-size: 0.9em;
  min-height: 1.2em;
  font-weight: bold;
}

.save-status.ok {
  color: #6ef08a;
}

.save-status.warn {
  color: #ffd166;
}

.song-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.song-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 14px;
}

.song-item .song-title {
  flex: 1;
  text-align: left;
  font-weight: bold;
}

.song-item .song-meta {
  font-size: 0.75em;
  opacity: 0.6;
  margin-top: 2px;
  display: block;
}

.song-item .btn.small {
  background: #28a745;
  color: #fff;
}

.song-item .btn.small:hover {
  background: #2ebd4f;
}

.song-item .btn.del {
  background: #8b2e2e;
  color: #fff;
}

.song-item .btn.del:hover {
  background: #a83838;
}

.song-item.current {
  outline: 2px solid #ffd166;
}

/* ---- Keyboard melody ---- */
.keyboard-section {
  margin-top: 30px;
  background: rgba(255, 255, 255, 0.06);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 30px rgba(0,0,0,0.35);
}

.keyboard-section h2 {
  color: #6ec3ff;
  font-size: 1.3em;
  margin-bottom: 15px;
  text-shadow: 0 0 12px rgba(110, 195, 255, 0.4);
}

.keyboard-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
}

.octave-label {
  font-weight: bold;
  color: #6ec3ff;
  min-width: 90px;
}

#keyboard {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  user-select: none;
}

.key {
  width: 52px;
  height: 170px;
  border: 2px solid #0f3460;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #ffffff, #e8ecf8);
  color: #16213e;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  transition: transform 0.08s, background 0.08s, box-shadow 0.08s;
}

.key .key-name {
  font-size: 0.75em;
  background: #e94560;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 6px;
}

/* Black keys sit higher and overlap the white ones */
.key.black {
  width: 34px;
  height: 105px;
  background: linear-gradient(180deg, #2b2b52, #10102a);
  color: #fff;
  margin-left: -22px;
  margin-right: -22px;
  z-index: 2;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.key.black .key-name {
  background: #6ec3ff;
  color: #16213e;
}

/* When pressed, the key glows */
.key.active {
  background: #e94560;
  color: #fff;
  transform: translateY(6px);
  box-shadow: 0 0 20px rgba(233, 69, 96, 0.7);
}

.key.black.active {
  background: #ff5e7a;
}

.key-hint {
  margin-top: 12px;
  font-size: 0.85em;
  opacity: 0.75;
}

.hint {
  margin-top: 20px;
  margin-bottom: 20px;
  font-size: 0.9em;
  opacity: 0.7;
}
