.background-download-manager {
  background: var(--background-secondary);
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
  border: 1px solid var(--border-color);
}

.background-download-manager.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Status Header */
.download-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-dot.idle {
  background: var(--text-tertiary);
  animation: none;
}

.status-dot.downloading {
  background: #4CAF50;
}

.status-dot.queued {
  background: #FF9800;
}

.status-dot.error {
  background: #f44336;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-weight: 500;
  color: var(--text-primary);
}

.download-stats {
  display: flex;
  gap: 16px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.stat {
  white-space: nowrap;
}

/* Progress Bar */
.download-progress {
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--background-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  transition: width 0.3s ease;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.8em;
  color: var(--text-tertiary);
}

/* Data Usage */
.data-usage {
  margin-bottom: 12px;
}

.usage-bar {
  width: 100%;
  height: 3px;
  background: var(--background-tertiary);
  border-radius: 1.5px;
  overflow: hidden;
  margin-bottom: 4px;
}

.usage-fill {
  height: 100%;
  background: #2196F3;
  transition: width 0.3s ease;
}

.usage-fill.limit-reached {
  background: #f44336;
}

.usage-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.8em;
  color: var(--text-tertiary);
}

/* Action Buttons */
.download-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.action-btn {
  padding: 6px 12px;
  background: var(--background-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: var(--background-hover);
  color: var(--text-primary);
}

/* Queue Display */
.download-queue {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-bottom: 12px;
}

.download-queue h4 {
  margin: 0 0 8px 0;
  font-size: 0.9em;
  color: var(--text-primary);
}

.empty-queue {
  color: var(--text-tertiary);
  font-style: italic;
  margin: 8px 0;
}

.queue-list {
  max-height: 200px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  margin-bottom: 4px;
  background: var(--background-tertiary);
  border-radius: 6px;
  border-left: 3px solid transparent;
}

.queue-item.downloading {
  border-left-color: #4CAF50;
}

.queue-item.pending {
  border-left-color: #FF9800;
}

.queue-item.failed {
  border-left-color: #f44336;
}

.queue-item.completed {
  border-left-color: #2196F3;
  opacity: 0.7;
}

.item-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.item-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-artist {
  font-size: 0.8em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8em;
}

.priority {
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
  text-transform: uppercase;
}

.priority.favorites {
  background: #E91E63;
  color: white;
}

.priority.frequent {
  background: #FF9800;
  color: white;
}

.priority.discovery {
  background: #2196F3;
  color: white;
}

.queue-more {
  text-align: center;
  padding: 8px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Settings Panel */
.download-settings {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.download-settings h4 {
  margin: 0 0 12px 0;
  font-size: 0.9em;
  color: var(--text-primary);
}

.setting-group {
  margin-bottom: 12px;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9em;
  color: var(--text-secondary);
  cursor: pointer;
}

.setting-label input[type="checkbox"] {
  margin: 0;
}

.setting-label input[type="number"],
.setting-label input[type="time"] {
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--background-primary);
  color: var(--text-primary);
  font-size: 0.9em;
  width: 80px;
}

.overnight-settings {
  margin-left: 24px;
  padding: 8px;
  background: var(--background-tertiary);
  border-radius: 6px;
}

.time-inputs {
  display: flex;
  gap: 16px;
}

.time-inputs label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8em;
}

/* Overnight Indicator */
.overnight-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--background-tertiary);
  border-radius: 6px;
  font-size: 0.8em;
  color: var(--text-secondary);
  border-left: 3px solid #9C27B0;
}

.overnight-icon {
  font-size: 1.2em;
}

/* Responsive Design */
@media (max-width: 768px) {
  .download-stats {
    flex-direction: column;
    gap: 4px;
  }
  
  .download-actions {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
    text-align: center;
  }
  
  .time-inputs {
    flex-direction: column;
    gap: 8px;
  }
  
  .queue-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .item-status {
    align-self: flex-end;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .background-download-manager {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .action-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .queue-item {
    background: rgba(255, 255, 255, 0.05);
  }
  
  .overnight-settings {
    background: rgba(255, 255, 255, 0.05);
  }
  
  .overnight-indicator {
    background: rgba(255, 255, 255, 0.05);
  }
}