/* Premium Interaction Tray & Scale Flyout Styles */

#floating-tray {
    padding: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#floating-tray.tray-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(15px);
}



/* Base group glassmorphism */
#floating-tray > div {
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

/* Button states */
#floating-tray button {
    cursor: pointer;
    outline: none;
    position: relative;
    overflow: hidden;
}

#floating-tray button#mode-play.active {
    background: var(--accent-primary);
    color: var(--accent-contrast);
    box-shadow: 0 0 20px rgba(var(--accent-primary-rgb), 0.4);
}

#floating-tray button#mode-loop.active,
#floating-tray button#mode-nav.active {
    background: var(--accent-primary);
    color: var(--accent-contrast);
}

#floating-tray > .scale-selector-group {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* --- Frequency Scale Flyout --- */
.scale-selector-group {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scale-flyout {
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(15px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    gap: 6px;
    padding: 8px;
    background: rgba(10, 10, 15, 0.9) !important;
    backdrop-filter: blur(40px) !important;
    -webkit-backdrop-filter: blur(40px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 20px rgba(var(--accent-primary-rgb), 0.1);
    z-index: 1000;
}

/* Invisible bridge to prevent hover loss between button and flyout */
.scale-flyout::before {
    content: '';
    position: absolute;
    right: -25px;
    top: -20px;
    bottom: -20px;
    width: 40px;
    background: transparent;
    z-index: -1;
}

.scale-selector-group:hover .scale-flyout {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.btn-scale-option {
    padding: 0 12px;
    height: 32px;
    border-radius: 0.85rem;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-scale-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-scale-option.active {
    background: var(--accent-primary) !important;
    color: var(--accent-contrast) !important;
    border-color: transparent !important;
    box-shadow: 0 0 15px rgba(var(--accent-primary-rgb), 0.4);
}

/* --- Cursor Mode Flyout --- */
#floating-tray > .cursor-mode-group {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.cursor-mode-group {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cursor-flyout {
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(15px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 8px;
    background: rgba(10, 10, 15, 0.9) !important;
    backdrop-filter: blur(40px) !important;
    -webkit-backdrop-filter: blur(40px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 1000;
}

/* Bridge for cursor flyout */
.cursor-flyout::before {
    content: '';
    position: absolute;
    right: -25px;
    top: -20px;
    bottom: -20px;
    width: 40px;
}

.cursor-mode-group:hover .cursor-flyout {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.btn-cursor-option {
    width: 32px;
    height: 32px;
    border-radius: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-cursor-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-cursor-option.active {
    background: var(--accent-primary) !important;
    color: var(--accent-contrast) !important;
    border-color: transparent !important;
    box-shadow: 0 0 10px rgba(var(--accent-primary-rgb), 0.3);
}

/* Visual EQ Button active state */
#btn-visual-eq.active {
    background: var(--accent-primary) !important;
    color: var(--accent-contrast) !important;
}

/* --- YouTube Music Downloader UI --- */
.desktop-only {
    display: none !important;
}

body.is-desktop .desktop-only {
    display: block !important;
}

#yt-music-container {
    height: 42px;
    margin-top: 12px;
    position: relative;
    flex-shrink: 0;
    width: 100%;
}

#btn-yt-music {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: rgba(127, 29, 29, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    color: #f43f5e !important; /* text-rose-500 */
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    cursor: pointer;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    outline: none;
}

#yt-music-container:hover #btn-yt-music {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px) scale(0.98);
}

.yt-input-zone {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: translateY(5px) scale(0.98);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    background: rgba(5, 5, 8, 0.95);
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 0 12px;
    gap: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.15);
    box-sizing: border-box;
}

#yt-music-container:hover .yt-input-zone {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#input-yt-url {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: white !important;
    font-size: 9px !important;
    font-weight: 900 !important;
    width: 100% !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0 !important;
}

#input-yt-url::placeholder {
    color: rgba(244, 63, 94, 0.3) !important;
}

#yt-download-overlay {
    z-index: 20;
    background: rgba(0, 0, 0, 0.9) !important;
    backdrop-filter: blur(4px);
    border-radius: 10px;
}

/* --- Tab Reordering Drag & Drop --- */
.tab-btn.dragging {
    opacity: 0.2;
    background: rgba(var(--accent-primary-rgb), 0.1);
}

.tab-btn.drag-over {
    background: rgba(var(--accent-primary-rgb), 0.2);
    border-right: 4px solid var(--accent-primary) !important;
}

/* --- Floating Side Panels (Factorized) --- */
.floating-side-panel {
    position: fixed;
    top: 5rem;
    bottom: 5rem;
    width: 750px;
    z-index: 1500;
    transition: right 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.4s ease, 
                transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-side-panel.opacity-0 {
    opacity: 0;
    pointer-events: none;
    transform: translateX(30px);
}

/* --- DNA Selector Thumbnails --- */
.dna-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dna-thumb:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.dna-thumb.active {
    transform: scale(1.3);
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(var(--accent-primary-rgb), 0.5);
    z-index: 10;
}

.dna-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

#dna-selector.opacity-100 {
    opacity: 1 !important;
}
