.downloads-page {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.downloads-header {
    margin-bottom: 30px;
    text-align: center;
}

.downloads-header h2 {
    margin: 0 0 8px 0;
    font-size: 2rem;
    font-weight: 600;
}

.downloads-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.storage-stats {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 12px;
}

.storage-stats h3 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--background);
    border-radius: 8px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--accent);
}

.queue-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 12px;
}

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

.queue-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.clear-queue-btn {
    padding: 8px 16px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.clear-queue-btn:hover {
    opacity: 0.8;
}

.queue-status {
    color: var(--text-secondary);
}

.queue-empty {
    color: var(--text-secondary);
    font-style: italic;
}

.active-downloads {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 12px;
}

.active-downloads h3 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-item {
    padding: 15px;
    background: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.download-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.download-id {
    font-weight: 500;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.download-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.download-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--background-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

.download-instructions {
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 12px;
}

.download-instructions h3 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.download-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.download-instructions li {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .downloads-page {
        padding: 15px;
    }
    
    .downloads-header h2 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .queue-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .download-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .download-id {
        max-width: 100%;
    }
}

/* Downloaded Tracks Section */
.downloaded-tracks {
    margin-top: 30px;
    margin-bottom: 30px;
}

.downloaded-tracks h3 {
    margin-bottom: 15px;
    color: #333;
}

.downloaded-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.downloaded-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.downloaded-item:last-child {
    border-bottom: none;
}

.downloaded-item:hover {
    background-color: #f9f9f9;
}

.track-icon {
    margin-right: 12px;
}

.green-checkmark {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
    font-size: 14px;
}

.track-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.track-details .track-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.track-details .track-status {
    font-size: 0.9em;
    color: #4caf50;
    font-weight: 500;
}

.downloaded-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}

.load-more-button {
    padding: 12px 16px;
    text-align: center;
    background: #007bff;
    color: white;
    cursor: pointer;
    border-radius: 0 0 8px 8px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.load-more-button:hover {
    background: #0056b3;
}

/* Download History */
.download-history {
    margin-top: 30px;
}

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

.history-header h3 {
    margin: 0;
    color: #333;
}

.history-count {
    font-size: 0.9em;
    color: #666;
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 12px;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.history-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background-color: #f9f9f9;
}

.history-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.track-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.track-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.track-artist {
    font-size: 0.9em;
    color: #666;
}

.download-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.history-status.completed {
    background-color: #4caf50;
    color: white;
}

.history-status.failed {
    background-color: #f44336;
    color: white;
}

.download-time {
    font-size: 0.8em;
    color: #999;
    white-space: nowrap;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
}
/* Enhanced Download Tracking Styles */
.download-stats-section {
    margin-bottom: 2rem;
}

.download-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.active-downloads-section,
.completed-downloads-section,
.failed-downloads-section {
    margin-bottom: 2rem;
}

.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.download-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--brand-color);
}

.download-item.active {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.download-item.completed {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.download-item.failed {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

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

.download-title {
    font-weight: 600;
    color: var(--font-color);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-artist,
.download-album {
    font-size: 0.875rem;
    color: var(--font-color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 120px;
}

.progress-bar {
    width: 80px;
    height: 6px;
    background: var(--background-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.progress-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--font-color-secondary);
    min-width: 35px;
}

.download-status {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
}

.download-status.completed {
    color: #10b981;
    background: rgba(16, 185, 129, 0.2);
}

.download-status.failed {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

.download-timestamp {
    font-size: 0.75rem;
    color: var(--font-color-tertiary);
    margin-right: 1rem;
}

.download-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-right: 1rem;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .download-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .download-progress {
        width: 100%;
        justify-content: space-between;
    }
    
    .progress-bar {
        flex: 1;
        max-width: 200px;
    }
}