/* ====== GLOBAL STYLE ====== */
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(ellipse at bottom, #0d0d1a 0%, #000000 100%);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  overflow-x: hidden;
}

/* Header */
header {
  text-align: center;
  padding: 2rem 1rem;
  color: #fff;
  text-shadow: 0 0 20px #ff004c;
}

header h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.1rem;
  opacity: 0.8;
}

/* ====== LATAR BELAKANG KOSMIK ====== */
.stars {
  width: 100%;
  height: 100%;
  background: transparent;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -2;
}

.stars::after {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background: transparent url('https://www.transparenttextures.com/patterns/stardust.png') repeat;
  animation: moveStars 120s linear infinite;
}

@keyframes moveStars {
  from { transform: translateY(0); }
  to { transform: translateY(-100px); }
}

/* Komet jatuh background */
.comet {
  position: fixed;
  width: 3px;
  height: 80px;
  background: linear-gradient(180deg, #ff004c, transparent);
  top: -100px;
  left: 50%;
  animation: fall 5s linear infinite;
  opacity: 0.8;
  z-index: -1;
}

@keyframes fall {
  0% { transform: translate(0, 0) rotate(45deg); opacity: 1; }
  100% { transform: translate(-500px, 1000px) rotate(45deg); opacity: 0; }
}

/* ====== TRACK STYLE ====== */
.track {
  margin: 2rem auto;
  max-width: 700px;
  padding: 1.5rem;
  background: rgba(255, 0, 76, 0.08);
  border: 1px solid #ff004c;
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(255, 0, 76, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.track:hover {
  transform: scale(1.03);
  box-shadow: 0 0 35px rgba(255, 0, 76, 0.7);
}

.track p {
  font-size: 1.3rem;
  color: #fff;
  text-shadow: 0 0 15px #ff004c;
  margin-bottom: 0.8rem;
}

/* ====== AUDIO PLAYER NEON ====== */
audio {
  width: 100%;
  outline: none;
  filter: drop-shadow(0 0 12px #ff004c);
  border-radius: 10px;
}

/* Panel kontrol */
audio::-webkit-media-controls-panel {
  background: rgba(20, 20, 20, 0.95);
  border-radius: 10px;
  box-shadow: 0 0 20px #ff004c;
}

/* Tombol play/pause */
audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-pause-button {
  background-color: #ff004c;
  border-radius: 50%;
  box-shadow: 0 0 10px #ff004c;
}

/* Waktu */
audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
  color: #ff004c;
  text-shadow: 0 0 8px #ff004c;
}

/* Progress bar */
audio::-webkit-media-controls-timeline {
  accent-color: #ff004c;
}

/* Volume slider */
audio::-webkit-media-controls-volume-slider {
  accent-color: #ff004c;
}

/* ====== Hilangkan tombol download ====== */
audio::-webkit-media-controls-enclosure {
  overflow: hidden;
}

audio::-webkit-media-controls-download-button {
  display: none !important;
}

/* ====== FOOTER ====== */
footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  color: #aaa;
  text-shadow: 0 0 10px #ff004c;
}

/* ====== LOADING SCREEN AUDIO ====== */
.audio-loader {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 1s ease;
}

.audio-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Nebula berdenyut pelan */
.nebula-pulse {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 40% 60%, rgba(230, 57, 70, 0.15) 0%, transparent 70%);
  animation: nebulaPulse 14s infinite alternate ease-in-out;
}

@keyframes nebulaPulse {
  0% { opacity: 0.25; transform: scale(1); }
  100% { opacity: 0.7; transform: scale(1.18); }
}

/* Planet berputar */
.planet {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff004c, #0d0d1a 70%);
  box-shadow: 0 0 40px #ff004c, inset 0 0 30px rgba(255,255,255,0.2);
  animation: spinPlanet 12s linear infinite;
  position: relative;
  z-index: 2;
}

.planet::after {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px dashed rgba(255,0,76,0.4);
  animation: orbitGlow 8s linear infinite;
}

@keyframes spinPlanet {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes orbitGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Efek pecah planet saat loader hilang */
.audio-loader.hidden .planet {
  animation: explodePlanet 1s forwards;
}

@keyframes explodePlanet {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2); opacity: 0; filter: blur(10px); }
}

/* Komet jatuh (tiga komet dengan delay berbeda biar lebih hidup) */
.komet-container {
  position: relative;
  width: 100%;
  height: 300px;
}

.komet {
  position: absolute;
  top: -200px;
  left: 50%;
  width: 5px;
  height: 160px;
  background: linear-gradient(to bottom, transparent, #ff004c, #ff004c, transparent);
  transform: translateX(-50%) rotate(45deg);
  animation: kometFall 5s linear infinite;
  opacity: 0;
}

.komet:nth-child(2) {
  animation-delay: 1.2s;
  left: 35%;
}

.komet:nth-child(3) {
  animation-delay: 2.8s;
  left: 65%;
}

.komet::before {
  content: '';
  position: absolute;
  top: -30px;
  left: -12px;
  width: 30px;
  height: 30px;
  background: #ff004c;
  border-radius: 50%;
  box-shadow: 0 0 50px #ff004c, 0 0 90px #ff004c;
  animation: kometGlow 2s infinite alternate;
}

@keyframes kometFall {
  0% { top: -200px; opacity: 0; transform: translateX(-50%) rotate(45deg); }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 120vh; opacity: 0; transform: translateX(-50%) rotate(45deg); }
}

@keyframes kometGlow {
  from { box-shadow: 0 0 40px #ff004c; }
  to { box-shadow: 0 0 90px #ff004c, 0 0 140px #ff004c; }
}

/* Teks loading neon */
.loader-text {
  margin-top: 3rem;
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  color: #e63946;
  text-shadow: 0 0 30px #e63946, 0 0 60px #ff004c;
  animation: pulseText 2.8s infinite alternate;
}

@keyframes pulseText {
  from { opacity: 0.6; text-shadow: 0 0 20px #e63946; }
  to { opacity: 1; text-shadow: 0 0 50px #e63946, 0 0 90px #ff004c; }
}

/* ====== ADVANCED AUDIO FEATURES ====== */

/* Beat Pulse Effect */
.beat-pulse {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  animation: beatPulse 0.5s ease-out forwards;
}

@keyframes beatPulse {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* Visualizer Mode Selector */
#visualizer-mode {
  display: block;
  margin: 10px 0;
  padding: 8px;
  background: rgba(255, 0, 76, 0.1);
  border: 1px solid #ff004c;
  border-radius: 8px;
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

#visualizer-mode:focus {
  outline: none;
  border-color: #00ffe0;
  box-shadow: 0 0 15px rgba(0, 255, 224, 0.5);
}

#visualizer-mode:hover {
  background: rgba(255, 0, 76, 0.2);
}

/* EQ Presets */
#eq-presets {
  margin-top: 15px;
}

#eq-presets h4 {
  color: #00ffe0;
  font-size: 1rem;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(0, 255, 224, 0.5);
}

.eq-preset-btn {
  transition: all 0.3s ease;
}

.eq-preset-btn:hover {
  background: rgba(0, 255, 224, 0.3) !important;
  border-color: #00ffe0 !important;
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0, 255, 224, 0.5);
}

.eq-preset-btn:active {
  transform: scale(0.95);
}

/* Enhanced Controls Styling */
.control-range {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 0, 76, 0.05);
  border: 1px solid rgba(255, 0, 76, 0.3);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.control-range:hover {
  border-color: #ff004c;
  box-shadow: 0 0 15px rgba(255, 0, 76, 0.2);
}

.control-range label {
  display: block;
  margin-bottom: 0.5rem;
  color: #fff;
  font-weight: 600;
  text-shadow: 0 0 8px #ff004c;
}

.control-range input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.3s ease;
}

.control-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff004c;
  box-shadow: 0 0 10px #ff004c;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-range input[type="range"]::-webkit-slider-thumb:hover {
  background: #00ffe0;
  box-shadow: 0 0 15px #00ffe0;
  transform: scale(1.2);
}

.control-range input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 0, 76, 0.5);
  border-radius: 5px;
  color: #fff;
  font-family: 'Orbitron', monospace;
  transition: all 0.3s ease;
}

.control-range input[type="text"]:focus {
  outline: none;
  border-color: #00ffe0;
  box-shadow: 0 0 10px rgba(0, 255, 224, 0.5);
}

/* Control Buttons Enhancement */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.controls button {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(45deg, #ff004c, #e63946);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Orbitron', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 0, 76, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 0, 76, 0.5);
  background: linear-gradient(45deg, #e63946, #ff004c);
}

.controls button:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(255, 0, 76, 0.3);
}

/* AI Assistant Enhancement */
#ai-assistant {
  background: linear-gradient(135deg, rgba(255, 0, 76, 0.1), rgba(0, 255, 224, 0.1));
  border: 1px solid rgba(255, 0, 76, 0.5);
  position: relative;
  overflow: hidden;
}

#ai-assistant::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 224, 0.1), transparent);
  animation: aiGlow 3s infinite;
}

@keyframes aiGlow {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

#ai-message {
  font-style: italic;
  color: #00ffe0;
  text-shadow: 0 0 10px rgba(0, 255, 224, 0.5);
  animation: aiTextPulse 2s infinite alternate;
}

@keyframes aiTextPulse {
  from { opacity: 0.8; }
  to { opacity: 1; }
}

/* Status Text Enhancement */
#status-text {
  color: #ff004c;
  text-shadow: 0 0 8px #ff004c;
  font-weight: 600;
  animation: statusGlow 1.5s infinite alternate;
}

@keyframes statusGlow {
  from { text-shadow: 0 0 8px #ff004c; }
  to { text-shadow: 0 0 15px #ff004c, 0 0 25px #ff004c; }
}

/* Volume Label Enhancement */
#volume-label {
  color: #00ffe0;
  text-shadow: 0 0 5px rgba(0, 255, 224, 0.5);
  font-weight: bold;
}

/* Responsive Design for New Features */
@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: center;
  }

  .controls button {
    width: 100%;
    max-width: 200px;
  }

  #eq-presets div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
  }

  .eq-preset-btn {
    font-size: 0.7rem !important;
    padding: 4px 8px !important;
  }

  #visualizer-mode {
    font-size: 0.8rem;
  }
}

/* Loading Animation for Beat Effects */
.beat-loading {
  animation: beatPulse 1s infinite;
}

/* Visualizer Canvas Enhancement */
#visualizer {
  border: 1px solid rgba(255, 0, 76, 0.3);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(255, 0, 76, 0.2);
  background: rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

#visualizer:hover {
  border-color: #00ffe0;
  box-shadow: 0 0 30px rgba(0, 255, 224, 0.3);
}

/* Track Hover Effects Enhancement */
.track {
  position: relative;
}

.track::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #ff004c, #00ffe0);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.track:hover::before {
  opacity: 1;
}

/* Audio Element Enhancement */
.track audio {
  margin-top: 1rem;
  transition: all 0.3s ease;
}

.track:hover audio {
  filter: drop-shadow(0 0 20px #ff004c);
}

/* Mobile Optimizations & Responsive Design */
@media (max-width: 1024px) {
  header, main, footer {
    padding: 1rem 0.75rem;
  }

  main {
    max-width: 100%;
    overflow-x: hidden;
  }

  header {
    padding: 1.5rem 0.75rem;
  }

  header h1 {
    font-size: 2rem;
  }

  header p {
    font-size: 1rem;
  }

  .track {
    max-width: 100%;
    margin: 1.5rem 0;
    padding: 1.2rem;
  }

  #audio-control {
    padding: 1.5rem;
    border-radius: 12px;
  }

  #audio-control h2 {
    font-size: 1.8rem;
  }

  .controls {
    gap: 0.8rem;
  }

  .controls button {
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
  }

  .control-range {
    margin-bottom: 1.2rem;
  }

  .control-range label {
    font-size: 0.9rem;
  }

  .control-range input {
    width: 100%;
    max-width: 300px;
  }

  #visualizer {
    width: 100%;
    max-width: 600px;
    height: 100px;
  }

  #audio-room h2 {
    font-size: 1.8rem;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 80px;
  }

  header, main, footer {
    padding: 0.75rem 0.5rem;
  }

  main {
    max-width: 100%;
    overflow-x: hidden;
  }

  header {
    padding: 1rem 0.5rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  header p {
    font-size: 0.9rem;
  }

  #audio-control {
    padding: 1rem;
    border-radius: 10px;
  }

  #audio-control h2 {
    font-size: 1.5rem;
  }

  #status-text {
    font-size: 0.9rem;
  }

  .controls {
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
  }

  .controls button {
    width: 100%;
    max-width: 250px;
    padding: 0.7rem 1rem;
    font-size: 0.85rem;
    border-radius: 20px;
  }

  .control-range {
    margin-bottom: 1rem;
    width: 100%;
  }

  .control-range label {
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.3rem;
  }

  .control-range input[type="range"] {
    width: 100%;
    max-width: none;
  }

  .control-range input[type="text"] {
    width: 100%;
    max-width: none;
    padding: 0.6rem;
    font-size: 0.85rem;
  }

  #eq-controls h3,
  #ai-assistant h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
  }

  #visualizer-mode {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.85rem;
  }

  #ai-message {
    font-size: 0.85rem;
  }

  #ai-assistant button {
    width: 100%;
    max-width: 200px;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    margin: 0.3rem 0;
  }

  #visualizer {
    width: 100%;
    max-width: none;
    height: 80px;
  }

  .track {
    max-width: 100%;
    margin: 1.2rem 0;
    padding: 1rem;
    border-radius: 10px;
  }

  .track p {
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
  }

  #audio-room h2 {
    font-size: 1.5rem;
  }

  #audio-room p {
    font-size: 0.9rem;
  }

  /* Reduce animation intensity on mobile for performance */
  .nebula-pulse {
    animation: nebulaPulse 20s infinite alternate ease-in-out !important;
  }

  .planet {
    animation: spinPlanet 18s linear infinite !important;
  }

  .comet {
    animation: fall 8s linear infinite !important;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
    padding-top: 60px;
  }

  header, main, footer {
    padding: 0.5rem;
  }

  main {
    max-width: 100%;
    overflow-x: hidden;
  }

  header {
    padding: 0.75rem 0.5rem;
  }

  header h1 {
    font-size: 1.2rem;
  }

  header p {
    font-size: 0.8rem;
  }

  #audio-control {
    padding: 0.75rem;
    border-radius: 8px;
  }

  #audio-control h2 {
    font-size: 1.2rem;
  }

  #status-text {
    font-size: 13px;
  }

  .controls {
    gap: 0.4rem;
  }

  .controls button {
    max-width: none;
    padding: 0.6rem 0.8rem;
    font-size: 13px;
    border-radius: 16px;
  }

  .control-range {
    margin-bottom: 0.8rem;
  }

  .control-range label {
    font-size: 13px;
  }

  .control-range input[type="range"] {
    width: 100%;
  }

  .control-range input[type="text"] {
    padding: 0.5rem;
    font-size: 13px;
    border-radius: 6px;
  }

  #eq-controls h3,
  #ai-assistant h3 {
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
  }

  #visualizer-mode {
    padding: 0.5rem;
    font-size: 13px;
    border-radius: 6px;
  }

  #ai-message {
    font-size: 13px;
  }

  #ai-assistant button {
    max-width: none;
    padding: 0.5rem 0.8rem;
    font-size: 13px;
    border-radius: 12px;
  }

  #visualizer {
    height: 60px;
    border-radius: 6px;
  }

  .track {
    margin: 1rem 0;
    padding: 0.8rem;
    border-radius: 8px;
  }

  .track p {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  #audio-room h2 {
    font-size: 1.2rem;
  }

  #audio-room p {
    font-size: 13px;
  }

  footer {
    font-size: 13px;
    padding: 0.75rem 0.5rem;
  }

  /* Further reduce animations for very small devices */
  .nebula-pulse {
    animation: nebulaPulse 25s infinite alternate ease-in-out !important;
  }

  .planet {
    animation: spinPlanet 25s linear infinite !important;
  }

  .comet {
    animation: none !important; /* Disable comet on very small screens */
  }

  /* Ensure no overflow on any element */
  * {
    max-width: 100vw;
  }

  body {
    overflow-x: hidden;
  }
}

/* Accessibility: Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .nebula-pulse,
  .planet,
  .comet,
  .track,
  .controls button,
  .control-range input,
  #ai-assistant button {
    animation: none !important;
  }
}