/* ==========================================================================
   DrumPlay Design System - Modern Dark Aesthetic & Audio-Visual Tokens
   ========================================================================== */

:root {
  --bg-dark: #080b12;
  --bg-card: #0e1320;
  --bg-secondary: #141b2d;
  --bg-glass: rgba(14, 19, 32, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(6, 182, 212, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-pink: #ec4899;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(59, 130, 246, 0.08) 0%, transparent 40%);
}

/* Header Navbar */
.header {
  height: 60px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
}

.logo-container h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* MIDI Status Badge */
.midi-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.midi-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.2);
}

.midi-status-badge.connected .midi-status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.midi-status-badge.connected {
  color: var(--text-main);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
}

/* Button Component */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.btn:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-accent {
  background: linear-gradient(135deg, #059669, #047857);
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Main Container Layout */
.app-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  padding: 1rem 1.5rem;
  gap: 1rem;
}

/* Practice Control Bar */
.control-bar {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  backdrop-filter: blur(16px);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.control-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.speed-buttons {
  display: flex;
  gap: 4px;
  background: rgba(10, 13, 20, 0.6);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.speed-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.speed-btn:hover {
  color: var(--text-main);
}

.speed-btn.active {
  background: var(--accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
}

.toggle-switch input {
  display: none;
}

.slider-track {
  width: 34px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  position: relative;
  transition: background 0.3s ease;
}

.slider-thumb {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch input:checked + .slider-track {
  background: var(--accent-green);
}

.toggle-switch input:checked + .slider-track .slider-thumb {
  transform: translateX(16px);
}

/* Playback Progress Bar Strip (PROMINENT INTERACTIVE TIMELINE) */
.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 260px;
  background: rgba(10, 13, 20, 0.7);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.progress-bar {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
  transition: width 0.1s linear;
}

.time-display {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  font-weight: 700;
  min-width: 90px;
  text-align: right;
}

/* Main Arena Grid */
.game-arena {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1rem;
  min-height: 480px;
}

@media (max-width: 1024px) {
  .game-arena {
    grid-template-columns: 1fr;
  }
}

/* Canvas Viewport */
.canvas-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.song-info h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.song-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.score-stats {
  display: flex;
  gap: 1.5rem;
}

.stat-item {
  text-align: right;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.canvas-wrapper {
  flex: 1;
  position: relative;
  width: 100%;
  min-height: 380px;
  background: rgba(8, 11, 18, 0.95);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

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

/* Gameplay Feedback Flash Overlay */
.feedback-overlay {
  position: absolute;
  top: 15px;
  left: 170px;
  pointer-events: none;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 1px;
  opacity: 0;
  transform: translateY(0) scale(0.8);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-overlay.show {
  opacity: 1;
  transform: translateY(-20px) scale(1.1);
}

.feedback-overlay.perfect { color: #10b981; text-shadow: 0 0 12px rgba(16, 185, 129, 0.8); }
.feedback-overlay.great { color: #3b82f6; text-shadow: 0 0 12px rgba(59, 130, 246, 0.8); }
.feedback-overlay.miss { color: #ef4444; text-shadow: 0 0 12px rgba(239, 68, 68, 0.8); }

/* Right Panel: Top-Down Drumkit Visualizer */
.kit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ==========================================================================
   SVG Virtual Drumkit Animations & Micro-Interactions (Alesis Nitro Mesh)
   ========================================================================== */
.drum-pad {
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
  transform-origin: center;
}

.drum-pad:hover {
  filter: brightness(1.2) drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
}

/* Anticipated Pre-Hit Guide Glow */
.drum-pad.guide-active {
  filter: brightness(1.3) drop-shadow(0 0 14px rgba(6, 182, 212, 0.85));
  animation: padPulse 0.4s infinite alternate ease-in-out;
}

@keyframes padPulse {
  from {
    transform: scale(1.0);
  }
  to {
    transform: scale(1.04);
  }
}

/* 250ms Instant Hit Micro-Animation Flash */
.drum-pad.hit {
  animation: padHitFlash 0.25s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes padHitFlash {
  0% {
    transform: scale(1.15);
    filter: brightness(2.2) drop-shadow(0 0 25px #ffffff) drop-shadow(0 0 35px var(--accent-cyan));
  }
  40% {
    transform: scale(1.08);
    filter: brightness(1.8) drop-shadow(0 0 18px var(--accent-cyan));
  }
  100% {
    transform: scale(1.0);
    filter: brightness(1.0);
  }
}

@keyframes progressPulse {
  0% {
    opacity: 0.7;
    filter: brightness(1.0);
  }
  100% {
    opacity: 1.0;
    filter: brightness(1.3) drop-shadow(0 0 8px var(--accent-cyan));
  }
}


