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

:root {
  --neon-cyan: #00ffff;
  --neon-pink: #ff00ff;
  --neon-purple: #9d4edd;
  --neon-blue: #4cc9f0;
  --dark-bg: #000000;
  --dark-panel: #080810;
  --dark-border: #1a1a2e;
  --dark-surface: #0d0d18;
  --glow-cyan: 0 0 8px var(--neon-cyan), 0 0 16px rgba(0, 255, 255, 0.4);
  --glow-pink: 0 0 8px var(--neon-pink), 0 0 16px rgba(255, 0, 255, 0.4);
  --glow-purple: 0 0 8px var(--neon-purple);
}

body {
  font-family: 'Roboto', sans-serif;
  background: var(--dark-bg);
  color: #ffffff;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
}

body:not(.fullscreen) {
  overflow: auto;
}

.jukebox-container {
  height: 100vh;
  width: 100vw;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, #000000 0%, #050510 100%);
}

/* ===== HEADER ===== */
.jukebox-header {
  background: rgba(8, 8, 16, 0.98);
  border-bottom: 1px solid var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.15);
  padding: 0.6rem 1.5rem;
  backdrop-filter: blur(12px);
}

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

.jukebox-title {
  font-family: 'Orbitron', monospace;
  font-size: 1.3rem;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.glow-text {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  letter-spacing: 0.15em;
}

.jukebox-subtitle {
  font-size: 0.55rem;
  color: rgba(157, 78, 221, 0.9);
  font-weight: 400;
  letter-spacing: 0.25em;
  margin-top: 0.15rem;
}

.header-nav {
  display: flex;
  gap: 0.75rem;
}

.nav-link {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

/* ===== MAIN BODY LAYOUT ===== */
.jukebox-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0.75rem;
  padding: 0.75rem;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

@media (max-width: 1440px) {
  .jukebox-body {
    grid-template-columns: 1fr 320px;
  }
}

@media (max-width: 1024px) {
  .jukebox-body {
    grid-template-columns: 1fr 300px;
    gap: 0.5rem;
    padding: 0.5rem;
  }
}

@media (max-width: 900px) {
  .jukebox-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .visualization-panel {
    order: 1;
    min-height: 50vh;
    max-height: 65vh;
  }
  
  .control-panel {
    order: 2;
    max-height: 35vh;
    overflow-y: auto;
  }
}

/* ===== VISUALIZATION PANEL ===== */
.visualization-panel {
  background: var(--dark-panel);
  border: 1px solid var(--dark-border);
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  width: 100%;
  height: 100%;
  min-height: 0;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#canvas {
  display: flex;
  align-items: center;
  justify-content: center;
}

#canvas canvas {
  display: block;
}

.viz-overlay {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  right: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.viz-name {
  font-family: 'Orbitron', monospace;
  font-size: 0.75rem;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  background: rgba(0, 0, 0, 0.8);
  padding: 0.35rem 0.7rem;
  border-radius: 3px;
  border: 1px solid rgba(0, 255, 255, 0.4);
  letter-spacing: 0.08em;
}

.beat-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--neon-pink);
  box-shadow: var(--glow-pink);
  opacity: 0;
  transition: opacity 0.1s ease;
}

.beat-indicator.active {
  opacity: 1;
  animation: beatPulse 0.25s ease;
}

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

/* ===== CONTROL PANEL ===== */
.control-panel {
  background: var(--dark-panel);
  border: 1px solid var(--dark-border);
  border-radius: 6px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

/* ===== TABS ===== */
.tab-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.6rem;
  background: var(--dark-surface);
  border-radius: 4px;
  padding: 3px;
}

.tab {
  flex: 1;
  padding: 0.5rem 0.6rem;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.tab:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 255, 255, 0.1);
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.1);
}

/* ===== TAB CONTENT ===== */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 0.3rem 0;
}

.tab-content.active {
  display: block;
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.control-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem;
  color: var(--neon-purple);
  letter-spacing: 0.15em;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  opacity: 0.9;
}

/* ===== TRACK SELECTOR ===== */
.track-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.track-btn {
  background: var(--dark-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.5rem 0.3rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
}

.track-btn:hover {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
  color: var(--neon-cyan);
  transform: translateY(-1px);
}

.track-btn:active {
  transform: translateY(0);
}

.track-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.track-name {
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

/* ===== PLAYBACK CONTROLS ===== */
.playback-controls {
  display: flex;
  justify-content: center;
  margin: 0.6rem 0;
}

.play-pause-btn {
  background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  color: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), inset 0 0 15px rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.play-pause-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.play-pause-btn:hover::before {
  opacity: 1;
}

.play-pause-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.5), 0 0 40px rgba(157, 78, 221, 0.3);
}

.play-pause-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.btn-text {
  font-size: 0.55rem;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* ===== SLIDERS ===== */
.audio-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.08em;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 12px var(--neon-cyan);
}

.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px var(--neon-cyan);
}

/* ===== VISUALIZATION SELECTOR ===== */
.viz-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.viz-btn {
  background: var(--dark-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 0.45rem 0.4rem;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.65rem;
  text-align: center;
  font-weight: 500;
  line-height: 1.2;
}

.viz-btn:hover {
  border-color: var(--neon-purple);
  box-shadow: 0 0 10px rgba(157, 78, 221, 0.4);
  color: var(--neon-purple);
}

.viz-btn.active {
  border-color: var(--neon-cyan);
  background: rgba(0, 255, 255, 0.08);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  background: var(--dark-surface);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
}

.toggle-switch:hover {
  border-color: rgba(0, 255, 255, 0.3);
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  width: 36px;
  height: 18px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: white;
}

.toggle-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.viz-controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rotation-speed {
  margin-top: 0.3rem;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ===== FOOTER ===== */
.jukebox-footer {
  background: rgba(8, 8, 16, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.5rem 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.7rem;
}

/* ===== SCROLLBARS ===== */
.tab-content::-webkit-scrollbar,
.viz-grid::-webkit-scrollbar {
  width: 4px;
}

.tab-content::-webkit-scrollbar-track,
.viz-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
}

.tab-content::-webkit-scrollbar-thumb,
.viz-grid::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 255, 0.4);
  border-radius: 2px;
}

.tab-content::-webkit-scrollbar-thumb:hover,
.viz-grid::-webkit-scrollbar-thumb:hover {
  background: var(--neon-cyan);
}

/* ===== FLOATING BUTTONS ===== */
.fullscreen-btn {
  position: fixed;
  bottom: 0.75rem;
  right: 0.75rem;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
  transition: all 0.2s ease;
  z-index: 1000;
}

.fullscreen-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(0, 255, 255, 0.6);
}

.fullscreen-btn:active {
  transform: scale(0.95);
}

.reset-btn {
  position: fixed;
  bottom: 0.75rem;
  left: 0.75rem;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(255, 0, 255, 0.4);
  transition: all 0.2s ease;
  z-index: 1000;
  opacity: 0.6;
}

.reset-btn:hover {
  transform: scale(1.1) rotate(180deg);
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.6);
  opacity: 1;
}

/* ===== FULLSCREEN MODE ===== */
body.fullscreen {
  overflow: hidden;
}

body.fullscreen .jukebox-container {
  height: 100vh;
  width: 100vw;
}

body.fullscreen .jukebox-header,
body.fullscreen .jukebox-footer {
  display: none;
}

body.fullscreen .jukebox-body {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  padding: 0;
  gap: 0;
}

body.fullscreen .visualization-panel {
  border-radius: 0;
  border: none;
  padding: 0;
  min-height: 100vh;
  max-height: 100vh;
}

body.fullscreen .control-panel {
  display: none;
}

/* ===== CANVAS-ONLY FULLSCREEN ===== */
body.canvas-fullscreen {
  overflow: hidden;
}

#canvas:fullscreen,
#canvas:-webkit-full-screen,
#canvas:-moz-full-screen,
#canvas:-ms-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  background: #000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
}

#canvas:fullscreen canvas,
#canvas:-webkit-full-screen canvas,
#canvas:-moz-full-screen canvas,
#canvas:-ms-fullscreen canvas {
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: auto !important;
  display: block !important;
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 900px) {
  .jukebox-header {
    padding: 0.5rem 0.75rem;
  }
  
  .jukebox-title {
    font-size: 1rem;
  }
  
  .jukebox-subtitle {
    font-size: 0.5rem;
  }
  
  .nav-link {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }
  
  .track-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
  }
  
  .track-btn {
    padding: 0.4rem 0.2rem;
    font-size: 0.6rem;
  }
  
  .track-icon {
    font-size: 1rem;
  }
  
  .play-pause-btn {
    width: 54px;
    height: 54px;
  }
  
  .btn-icon {
    font-size: 1.1rem;
  }
  
  .btn-text {
    font-size: 0.5rem;
  }
  
  .viz-grid {
    max-height: 160px;
    gap: 0.25rem;
  }
  
  .viz-btn {
    padding: 0.35rem 0.3rem;
    font-size: 0.58rem;
  }
  
  .tabs {
    margin-bottom: 0.5rem;
  }
  
  .tab {
    padding: 0.4rem 0.5rem;
    font-size: 0.58rem;
  }
  
  .control-label {
    font-size: 0.55rem;
    margin-bottom: 0.3rem;
  }
  
  .slider-label {
    font-size: 0.55rem;
  }
  
  .toggle-label {
    font-size: 0.55rem;
  }
  
  .toggle-slider {
    width: 32px;
    height: 16px;
  }
  
  .toggle-slider::before {
    width: 12px;
    height: 12px;
  }
  
  .toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
  }
}

@media (max-width: 480px) {
  .jukebox-body {
    padding: 0.25rem;
    gap: 0.25rem;
  }
  
  .visualization-panel {
    min-height: 55vh;
    max-height: 55vh;
    padding: 0.25rem;
  }
  
  .control-panel {
    max-height: 45vh;
    padding: 0.4rem;
  }
  
  .track-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .viz-grid {
    max-height: 140px;
  }
}
