        /* FLOATING UPLOAD PANEL */
        .wave-upload-panel {
            position: fixed;
            bottom: 30px;
            right: 30px;
            background: rgba(20,20,20,0.95);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid rgba(245,179,1,0.2);
            border-radius: 24px;
            padding: 20px;
            z-index: 9997;
            min-width: 200px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.8);
        }
        .wave-upload-handle {
            color: var(--accent);
            font-weight: 600;
            font-size: 0.9rem;
            margin-bottom: 16px;
            letter-spacing: 0.5px;
            cursor: move;
        }
        .wave-upload-content {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .upload-btn {
            padding: 10px 20px;
            border-radius: 40px;
            text-align: center;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s;
            border: none;
            font-weight: 500;
            width: 100%;
        }
        .cs-btn-danger {
            background: rgba(255,0,0,0.15);
            color: #ff4444;
            border: 1px solid rgba(255,0,0,0.2);
            padding: 10px 20px;
            border-radius: 40px;
            text-align: center;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s;
            font-weight: 500;
            width: 100%;
        }
        .cs-btn-danger:hover {
            background: rgba(255,0,0,0.25);
        }

/*======================================================
Option 1: Move it to bottom-right of main content area

/* FLOATING UPLOAD PANEL - REPOSITIONED 
.wave-upload-panel {
    position: fixed;
    bottom: 30px;
    /* Change from right: 30px to a calculated position 
    right: 30px;
    /* Add left margin to clear sidebar 
    margin-left: var(--sidebar-width, 280px);
    background: rgba(20,20,20,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(245,179,1,0.2);
    border-radius: 24px;
    padding: 20px;
    z-index: 9997;
    min-width: 200px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    /* Add transition for smooth repositioning 
    transition: all 0.3s cubic-bezier(.22,1,.36,1);
}

/* On mobile, position normally 
@media (max-width: 991px) { 
    .wave-upload-panel {
        bottom: 16px;
        right: 16px;
        margin-left: 0;
        min-width: 160px;
        padding: 16px;
    }
}
=======================================================*/

/*======================================================
Option 2: Position it relative to main content (Better)
=======================================================*/
/* FLOATING UPLOAD PANEL - INSIDE MAIN CONTENT 
.wave-upload-panel {
    position: fixed;
    bottom: 30px;
    /* Position relative to viewport width minus sidebar 
    left: calc(var(--sidebar-width, 280px) + 30px);
    background: rgba(20,20,20,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(245,179,1,0.2);
    border-radius: 24px;
    padding: 20px;
    z-index: 9997;
    min-width: 200px;
    max-width: 220px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    transition: all 0.3s cubic-bezier(.22,1,.36,1);
}

/* On mobile 
@media (max-width: 991px) {
    .wave-upload-panel {
        left: auto;
        right: 16px;
        bottom: 16px;
        min-width: 160px;
        padding: 16px;
    }
}
=======================================================*/
/*======================================================
Option 3: Center it with a draggable handle (Most User-Friendly)
=======================================================*/
/* FLOATING UPLOAD PANEL - CENTERED & DRAGGABLE 
.wave-upload-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20,20,20,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(245,179,1,0.2);
    border-radius: 24px;
    padding: 20px;
    z-index: 9997;
    min-width: 200px;
    max-width: 220px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    cursor: move;
    transition: opacity 0.3s ease;
}

/* When dragging, remove transition for smooth movement 
.wave-upload-panel.dragging {
    transition: none;
}

/* Mobile 
@media (max-width: 991px) {
    .wave-upload-panel {
        top: auto;
        bottom: 16px;
        left: auto;
        right: 16px;
        transform: none;
        min-width: 160px;
        padding: 16px;
    }
}


/*======================================================
Option 4: Collapsible Panel (Cleanest UX)
=======================================================*/
/* FLOATING UPLOAD PANEL - COLLAPSIBLE */
.wave-upload-panel {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(20,20,20,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(245,179,1,0.2);
    border-radius: 24px;
    padding: 16px;
    z-index: 9997;
    min-width: 48px;
    min-height: 48px;
    max-width: 220px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    transition: all 0.4s cubic-bezier(.22,1,.36,1);
    overflow: hidden;
    cursor: pointer;
}

/* When collapsed, only show the handle */
.wave-upload-panel.collapsed {
    max-width: 48px;
    padding: 0;
    border-radius: 50%;
    background: rgba(245,179,1,0.15);
    border-color: var(--accent);
}

.wave-upload-panel.collapsed .wave-upload-content,
.wave-upload-panel.collapsed .upload-btn,
.wave-upload-panel.collapsed .cs-btn-danger {
    opacity: 0;
    pointer-events: none;
    max-height: 0;
    margin: 0;
    padding: 0;
}

.wave-upload-panel .wave-upload-content {
    transition: all 0.3s ease;
}

.wave-upload-panel.collapsed .wave-upload-handle {
    margin: 12px 0;
    text-align: center;
    font-size: 1.2rem;
}

/* Show a tooltip on hover when collapsed */
.wave-upload-panel.collapsed .wave-upload-handle::after {
    content: 'Open Studio';
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

.wave-upload-panel.collapsed .wave-upload-handle:hover::after {
    opacity: 1;
}

/* Mobile */
@media (max-width: 991px) {
    .wave-upload-panel {
        bottom: 16px;
        right: 16px;
        min-width: 44px;
        min-height: 44px;
        max-width: 200px;
    }
}
<script>
// ==========================================
// 🔥 WIRE UPLOAD PANEL TO HERO ENGINE
// ==========================================

document.addEventListener('DOMContentLoaded', function() {
    'use strict';

    // ==========================================
    // 1. GET UPLOAD ELEMENTS
    // ==========================================
    const trackUpload = document.getElementById('floatingTrackUpload');
    const artUpload = document.getElementById('floatingArtUpload');
    const coverUpload = document.getElementById('floatingCoverUpload');
    const resetCoverBtn = document.getElementById('floatingResetCoverBtn');
    const deleteCoverBtn = document.getElementById('floatingDeleteCoverBtn');

    // ==========================================
    // 2. COVER UPLOAD HANDLER
    // ==========================================
    if (coverUpload) {
        coverUpload.addEventListener('change', function(e) {
            const file = this.files[0];
            if (!file) return;

            // Create FormData for upload
            const formData = new FormData();
            formData.append('action', 'cs_upload_cover');
            formData.append('file', file);
            formData.append('nonce', window.csUploadConfig?.nonce || '');

            // Show loading state
            const hero = document.querySelector('[data-cs-hero]');
            if (hero) {
                hero.dataset.uploading = 'true';
            }

            // Upload the file
            fetch(window.csUploadConfig?.ajax_url || window.ajaxurl, {
                method: 'POST',
                credentials: 'same-origin',
                body: formData
            })
            .then(response => response.json())
            .then(data => {
                if (data.success && data.data?.url) {
                    const coverUrl = data.data.url;
                    
                    // 🔥 UPDATE HERO ENGINE - This is the critical part!
                    // Dispatch the state-changed event
                    window.dispatchEvent(new CustomEvent('cs:hero:state-changed', {
                        detail: {
                            cover: {
                                src: coverUrl,
                                x: 50,
                                y: 50,
                                scale: 1,
                                mode: 'cover'
                            }
                        }
                    }));

                    // Also update DOM directly (backup)
                    const coverImg = document.querySelector('[data-cs-cover]');
                    if (coverImg) {
                        coverImg.src = coverUrl;
                    }

                    // Update hero state
                    if (window.CSHeroState) {
                        window.CSHeroState.state.coverSrc = coverUrl;
                        window.CSHeroState.state.coverX = 50;
                        window.CSHeroState.state.coverY = 50;
                        window.CSHeroState.state.coverScale = 1;
                        window.CSHeroState.persist();
                        
                        // Recalibrate
                        if (window.CSHeroState.calibrateCover) {
                            const heroEl = document.querySelector('[data-cs-hero]');
                            const coverEl = document.querySelector('[data-cs-cover]');
                            window.CSHeroState.calibrateCover(heroEl, coverEl, window.CSHeroState.state);
                            window.CSHeroState.enforceStrictBoundaries();
                            window.CSHeroState.applyCalibratedTransform();
                        }
                    }

                    console.log('[UPLOAD] Cover updated:', coverUrl);
                } else {
                    console.error('[UPLOAD] Cover upload failed:', data);
                    alert('Cover upload failed. Please try again.');
                }
            })
            .catch(error => {
                console.error('[UPLOAD] Cover upload error:', error);
                alert('Error uploading cover. Please try again.');
            })
            .finally(() => {
                if (hero) {
                    hero.dataset.uploading = 'false';
                }
                coverUpload.value = '';
            });
        });
    }

    // ==========================================
    // 3. AVATAR UPLOAD HANDLER
    // ==========================================
    if (artUpload) {
        artUpload.addEventListener('change', function(e) {
            const file = this.files[0];
            if (!file) return;

            const formData = new FormData();
            formData.append('action', 'cs_upload_avatar');
            formData.append('file', file);
            formData.append('nonce', window.csUploadConfig?.nonce || '');

            fetch(window.csUploadConfig?.ajax_url || window.ajaxurl, {
                method: 'POST',
                credentials: 'same-origin',
                body: formData
            })
            .then(response => response.json())
            .then(data => {
                if (data.success && data.data?.url) {
                    const avatarUrl = data.data.url;
                    
                    // 🔥 UPDATE HERO ENGINE
                    window.dispatchEvent(new CustomEvent('cs:hero:state-changed', {
                        detail: {
                            avatar: {
                                src: avatarUrl,
                                position: 'center'
                            }
                        }
                    }));

                    // Update DOM directly
                    const avatarImg = document.querySelector('[data-cs-avatar]');
                    if (avatarImg) {
                        avatarImg.src = avatarUrl;
                    }

                    // Update hero state
                    if (window.CSHeroState) {
                        window.CSHeroState.state.avatarSrc = avatarUrl;
                        window.CSHeroState.persist();
                    }

                    console.log('[UPLOAD] Avatar updated:', avatarUrl);
                } else {
                    console.error('[UPLOAD] Avatar upload failed:', data);
                    alert('Avatar upload failed. Please try again.');
                }
            })
            .catch(error => {
                console.error('[UPLOAD] Avatar upload error:', error);
                alert('Error uploading avatar. Please try again.');
            })
            .finally(() => {
                artUpload.value = '';
            });
        });
    }

    // ==========================================
    // 4. RESET COVER
    // ==========================================
    if (resetCoverBtn) {
        resetCoverBtn.addEventListener('click', function() {
            const defaultCover = window.csHero?.defaultCover || '';
            
            if (!defaultCover) {
                alert('No default cover configured.');
                return;
            }

            // 🔥 UPDATE HERO ENGINE
            window.dispatchEvent(new CustomEvent('cs:hero:state-changed', {
                detail: {
                    cover: {
                        src: defaultCover,
                        x: 50,
                        y: 50,
                        scale: 1,
                        mode: 'cover'
                    }
                }
            }));

            // Update DOM
            const coverImg = document.querySelector('[data-cs-cover]');
            if (coverImg) {
                coverImg.src = defaultCover;
            }

            // Update state
            if (window.CSHeroState) {
                window.CSHeroState.state.coverSrc = defaultCover;
                window.CSHeroState.state.coverX = 50;
                window.CSHeroState.state.coverY = 50;
                window.CSHeroState.state.coverScale = 1;
                window.CSHeroState.persist();
                
                if (window.CSHeroState.calibrateCover) {
                    const heroEl = document.querySelector('[data-cs-hero]');
                    const coverEl = document.querySelector('[data-cs-cover]');
                    window.CSHeroState.calibrateCover(heroEl, coverEl, window.CSHeroState.state);
                    window.CSHeroState.enforceStrictBoundaries();
                    window.CSHeroState.applyCalibratedTransform();
                }
            }

            console.log('[UPLOAD] Cover reset to default');
        });
    }

    // ==========================================
    // 5. DELETE COVER
    // ==========================================
    if (deleteCoverBtn) {
        deleteCoverBtn.addEventListener('click', function() {
            if (!confirm('Delete your cover image?')) return;

            // 🔥 UPDATE HERO ENGINE - Remove cover
            window.dispatchEvent(new CustomEvent('cs:hero:state-changed', {
                detail: {
                    cover: {
                        src: '',
                        x: 50,
                        y: 50,
                        scale: 1,
                        mode: 'cover'
                    }
                }
            }));

            // Update DOM - remove cover
            const coverImg = document.querySelector('[data-cs-cover]');
            if (coverImg) {
                coverImg.src = '';
                coverImg.style.display = 'none';
            }

            // Update state
            if (window.CSHeroState) {
                window.CSHeroState.state.coverSrc = '';
                window.CSHeroState.persist();
            }

            console.log('[UPLOAD] Cover deleted');
        });
    }

    // ==========================================
    // 6. TRACK UPLOAD HANDLER
    // ==========================================
    if (trackUpload) {
        trackUpload.addEventListener('change', function(e) {
            const file = this.files[0];
            if (!file) return;

            const formData = new FormData();
            formData.append('action', 'cs_upload_track');
            formData.append('file', file);
            formData.append('nonce', window.csUploadConfig?.nonce || '');

            // Show loading
            const uploadBtn = document.querySelector('.upload-btn');
            if (uploadBtn) {
                uploadBtn.textContent = 'Uploading...';
                uploadBtn.disabled = true;
            }

            fetch(window.csUploadConfig?.ajax_url || window.ajaxurl, {
                method: 'POST',
                credentials: 'same-origin',
                body: formData
            })
            .then(response => response.json())
            .then(data => {
                if (data.success && data.data?.url) {
                    console.log('[UPLOAD] Track uploaded:', data.data.url);
                    
                    // Reload page to show new track
                    // Or you could dynamically add it to the list
                    alert('Track uploaded successfully! Refresh to see it.');
                    location.reload();
                } else {
                    console.error('[UPLOAD] Track upload failed:', data);
                    alert('Track upload failed. Please try again.');
                }
            })
            .catch(error => {
                console.error('[UPLOAD] Track upload error:', error);
                alert('Error uploading track. Please try again.');
            })
            .finally(() => {
                if (uploadBtn) {
                    uploadBtn.textContent = '+ Track';
                    uploadBtn.disabled = false;
                }
                trackUpload.value = '';
            });
        });
    }
});
</script>