/* Stylesheet: styles.css */

/* Grundlegende Reset-Stile und Schriftart-Definition */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Poppins', sans-serif;
  color: #ffffff;
  background-color: #121212;
  /* Fallback-Farbe, falls das Bild nicht geladen wird */
  background-image: url('/images/background.webp');
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  /* Fixiert das Hintergrundbild */
  background-size: cover;
  /* Stellt sicher, dass das Bild den Bildschirm ausfüllt */

  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Login Container mit animierter LED-Umrandung */
.login-container {
  width: 350px;
  max-width: 90%;
  padding: 2rem;
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: visible;
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

/* LED Animation */
.login-container::before,
.login-container::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(255, 0, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(255, 0, 255, 0.9), 
              0 0 30px rgba(255, 0, 255, 0.5);
  animation: led-move 5s linear infinite;
}

/* LED Animation */
.login-container::after {
  animation-delay: -2.5s; /* Statt positiver Verzögerung eine negative Verzögerung */
}

/* LED-Bewegungsanimation */
@keyframes led-move {
  0%   { top: -5px; left: -5px; }
  25%  { top: -5px; left: calc(100% - 5px); }
  50%  { top: calc(100% - 5px); left: calc(100% - 5px); }
  75%  { top: calc(100% - 5px); left: -5px; }
  100% { top: -5px; left: -5px; }
}

/* Überschrift im Login-Formular */
.login-container h2 {
  text-align: center;
  font-weight: 600;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}

/* Eingabefelder */
.form-group {
  margin-bottom: 1.2rem;
  margin-top: 15px;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.form-group input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: #2ec5fa;
  /* hellblauer Fokus-Rand */
  box-shadow: 0 0 8px rgba(46, 197, 250, 0.5);
  outline: none;
}

/* Login-Button */
.login-button {
  width: 100%;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(to right, #2ec5fa, #a13bf7);
  background-size: 200% 100%;
  background-position: 0% 50%;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-position 0.5s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.login-button:hover {
  background-position: 100% 50%;
  /* Gradient-Effekt bei Hover (verschiebt den Verlauf) */
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.login-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(46, 197, 250, 0.5);
}

.login-button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Responsives Design für mobile Geräte (kleinere Anpassungen) */
@media (max-width: 480px) {
  .login-container {
    padding: 1.5rem 1rem;
  }

  .login-container h2 {
    font-size: 1.5rem;
  }
}

#sound-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

#speaker-icon {
  width: 30px;
  height: 30px;
  transition: fill 0.3s ease;
}

/* Sound-Wellen Container */
.sound-waves {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  opacity: 0; /* Unsichtbar, bis der Sound an ist */
  transition: opacity 0.3s ease;
}

/* Einzelne Wellen */
.wave {
  width: 4px;
  height: 12px;
  background: white;
  border-radius: 2px;
  animation: sound-wave 1.2s infinite ease-in-out;
}

/* Unterschiedliche Verzögerungen für realistische Bewegung */
.wave:nth-child(1) { animation-delay: 0s; }
.wave:nth-child(2) { animation-delay: 0.3s; height: 16px; }
.wave:nth-child(3) { animation-delay: 0.6s; height: 10px; }

/* Animation für Wellenbewegung */
@keyframes sound-wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50% { transform: scaleY(1.5); opacity: 1; }
}

/* Wenn der Sound läuft → Wellen anzeigen */
.sound-active .sound-waves {
  opacity: 1;
}

/* 
   🏃‍♂️ Sprite-Animation für eine laufende Figur (Tanzende Animation für Fruity Dance)
   - Dieses Sprite-Sheet enthält 8 Frames pro Zeile und 10 Zeilen
   - Die Figur läuft nur, wenn die Musik aktiv ist
*/

.sprite-animation {
  top: 0px; /* Positioniert die Animation oben im Container */
  right: -20px; /* Verschiebt die Animation leicht nach rechts */
  position: absolute; /* Ermöglicht exakte Platzierung relativ zum übergeordneten Container */
  
  width: 128px; /* Breite eines einzelnen Frames */
  height: 128px; /* Höhe eines einzelnen Frames */
  
  background: url('/images/dance_full.png') no-repeat; /* Setzt das Sprite-Sheet als Hintergrund */
  background-size: 1024px 1280px; /* Stellt sicher, dass das Bild richtig skaliert wird
     - 1024px Breite: 8 Frames mit je 128px (8 * 128px)
     - 1280px Höhe: 10 Zeilen mit je 128px (10 * 128px)
  */

  transform: scale(0.7); /* Verkleinert die Figur auf 70% der Originalgröße */
  transform-origin: top left; /* Skalierung beginnt von der oberen linken Ecke */
  
  /* Standard: Animation in Pause/Stopped nur 1. Zeile animieren */
  animation: run-cycle 1s steps(8) infinite, row-change 10s steps(1) infinite;
}

/* 
   🎵 Aktiv: Animation läuft nur, wenn Musik spielt
   - Diese Klasse wird durch JavaScript hinzugefügt, wenn der Sound aktiv ist
   - Die Animation besteht aus zwei Bewegungen:
     run-cycle (horizontale Bewegung) → Wechselt durch die 8 Frames der aktuellen Zeile
     row-change (vertikale Bewegung) → Wechselt alle 10 Sekunden zur nächsten Zeile
*/
.animate-running {
  animation: run-cycle 1s steps(8) infinite, row-change 10s steps(10) infinite;
}

/* Animation in Pause nur 1. Zeile animieren ohne Tanz */
.animate-pause {
  animation: run-cycle 1s steps(8) infinite, row-change 10s steps(1) infinite;
}

/* 
   Horizontale Animation (Wechsel der Frames innerhalb einer Zeile)
   - Verschiebt den Hintergrund von links nach rechts, um 8 Frames durchzugehen
   - `steps(8)`: Die Animation springt exakt durch die 8 Frames
   - `1s`: Die Animation dauert 1 Sekunde pro Durchlauf
   - `infinite`: Sie wiederholt sich endlos
*/
@keyframes run-cycle {
  from { background-position: 0px; }
  to { background-position: -1024px; } /* Verschiebt das Bild nach links */
}

/* 
   Vertikale Animation (Wechsel der Animationszeile)
   - Verschiebt den Hintergrund nach oben, um zur nächsten Zeile zu wechseln
   - `steps(10)`: Die Animation springt durch 10 Zeilen
   - `10s`: Es dauert 10 Sekunden, bis zur nächsten Zeile gewechselt wird
*/
@keyframes row-change {
  from { background-position-y: 0px; }
  to { background-position-y: -1280px; } /* Verschiebt das Bild nach oben */
}
