/* TV Screen Styles for Karaoke-XT */

body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-primary);
}

/* Background gradient nodes */
.bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(150px);
  z-index: 0;
  pointer-events: none;
}

.bg-glow-pink {
  background: radial-gradient(circle, rgba(255, 0, 127, 0.15) 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: pulseGlow 12s infinite alternate;
}

.bg-glow-cyan {
  background: radial-gradient(circle, rgba(0, 242, 254, 0.12) 0%, transparent 70%);
  bottom: -10%;
  right: -10%;
  animation: pulseGlow 15s infinite alternate;
}

/* Grid Layout */
.app-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  height: 100vh;
  width: 100vw;
  position: relative;
  z-index: 1;
}

/* Main Content: Player / Welcome */
.main-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 30px;
  height: 100vh;
  position: relative;
}

/* Welcome Screen */
.welcome-container {
  width: 100%;
  max-width: 960px;
  border-radius: 24px;
  padding: 24px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
}

.welcome-header {
  text-align: center;
  margin-bottom: 10px;
}

.karaoke-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.8rem;
  letter-spacing: 4px;
  color: var(--text-primary);
  text-shadow: var(--glow-pink);
  margin-bottom: 5px;
  display: inline-block;
}

.karaoke-logo span {
  color: var(--accent-cyan);
  text-shadow: var(--glow-cyan);
}

.welcome-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 5px;
  letter-spacing: 1px;
}

.welcome-header p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 5px;
}

/* Connection Box */
.connection-box {
  display: flex;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 20px;
  align-items: center;
  gap: 30px;
  margin: 15px 0;
  justify-content: center;
}

.qr-wrapper {
  position: relative;
  background: white;
  padding: 10px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-wrapper img {
  width: 140px;
  height: 140px;
  display: block;
}

.scan-pulse {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid var(--accent-pink);
  border-radius: 16px;
  pointer-events: none;
  animation: qrPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes qrPulse {
  0% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(255, 0, 127, 0.4);
  }
  70% {
    transform: scale(1.04);
    opacity: 0.5;
    box-shadow: 0 0 0 15px rgba(255, 0, 127, 0);
  }
  100% {
    transform: scale(1);
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(255, 0, 127, 0);
  }
}

.connection-details h2 {
  font-family: var(--font-display);
  color: var(--accent-cyan);
  font-size: 1.3rem;
  margin-bottom: 10px;
  text-shadow: var(--glow-cyan);
}

.connection-details p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

.connection-link {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent-pink);
  text-decoration: none;
  font-size: 1.15rem;
  background: rgba(255, 0, 127, 0.1);
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 0, 127, 0.2);
  text-shadow: 0 0 5px rgba(255, 0, 127, 0.3);
  transition: var(--transition-fast);
}

/* Features Row */
.features-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 12px 15px;
  text-align: center;
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

/* Player Wrapper */
.player-wrapper {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background: #000;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-wrapper.hidden {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#yt-player {
  width: 100%;
  height: 100%;
  border: none;
}

.player-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 30px;
}

.player-overlay-top {
  display: flex;
  align-items: center;
  gap: 15px;
  animation: slideDownFade 0.5s ease-out;
}

.singer-badge {
  background: rgba(255, 0, 127, 0.9);
  padding: 8px 16px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--glow-pink);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 50%;
  animation: pulseDot 1.5s infinite alternate;
}

@keyframes pulseDot {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.3); opacity: 1; }
}

.song-badge {
  background: rgba(15, 17, 38, 0.96);
  padding: 8px 20px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.pin-badge {
  background: rgba(15, 17, 38, 0.96);
  border: 1.5px solid var(--accent-cyan);
  padding: 8px 16px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--glow-cyan);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Sidebar Styling */
.sidebar {
  border-left: 1px solid var(--glass-border);
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  padding: 20px;
  gap: 15px;
  z-index: 2;
  overflow: hidden;
  background: rgba(8, 9, 22, 0.8);
}

.mini-connection {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-qr-wrapper {
  background: white;
  padding: 4px;
  border-radius: 8px;
}

.mini-qr-wrapper img {
  width: 55px;
  height: 55px;
  display: block;
}

.mini-text {
  display: flex;
  flex-direction: column;
}

.mini-text .label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 1px;
}

.mini-text .url {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-cyan);
  text-decoration: none;
  margin-top: 3px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Now Playing Panel */
.now-playing-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.np-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  font-style: italic;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.np-active-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.np-thumbnail-wrapper {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16/9;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.np-thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.np-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.np-info {
  margin-top: 10px;
  flex: 1;
}

.np-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-meta {
  display: flex;
  align-items: center;
  margin-top: 6px;
}

.np-singer {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-pink);
  background: rgba(255, 0, 127, 0.08);
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 0, 127, 0.15);
}

/* Audio Visualizer Simulation - GPU Optimized using transform scaleY to prevent Layout Reflows */
.visualizer {
  display: flex;
  align-items: flex-end;
  height: 25px;
  gap: 3px;
  margin-top: 10px;
}

.visualizer .bar {
  flex: 1;
  background: linear-gradient(to top, var(--accent-pink) 0%, var(--accent-cyan) 100%);
  border-radius: 3px 3px 0 0;
  height: 25px; /* Set static full height */
  transform-origin: bottom; /* Scale from bottom up */
  transform: scaleY(0.08); /* Initial scale */
  animation: bounce 0.8s ease-in-out infinite alternate;
  will-change: transform; /* Promote to GPU layer for butter-smooth animation */
}

.visualizer .bar:nth-child(2) { animation-delay: 0.15s; }
.visualizer .bar:nth-child(3) { animation-delay: 0.3s; }
.visualizer .bar:nth-child(4) { animation-delay: 0.05s; }
.visualizer .bar:nth-child(5) { animation-delay: 0.22s; }
.visualizer .bar:nth-child(6) { animation-delay: 0.1s; }
.visualizer .bar:nth-child(7) { animation-delay: 0.35s; }
.visualizer .bar:nth-child(8) { animation-delay: 0.18s; }

@keyframes bounce {
  0% { transform: scaleY(0.08); }
  100% { transform: scaleY(1); }
}

/* Queue Panel */
.queue-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.queue-list-wrapper {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.queue-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  font-style: italic;
  padding: 40px 20px;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-radius: 12px;
}

.queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  animation: slideInLeftFade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transition: var(--transition-normal);
}

.queue-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.qi-index {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
}

.qi-thumbnail {
  width: 70px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.qi-info {
  flex: 1;
  overflow: hidden;
}

.qi-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

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

.qi-singer {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.qi-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Toast System */
.toast-container {
  position: absolute;
  bottom: 40px;
  left: 40px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 15px;
  pointer-events: none;
  max-width: 500px;
}

.toast {
  background: rgba(15, 17, 38, 0.85);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px 24px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.4;
  animation: toastIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
             toastOut 0.5s cubic-bezier(0.6, -0.28, 0.735, 0.045) 4.5s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-add { border-left: 4px solid var(--accent-pink); }
.toast-remove { border-left: 4px solid #ff4d4d; }
.toast-now-playing { border-left: 4px solid var(--accent-cyan); }
.toast-skip { border-left: 4px solid var(--accent-purple); }

/* Animation Keyframes */
@keyframes slideDownFade {
  0% { transform: translateY(-20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes slideInLeftFade {
  0% { transform: translateX(30px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes toastIn {
  0% { transform: translateY(50px) scale(0.85); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes toastOut {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-20px) scale(0.9); opacity: 0; }
}



/* Reaction Overlay System */
.reaction-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.floating-emoji {
  position: absolute;
  bottom: -50px;
  font-size: 3rem;
  line-height: 1;
  pointer-events: none;
  animation: floatUpEmoji 3.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  will-change: transform, opacity;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

@keyframes floatUpEmoji {
  0% {
    transform: translateY(0) scale(0.3) rotate(0deg);
    opacity: 0;
  }
  15% {
    opacity: 1;
    transform: translateY(-80px) scale(1.4) rotate(15deg);
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translateY(-110vh) scale(0.8) rotate(-20deg);
    opacity: 0;
  }
}

/* Room PIN Styles */
.pin-display-wrapper {
  margin-top: 15px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 2px;
  background: rgba(255, 0, 127, 0.1);
  border: 1px dashed var(--accent-pink);
  padding: 8px 16px;
  border-radius: 12px;
  display: inline-block;
  text-shadow: var(--glow-pink);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.1);
}

#tv-pin-code {
  color: var(--accent-cyan);
  text-shadow: var(--glow-cyan);
}

.mini-pin {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-pink);
  background: rgba(255, 0, 127, 0.08);
  border: 1px solid rgba(255, 0, 127, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  align-self: flex-start;
  letter-spacing: 1px;
  display: inline-block;
}

/* App Container layout when playing (Full Screen Video) */
.app-container.is-playing {
  grid-template-columns: 1fr; /* Hide sidebar column completely */
}

.app-container.is-playing .sidebar {
  display: none !important;
}

.app-container.is-playing .main-content {
  padding: 0 !important;
}

.app-container.is-playing .player-wrapper {
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}
/* Activation Overlay for Autoplay Unlock */
.click-detector {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  cursor: pointer;
  background: rgba(8, 9, 22, 0.96);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

.activation-content {
  text-align: center;
  max-width: 500px;
  padding: 40px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.activation-content h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--text-primary);
}

.activation-content p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.btn-activate {
  background: linear-gradient(135deg, var(--accent-pink) 0%, var(--accent-purple) 100%);
  color: white;
  border: none;
  padding: 14px 32px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: var(--glow-pink);
  transition: all 0.3s ease;
  animation: pulseActivate 2s infinite;
}

.btn-activate:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.8);
}

@keyframes pulseActivate {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* Player Top Overlay - Up Next Banner */
.next-song-badge {
  background: rgba(15, 17, 38, 0.96);
  border: 1.5px solid var(--accent-cyan);
  padding: 8px 20px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--glow-cyan);
  transition: all 0.3s ease;
  height: 43px; /* Match height of other badges */
  box-sizing: border-box;
}

.next-song-badge .next-label {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 1px;
}

.next-song-badge .next-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-song-badge .next-singer {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-pink);
  background: rgba(255, 0, 127, 0.08);
  padding: 2px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 0, 127, 0.15);
}
