:root {
  --visualizer-height: 250px;
}

/* Visualizer Container */
.visualizer-container {
  position: relative;
  width: 100%;
  height: var(--visualizer-height);
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--border-color);
}

#particle-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visualizer-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--spacing-md);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  pointer-events: none;
}

.visualizer-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Stats Section */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  text-align: center;
  transition: all var(--transition-fast);
}

.stat-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--spacing-xs);
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Stats Section Headers */
.stats-section {
  margin-bottom: var(--spacing-xl);
}

.stats-section h3 {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Top Tracks List */
.top-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.top-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.top-rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-purple);
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.top-rank.top-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.top-rank.top-2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.top-rank.top-3 { background: linear-gradient(135deg, #b45309, #92400e); }

.top-info {
  flex: 1;
  min-width: 0;
}

.top-title {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Activity Heatmap */
.activity-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: var(--spacing-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.heatmap-day {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
}

.heatmap-day:hover {
  transform: scale(1.2);
  z-index: 1;
}

.heatmap-day.level-0 { background: var(--bg-secondary); }
.heatmap-day.level-1 { background: rgba(139, 92, 246, 0.2); }
.heatmap-day.level-2 { background: rgba(139, 92, 246, 0.4); }
.heatmap-day.level-3 { background: rgba(139, 92, 246, 0.6); }
.heatmap-day.level-4 { background: rgba(139, 92, 246, 0.8); }
.heatmap-day.level-5 { background: var(--accent-purple); }

/* Responsive Stats */
@media (min-width: 640px) {
  :root {
    --visualizer-height: 300px;
  }
  
  .stats-grid {
    gap: var(--spacing-lg);
  }
  
  .stat-card {
    padding: var(--spacing-lg);
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .visualizer-status {
    font-size: 0.875rem;
  }
}

@media (min-width: 1024px) {
  :root {
    --visualizer-height: 350px;
  }
}

/* ============================================
   TV DISPLAY MODE (Fullscreen)
   Minimalistisch - Alleen particles + track info
   ============================================ */

/* Fullscreen button styling */
.fullscreen-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.header-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Canvas fullscreen button */
.canvas-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 1.25rem;
  transition: all var(--transition-fast);
  z-index: 50;
  opacity: 0.6;
}

.canvas-fullscreen-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-primary);
  opacity: 1;
}

body.tv-display-mode {
  overflow: hidden;
}

/* Verberg alles behalve visualizer + track info */
body.tv-display-mode .app-header,
body.tv-display-mode .stream-selector,
body.tv-display-mode .tab-nav,
body.tv-display-mode .content-area > .tab-content:not(#tab-playing),
body.tv-display-mode .volume-control,
body.tv-display-mode .action-buttons,
body.tv-display-mode .progress-container,
body.tv-display-mode .album-art-container,
body.tv-display-mode .playing-indicator,
body.tv-display-mode .listeners-badge,
body.tv-display-mode .controls {
  display: none !important;
}

/* Fullscreen Visualizer - volledig scherm */
body.tv-display-mode .visualizer-container {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  margin: 0 !important;
  z-index: 1;
  background: #0a0a0f;
}

body.tv-display-mode #particle-canvas {
  width: 100vw !important;
  height: 100vh !important;
}

body.tv-display-mode .visualizer-overlay {
  display: none;
}

/* Track Info - Gecentreerd in het midden */
body.tv-display-mode .track-info {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 100;
  text-align: center;
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(20px);
  padding: 30px 40px !important;
  border-radius: 20px !important;
  border: none !important;
  max-width: 90vw;
}

body.tv-display-mode .track-details {
  text-align: center;
  max-width: 80vw;
}

body.tv-display-mode .track-title {
  font-size: 2rem !important;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,0.8);
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.3;
}

body.tv-display-mode .track-artist {
  font-size: 1.25rem !important;
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  white-space: normal;
  word-wrap: break-word;
}

body.tv-display-mode .track-meta {
  display: none !important;
}

/* Mini player verbergen in TV modus */
body.tv-display-mode .mini-player,
body.tv-display-mode .canvas-fullscreen-btn {
  display: none !important;
}

/* Exit hint */
body.tv-display-mode::after {
  content: 'Press ESC or F11 to exit';
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.4);
  z-index: 50;
  animation: fadeInOut 4s ease-in-out 2s;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  20%, 80% { opacity: 1; }
}