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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #1A1A2E;
  color: #FFFFFF;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* Animated Background Glow */
.animated-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(135deg, #FFD700 0%, #FF69B4 20%, #00CED1 40%, #9370DB 60%, #4169E1 80%, #FF1493 100%);
  background-size: 400% 400%;
  opacity: 0.3;
  transition: opacity 0.5s ease;
  filter: blur(80px);
}

.animated-background.playing {
  animation: flowingGradient 15s ease infinite;
}

.animated-background.paused {
  animation: none;
}

@keyframes flowingGradient {
  0% {
    background-position: 0% 50%;
    transform: scale(1);
  }
  25% {
    background-position: 100% 0%;
    transform: scale(1.1);
  }
  50% {
    background-position: 100% 100%;
    transform: scale(1);
  }
  75% {
    background-position: 0% 100%;
    transform: scale(1.1);
  }
  100% {
    background-position: 0% 50%;
    transform: scale(1);
  }
}

/* Screen Management */
.screen {
  display: block;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.title {
  font-size: 3rem;
  font-weight: bold;
  color: #FFFFFF;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.2rem;
  color: #B0B0B0;
  font-weight: normal;
}

/* Cards */
.card {
  background-color: #2d324090;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #FFFFFF;
  text-align: center;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.9rem;
  color: #B0B0B0;
  text-align: center;
  margin-bottom: 20px;
}

/* Host Profile */
.host-profile {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #3A3F4E;
}

.profile-picture {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid #FFD700;
  overflow: hidden;
  margin-right: 16px;
  background-color: #3A3F4E;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info h3 {
  font-size: 1.2rem;
  font-weight: bold;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.profile-status {
  font-size: 0.9rem;
  color: #B0B0B0;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

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

.btn-primary {
  background-color: #1DB954;
  color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1ed760;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary:disabled {
  background-color: #3A3F4E;
}

.btn-secondary {
  background-color: #4A90E2;
  color: #FFFFFF;
}

.btn-secondary:hover {
  background-color: #5BA0F2;
}

.btn-join {
  width: auto;
  min-width: 100px;
  padding: 12px 24px;
}

/* Playback Control Buttons */
.playback-control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: #1DB954;
  color: #FFFFFF;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.playback-control-btn i {
  font-size: 16px;
  line-height: 1;
}

.playback-control-btn:hover:not(:disabled) {
  background-color: #1ed760;
  transform: scale(1.05);
}

.playback-control-btn:active:not(:disabled) {
  transform: scale(0.95);
  background-color: #1aa34a;
}

.playback-control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #3A3F4E;
}

.playback-controls-container {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  padding: 8px;
}

.spotify-icon {
  width: 24px;
  height: 24px;
}

/* Join Form */
.join-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.input {
  flex: 1;
  min-width: 200px;
  padding: 14px 16px;
  background-color: #3A3F4E;
  border: 1px solid #4A4F5E;
  border-radius: 8px;
  color: #FFFFFF;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.input:focus {
  outline: none;
  border-color: #4A90E2;
}

.input::placeholder {
  color: #7A7F8E;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Navigation */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 20px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: #2D3240;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: background-color 0.3s ease;
}

.nav-btn:hover {
  background-color: #3A3F4E;
}

/* Username Input Screen */
.username-screen {
  max-width: 500px;
  margin: 0 auto;
}

.username-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #B0B0B0;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.username-input-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.username-input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  background-color: #3A3F4E;
  border: 2px solid #1DB954;
  border-radius: 8px;
  color: #FFFFFF;
  font-size: 1rem;
}

.username-input:focus {
  outline: none;
  border-color: #1ed760;
}

.username-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #B0B0B0;
}

.requirements {
  margin-top: 24px;
}

.requirements-title {
  color: #B0B0B0;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.requirement-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: #1A2332;
  border: 1px solid #1DB954;
  border-radius: 8px;
  margin-bottom: 8px;
}

.requirement-item.valid {
  border-color: #1DB954;
}

.requirement-item.invalid {
  border-color: #E74C3C;
}

.requirement-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #1DB954;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: bold;
  flex-shrink: 0;
}

.requirement-item.invalid .requirement-check {
  background-color: #E74C3C;
}

.requirement-text {
  color: #1DB954;
  font-size: 0.9rem;
}

.requirement-item.invalid .requirement-text {
  color: #E74C3C;
}

/* Waveform Animation */
.waveform-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
}

#resultWaveformContainer {
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 8px 16px;
  backdrop-filter: blur(4px);
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
}

.waveform-bar {
  width: 4px;
  background-color: #1DB954;
  border-radius: 2px;
  animation: waveform 1.2s ease-in-out infinite;
}

.waveform-container.paused .waveform-bar {
  animation-play-state: paused;
}

.waveform-bar:nth-child(1) {
  animation-delay: 0s;
  height: 20px;
}

.waveform-bar:nth-child(2) {
  animation-delay: 0.1s;
  height: 30px;
}

.waveform-bar:nth-child(3) {
  animation-delay: 0.2s;
  height: 40px;
}

.waveform-bar:nth-child(4) {
  animation-delay: 0.3s;
  height: 30px;
}

.waveform-bar:nth-child(5) {
  animation-delay: 0.4s;
  height: 20px;
}

@keyframes waveform {
  0%, 100% {
    transform: scaleY(0.3);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* Playlist Selection */
.playlist-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid #3A3F4E;
}

.tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: #B0B0B0;
  font-size: 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.tab.active {
  color: #1DB954;
  border-bottom-color: #1DB954;
}

.tab:hover {
  color: #FFFFFF;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  background-color: #3A3F4E;
  border: 1px solid #4A4F5E;
  border-radius: 8px;
  color: #FFFFFF;
  font-size: 1rem;
  margin-bottom: 16px;
}

.search-input:focus {
  outline: none;
  border-color: #1DB954;
}

.playlist-list, .artist-list {
  max-height: 400px;
  overflow-y: auto;
}

.playlist-item, .artist-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background-color: #3A3F4E;
  border-radius: 8px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.playlist-item:hover, .artist-item:hover {
  background-color: #4A4F5E;
}

.playlist-image, .artist-image {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background-color: #2D3240;
  object-fit: cover;
}

.playlist-info, .artist-info {
  flex: 1;
}

.playlist-name, .artist-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.playlist-details, .artist-details {
  font-size: 0.9rem;
  color: #B0B0B0;
}

/* Game Settings */
.settings-section {
  margin-bottom: 24px;
}

.settings-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: #FFFFFF;
  margin-bottom: 16px;
}

.slider-container {
  margin-bottom: 16px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-label-text {
  color: #B0B0B0;
  font-size: 0.9rem;
}

.slider-value {
  color: #1DB954;
  font-size: 1.2rem;
  font-weight: bold;
}

.slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background-color: #3A3F4E;
  outline: none;
  -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #1DB954;
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #1DB954;
  cursor: pointer;
  border: none;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background-color: #3A3F4E;
  border-radius: 8px;
}

.toggle-label {
  color: #FFFFFF;
  font-size: 1rem;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
  background-color: #4A4F5E;
  border-radius: 13px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.toggle-switch.active {
  background-color: #1DB954;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #FFFFFF;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
}

.toggle-switch.active::after {
  transform: translateX(24px);
}

/* Game Code Screen */
.game-code-section {
  text-align: center;
  margin-bottom: 32px;
}

.code-display {
  font-size: 3rem;
  font-weight: bold;
  color: #FFFFFF;
  letter-spacing: 8px;
  margin: 16px 0;
  font-family: 'Courier New', monospace;
}

.qr-code-container {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.qr-code {
  background-color: #FFFFFF;
  padding: 16px;
  border-radius: 8px;
}

.players-section {
  margin-bottom: 24px;
}

.players-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.players-count {
  background-color: #1DB954;
  color: #FFFFFF;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  padding: 12px 16px;
  background-color: #3A3F4E;
  border-radius: 8px;
  color: #FFFFFF;
}

.player-item.host {
  color: #1DB954;
  font-weight: bold;
}

/* Gameplay Screen */
.current-song {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
  padding: 24px;
  background-color: #3A3F4E;
  border-radius: 12px;
  align-items: center;
}

.result-album-art {
  width: 160px;
  height: 160px;
  min-width: 120px;
  border-radius: 12px;
  object-fit: cover;
  background-color: #1A2332;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  display: none; /* Hidden by default, shown when src is set */
}

.result-album-art[src]:not([src=""]) {
  display: block !important;
}

.album-art {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  background-color: #2D3240;
  object-fit: cover;
}

.song-info {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.song-title {
  font-size: 1.75rem;
  font-weight: bold;
  color: #1DB954;
  margin-bottom: 8px;
  line-height: 1.3;
  word-wrap: break-word;
}

.song-artist {
  font-size: 1.1rem;
  color: #FFFFFF;
  margin-bottom: 6px;
  font-weight: 500;
  word-wrap: break-word;
}

.song-year {
  font-size: 0.95rem;
  color: #B0B0B0;
  margin-bottom: 0;
}

.device-btn {
  align-self: flex-start;
}

/* Guess Form */
.guess-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guess-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guess-label {
  color: #B0B0B0;
  font-size: 0.9rem;
}

.guess-input {
  width: 100%;
  padding: 12px 16px;
  background-color: #3A3F4E;
  border: 1px solid #4A4F5E;
  border-radius: 8px;
  color: #FFFFFF;
  font-size: 1rem;
}

.guess-input:focus {
  outline: none;
  border-color: #1DB954;
}

/* Results Screen */
.results-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid #3A3F4E;
}

.result-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: #B0B0B0;
  font-size: 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.result-tab.active {
  color: #1DB954;
  border-bottom-color: #1DB954;
}

.player-result {
  padding: 16px;
  background-color: #3A3F4E;
  border-radius: 8px;
  margin-bottom: 12px;
}

.player-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.player-result-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: #FFFFFF;
}

.player-result-score {
  font-size: 1.2rem;
  font-weight: bold;
  color: #FF9500;
}

.guess-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guess-item {
  color: #B0B0B0;
  font-size: 0.9rem;
}

.waiting-screen {
  text-align: center;
  padding: 40px 20px;
}

.waiting-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #FFFFFF;
  margin-bottom: 24px;
}

.players-status {
  display: flex;
  flex-direction: column;
  gap: 12px;

  margin: 0 auto;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #3A3F4E;
  border-radius: 8px;
}

.status-name {
  color: #FFFFFF;
  font-size: 1rem;
}

.status-text {
  color: #FF9500;
  font-size: 0.9rem;
}

/* Device Selection */
.device-list {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 16px;
}

.device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #3A3F4E;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.device-item:hover {
  background-color: #4A4F5E;
}

.device-item.selected {
  border-color: #1DB954;
  background-color: #2A3F2E;
}

.device-item.active {
  border-left: 4px solid #1DB954;
}

.device-info {
  flex: 1;
}

.device-name {
  font-size: 1rem;
  font-weight: bold;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.device-type {
  font-size: 0.9rem;
  color: #B0B0B0;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #2D3240;
}

::-webkit-scrollbar-thumb {
  background: #4A4F5E;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5A5F6E;
}

