/* Simple Karaoke App with Emoji Icons and Enhanced Auto-scroll */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

.karaoke-app {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 20px 0 20px;
    box-sizing: border-box;
    font-family: 'Segoe UI Emoji','Segoe UI Symbol','Apple Color Emoji','Noto Color Emoji','Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    color: #ffffff;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 10px;
    position: relative;
}

/* Karaoke Top - Container for lyrics and drawer */
.karaoke-top {
    position: relative;
    width: 100%;
    display: block;
}

/* Lyrics Pane - Full Width */
.karaoke-lyrics-pane {
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Library Pane - Overlay Drawer (Right side) */
.karaoke-library-pane {
    position: fixed !important;
    top: 10px;
    right: 20px;
    width: 480px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    z-index: 1000;
    background: rgba(26, 26, 46, 0.50) !important;
    border: 2px solid rgba(139, 92, 246, 0.3) !important;
    border-radius: 16px !important;
    padding: 16px !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(139, 92, 246, 0.2) !important;
    backdrop-filter: blur(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    
    /* GPU acceleration for smooth transitions */
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    
    /* Default to visible (will be hidden by Blazor class binding when song is selected) */
    opacity: 1;
    transform: translateX(0) translateZ(0);
    pointer-events: auto;
    visibility: visible;
}

.karaoke-library-pane.visible {
    opacity: 1;
    transform: translateX(0) translateZ(0);
    pointer-events: auto;
    visibility: visible;
}

.karaoke-library-pane.hidden {
    opacity: 0;
    transform: translateX(20px) translateZ(0);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0.15s;
}

/* Queue Pane - Overlay Drawer (SAME location as Library - Right side) */
.karaoke-queue-pane {
    position: fixed !important;
    top: 10px;
    right: 20px; /* Same position as library drawer */
    width: 480px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    z-index: 1001; /* Higher z-index so it appears above library when both are visible */
    background: rgba(26, 26, 46, 0.50) !important;
    border: 2px solid rgba(6, 214, 160, 0.3) !important; /* Changed from red to teal */
    border-radius: 16px !important;
    padding: 16px !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(6, 214, 160, 0.2) !important; /* Changed from red to teal */
    backdrop-filter: blur(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    
    /* GPU acceleration for smooth transitions */
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    
    /* Start in hidden state */
    opacity: 0;
    transform: translateX(20px) translateZ(0);
    pointer-events: none;
    visibility: hidden;
}

.karaoke-queue-pane.visible {
    opacity: 1;
    transform: translateX(0) translateZ(0);
    pointer-events: auto;
    visibility: visible;
}

.karaoke-queue-pane.hidden {
    opacity: 0;
    transform: translateX(20px) translateZ(0);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0.15s;
}

/* Enhanced Modern Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: opacity 0.15s ease; /* Reduced from 0.2s */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.btn:hover {
    opacity: 0.9;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.primary {
    background: #8b5cf6;
    color: #fff;
}

.btn.primary:hover:not(:disabled) {
    background: #7c3aed;
}

.btn.secondary {
    background: #6b7280;
    color: white;
}

.btn.secondary:hover:not(:disabled) {
    background: #4b5563;
}

/* Karaoke Toggle Button */
.karaoke-toggle {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(75, 85, 99, 0.2);
}

.karaoke-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(75, 85, 99, 0.3);
}

.karaoke-toggle.active {
    background: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
    border-color: rgba(236, 72, 153, 0.3);
    box-shadow: 0 3px 12px rgba(236, 72, 153, 0.4);
}

/* Queue Toggle Button - Changed to teal/cyan */
.queue-toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #06d6a0 0%, #059669 100%); /* Changed from red to teal */
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(6, 214, 160, 0.3); /* Changed from red to teal */
}

.queue-toggle-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%); /* Changed from red to darker teal */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 214, 160, 0.5); /* Changed from red to teal */
}

.queue-toggle-btn.active {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%); /* Changed from red to dark teal */
}

.queue-close-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #06d6a0 0%, #059669 100%); /* Changed from red to teal */
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(6, 214, 160, 0.3); /* Changed from red to teal */
}

.queue-close-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%); /* Changed from red to darker teal */
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 214, 160, 0.5); /* Changed from red to teal */
}

.queue-close-btn:active {
    transform: translateY(0);
}

.queue-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(6, 214, 160, 0.3); /* Changed from red to teal */
}

.queue-title {
    margin: 0;
    color: #06d6a0; /* Changed from red to teal */
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.queue-title-text {
    margin: 0;
    color: #06d6a0; /* Teal color */
    font-size: 0.85em; /* Smaller font size */
    font-weight: 500;
    text-align: left;
}

/* Category Buttons */
.category-btn {
    padding: 5px 11px;
    margin: 2px;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
    color: #8b5cf6;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    position: relative;
}

.category-btn:hover,
.category-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.4);
    border-color: transparent;
}

/* Drawer Toggle - Inline Version */
.drawer-toggle-inline {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #8b5cf6;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.drawer-toggle-inline:hover {
    background: #7c3aed;
}

.drawer-toggle-inline.active {
    background: #ef4444;
}

/* Scroll Buttons for Library Drawer */
.scroll-btn {
    padding: 4px 8px;
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: #ffffff !important;
    border-radius: 6px;
    cursor: pointer !important;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    line-height: 1;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

.scroll-btn:hover {
    background: rgba(139, 92, 246, 0.6);
    border-color: #8b5cf6;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.5);
}

.scroll-btn:active {
    transform: translateY(0);
    background: rgba(139, 92, 246, 0.8);
}

/* Queue Section */
.queue-section {
    width: 100%;
    max-width: 100%;
}

.queue-header h4 {
    margin: 0;
    color: #8b5cf6;
    font-size: 1em;
}

.queue-list {
    max-height: 60vh; /* Increased from 50vh to show more songs */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Increase song list height for more visibility */
.files-pane {
    max-height: 70vh !important; /* Increased from 60vh to show even more songs */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* Improved scrolling for remote controls */
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Ensure proper scrolling behavior */
.files-pane:focus {
    outline: 2px solid rgba(139, 92, 246, 0.5);
    outline-offset: 2px;
}

/* Scrollbar styling for queue list */
.queue-list::-webkit-scrollbar {
    width: 6px;
}

.queue-list::-webkit-scrollbar-track {
    background: rgba(15, 15, 35, 0.5);
    border-radius: 6px;
}

.queue-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 10px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7c3aed 0%, #5a56e0 100%);
}

.btn-clear-queue {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); /* Keep red for destructive action */
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-clear-queue:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

.btn-reshuffle-queue {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-reshuffle-queue:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #5a56e0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

.btn-reshuffle-queue:active {
    transform: translateY(0);
}

.queue-item-compact:hover {
    background: rgba(139, 92, 246, 0.1) !important;
    border-color: rgba(139, 92, 246, 0.4) !important;
}

.queue-item-compact button:hover {
    background: rgba(139, 92, 246, 0.4) !important;
}

.queue-item-compact button:last-child:hover {
    background: rgba(239, 68, 68, 0.4) !important;
    color: #ffffff;
}

/* Search Section */
.search-section {
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 12px;
    position: relative;
    z-index: 100;
}

.search-container {
    position: relative;
    margin-bottom: 12px;
    z-index: 100;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.large-search-input {
    width: 100%;
    padding: 12px 60px 12px 12px;
    border: 2px solid rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    background: rgba(15, 15, 35, 0.9);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
    position: relative;
}

.large-search-input:focus {
    border-color: #8b5cf6;
    background: rgba(15, 15, 35, 1);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.large-search-input::placeholder {
    color: #6b7280;
    font-style: italic;
    font-size: 13px;
}

.search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(139, 92, 246, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Search Suggestions - Optimized */
.search-suggestions {
    position: absolute !important;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999 !important;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%) !important;
    border: 2px solid #8b5cf6;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: -2px;
    box-shadow: 0 12px 36px rgba(139, 92, 246, 0.4), 0 5px 15px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.search-suggestions .suggestion-item { 
    padding: 10px 12px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease; /* Simplified from cubic-bezier, reduced from 0.3s */
    background: linear-gradient(90deg, transparent 0%, rgba(139, 92, 246, 0.05) 100%);
    position: relative;
}

.search-suggestions .suggestion-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 50%, #06d6a0 100%);
    transform: scaleY(0);
    transition: transform 0.2s ease; /* Simplified transition */
}

.search-suggestions .suggestion-item:hover { 
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15) 0%, rgba(99, 102, 241, 0.2) 100%) !important;
    transform: translateX(2px); /* Reduced from 4px */
    padding-left: 14px; /* Reduced from 16px */
    box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.2), 0 2px 8px rgba(139, 92, 246, 0.3);
}

.search-suggestions .suggestion-item:hover::before {
    transform: scaleY(1);
}

.search-suggestions .suggestion-item:last-child {
    border-bottom: none;
    border-radius: 0 0 10px 10px;
}

.suggestion-content {
    flex: 1;
    cursor: pointer;
    width: 100%;
}

.song-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.song-artist {
    font-size: 12px;
    color: #06d6a0;
    display: inline;
    font-weight: 500;
}

.song-artist::after {
    content: ' - ';
    color: #6b7280;
    margin: 0 4px;
}

.song-category {
    font-size: 10px;
    color: #8b5cf6;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    background: rgba(139, 92, 246, 0.15);
    padding: 3px 8px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 4px;
}

.queue-actions {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    align-items: center;
}

.queue-actions button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.queue-actions button:hover {
    transform: translateY(-1px);
}

/* Scrollbar styling for search suggestions */
.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: rgba(15, 15, 35, 0.5);
    border-radius: 0 0 12px 0;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 10px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7c3aed 0%, #5a56e0 100%);
}

/* Scrollbar styling for folder pane (categories) */
.folder-pane::-webkit-scrollbar {
    width: 6px;
}

.folder-pane::-webkit-scrollbar-track {
    background: rgba(15, 15, 35, 0.5);
    border-radius: 6px;
}

.folder-pane::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 10px;
}

.folder-pane::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7c3aed 0%, #5a56e0 100%);
}

/* Scrollbar styling for files pane (song list) */
.files-pane::-webkit-scrollbar {
    width: 6px;
}

.files-pane::-webkit-scrollbar-track {
    background: rgba(15, 15, 35, 0.5);
    border-radius: 6px;
}

.files-pane::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 10px;
}

.files-pane::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7c3aed 0%, #5a56e0 100%);
}

/* Audio Player Section */
.audio-player-section {
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
}

.audio-player-section.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #8b5cf6 50%, 
        transparent 100%);
    animation: loading-bar 1.5s ease-in-out infinite;
}

@keyframes loading-bar {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.audio-element {
    width: 100%;
    max-width: 450px;
    background: rgba(15, 15, 35, 0.8);
    border-radius: 8px;
    padding: 8px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Lyrics Section */
.lyrics-section {
    width: 100%;
}

/* Real-time Synchronized Lyrics - Optimized for Performance */
.lyric-line {
    padding: 12px 18px;
    margin-bottom: 8px;
    margin-left: auto;
    margin-right: auto;
    max-width: 85%;
    border-radius: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease; /* Reduced from 0.3s to 0.2s */
    opacity: 0.6;
    cursor: pointer;
    color: #d1d5db;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    /* Performance optimizations */
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
}

.lyric-line:hover {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px); /* Reduced from 8px for smoother animation */
    border-color: rgba(139, 92, 246, 0.3);
}

.lyric-line.active {
    opacity: 1;
    background: rgba(139, 92, 246, 0.4);
    border: 3px solid rgba(139, 92, 246, 1);
    color: #ffffff;
    font-weight: 800;
    transform: scale(1.05); /* Reduced from 1.08 to 1.05 for better performance */
    max-width: 88%;
}

.lyric-line.upcoming {
    opacity: 0.85;
    background: rgba(139, 92, 246, 0.2);
    border: 2px solid rgba(139, 92, 246, 0.5);
    color: #e5e7eb;
    transform: scale(1.02); /* Reduced from 1.03 to 1.02 */
    max-width: 86%;
}

.lyric-content {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.lyric-text {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
    width: 100%;
    /* Performance optimization */
    text-rendering: optimizeSpeed; /* Changed from optimizeLegibility for better performance */
}

.lyric-line.active .lyric-text {
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.3px;
}

.lyrics-container.playing .lyric-line.active .lyric-text {
    font-size: 26px;
    font-weight: 900;
}

/* Progress bar - Optimized */
.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(139, 92, 246, 0.25);
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #8b5cf6;
    border-radius: 0 0 6px 6px;
    transition: width 0.05s linear; /* Reduced from 0.1s for smoother updates */
    /* Performance optimization */
    will-change: width;
    transform: translateZ(0); /* Force GPU acceleration */
}

/* Lyrics Container - Optimized */
.lyrics-container-wrapper {
    display: block;
    width: 100%;
}

.lyrics-container {
    max-height: 450px; /* Decreased from 500px */
    width: 100%;
    overflow-y: auto;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 20px;
    scroll-behavior: smooth;
    position: relative;
    text-align: center;
    /* Performance optimizations */
    transform: translateZ(0); /* Force GPU acceleration */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
    opacity: 0; /* Start hidden - will show when content is added */
    transition: opacity 0.3s ease-in;
    min-height: 200px; /* Prevent layout shift during loading */
}

/* Show container only when it has lyric-line children (content rendered) */
.lyrics-container:has(.lyric-line) {
    opacity: 1;
}

/* Show plain text lyrics containers immediately */
.lyrics-container.plain-text-lyrics {
    opacity: 1 !important;
    overflow-y: scroll !important; /* Always show scrollbar */
    overflow-x: hidden !important; /* Prevent horizontal scroll */
    max-height: 450px !important; /* Force max-height */
    min-height: 300px !important; /* Ensure minimum height */
    height: 450px !important; /* Set fixed height to enable scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on touch devices */
    scroll-behavior: smooth !important;
    overscroll-behavior: contain !important;
    white-space: pre-wrap !important; /* Preserve formatting */
    font-size: 20px !important;
    line-height: 1.6 !important;
    cursor: default !important;
    display: block !important; /* Ensure block display */
    box-sizing: border-box !important;
    position: relative !important;
    pointer-events: auto !important; /* CRITICAL: Enable mouse events */
}

/* Add visible scrollbar for plain text lyrics for remote control */
.lyrics-container.plain-text-lyrics::-webkit-scrollbar {
    width: 12px !important; /* Make scrollbar even wider for better visibility */
    display: block !important;
}

.lyrics-container.plain-text-lyrics::-webkit-scrollbar-track {
    background: rgba(15, 15, 35, 0.9) !important;
    border-radius: 6px !important;
    border: 1px solid rgba(139, 92, 246, 0.3) !important;
}

.lyrics-container.plain-text-lyrics::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%) !important;
    border-radius: 10px !important;
    border: 2px solid rgba(15, 15, 35, 0.5) !important;
    min-height: 40px !important; /* Ensure thumb is grabbable */
}

.lyrics-container.plain-text-lyrics::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #a78bfa 0%, #818cf8 100%) !important;
    border-color: rgba(15, 15, 35, 0.3) !important;
}

.lyrics-container.plain-text-lyrics::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #7c3aed 0%, #5a56e0 100%) !important;
}

/* Make plain text lyrics focusable for keyboard/remote control */
.lyrics-container.plain-text-lyrics:focus {
    outline: 2px solid rgba(139, 92, 246, 0.5) !important;
    outline-offset: 2px !important;
}

.plain-text-lyrics::before,
.plain-text-lyrics::after {
    display: none !important;
    content: none !important;
}

/* Hide when explicitly loading */
.lyrics-container.loading {
    opacity: 0;
    pointer-events: none; /* Prevent interaction while loading */
}

/* Loading state indicator - show spinner when loading OR when empty */
/* BUT NOT for plain text lyrics */
.lyrics-container.loading:not(.plain-text-lyrics)::before,
.lyrics-container:not(:has(.lyric-line)):not(.no-lyrics):not(.plain-text-lyrics)::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(139, 92, 246, 0.2);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 1;
    pointer-events: none;
}

.lyrics-container.loading:not(.plain-text-lyrics)::after,
.lyrics-container:not(:has(.lyric-line)):not(.no-lyrics):not(.plain-text-lyrics)::after {
    content: 'Loading lyrics...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 50px));
    color: #8b5cf6;
    font-size: 14px;
    font-weight: 600;
    opacity: 1;
    pointer-events: none;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.lyrics-container.playing {
    scroll-behavior: smooth;
    border-color: rgba(139, 92, 246, 0.6);
}

/* Status Banner - Optimized */
.status-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.2s ease-out; /* Reduced from 0.3s */
}

.status-banner.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-banner.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Emoji Icons via ::before */
.icon-microphone::before { content: "\1F3A4"; }
.icon-search::before { content: "\1F50E"; }
.icon-user::before { content: "\1F464"; }
.icon-folder::before { content: "\1F4C1"; }
.icon-file::before { content: "\1F4C4"; }
.icon-play::before { content: "\25B6"; }
.icon-pause::before { content: "\23F8"; }
.icon-stop::before { content: "\23F9"; }
.icon-music::before { content: "\1F3B5"; }
.icon-target::before { content: "\1F3AF"; }
.icon-close::before { content: "\2716"; }
.icon-rocket::before { content: "\1F680"; }
.icon-document::before { content: "\1F39C"; }
.icon-book::before { content: "\1F4D6"; }
.icon-list::before { content: "\1F5DE"; }
.icon-clock::before { content: "\23F0"; }
.icon-edit::before { content: "\270F"; }
.icon-plus::before { content: "\2795"; }
.icon-clipboard::before { content: "\1F4CB"; }
.icon-refresh::before { content: "\1F501"; }
.icon-check::before { content: "\2705"; }
.icon-warning::before { content: "\26A0"; }
.icon-scroll::before { content: "\1F9ED"; }
.icon-shuffle::before { content: "\1F500"; }
.icon-shuffle-all::before { content: "\1F503"; }

.icon-microphone, .icon-search, .icon-user, .icon-folder, .icon-file, 
.icon-play, .icon-pause, .icon-stop, .icon-music, .icon-target, .icon-close, .icon-rocket, 
.icon-document, .icon-book, .icon-list, .icon-clock, .icon-edit, 
.icon-plus, .icon-clipboard, .icon-refresh, .icon-check, .icon-warning,
.icon-scroll, .icon-shuffle, .icon-shuffle-all {
    display: inline-block;
    font-size: 1em;
    vertical-align: middle;
    line-height: 1;
}

/* Library Browser */
.library-browser { 
    position: relative; 
    z-index: 1; 
}

/* Performance optimization utility classes */
.audio-player-container {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
    width: 100%;
}

.audio-player-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 400px;
}

.audio-player-left > .drawer-toggle-inline {
    margin-left: auto;
}

.song-info-box {
    min-width: 0;
    flex: 0 0 220px;
}

.song-title-text {
    font-size: 0.95em;
    font-weight: 600;
    color: #8b5cf6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist-text {
    font-size: 0.8em;
    color: #06d6a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.karaoke-controls-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.synced-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.plain-text-badge {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 600;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(139, 92, 246, 0.3);
}

.library-title {
    margin: 0;
    color: #8b5cf6;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(15, 15, 35, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.queue-item.playing {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid #8b5cf6;
}

.queue-item-controls {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.queue-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(15, 15, 35, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.library-item:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.library-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.library-item-title {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-item-category {
    font-size: 10px;
    color: #8b5cf6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artist-name {
    color: #06d6a0;
}

.separator {
    color: #6b7280;
    margin: 0 6px;
}

.flex-center-gap {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
}

.load-more-container {
    text-align: center;
    padding: 12px;
}

/* Responsive Design */

/* Small desktop/laptop screens (1080p and below) */
@media (max-width: 1440px) {
    .karaoke-library-pane {
        width: 420px !important; /* Reduced width for smaller screens */
    }
    
    .karaoke-queue-pane {
        width: 420px !important; /* Match library width */
        display: block !important; /* Ensure it's visible */
    }
}

@media (max-width: 1200px) {
    .karaoke-library-pane {
        width: 380px !important;
    }
    
    .karaoke-queue-pane {
        width: 380px !important;
        display: block !important; /* Ensure it's visible */
    }
}

/* Tablets and small laptops - KEEP QUEUE VISIBLE */
@media (max-width: 992px) {
    .karaoke-library-pane {
        width: 360px !important;
    }
    
    .karaoke-queue-pane {
        width: 360px !important;
        display: block !important; /* Changed from display: none - now visible on tablets */
    }
}

/* Mobile devices - Hide queue drawer on mobile only */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: fixed;
    }
    
    .karaoke-app {
        padding: 5px;
        gap: 5px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .karaoke-library-pane {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        padding: 10px !important;
        margin: 0 !important;
        z-index: 2000 !important;
        overflow-y: auto;
        box-sizing: border-box;
    }
    
    .karaoke-queue-pane {
        display: none !important; /* Only hide on mobile (< 768px) */
    }
    
    .karaoke-top {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .karaoke-lyrics-pane {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 5px !important;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .lyrics-container-wrapper {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .lyrics-container {
        max-height: 60vh;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 10px;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .audio-player-section {
        margin-bottom: 5px;
        padding: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .audio-element {
        max-width: 100%;
        width: 100%;
    }
    
    .lyric-line {
        max-width: 90%;
        padding: 8px 12px;
    }
    
    .lyric-line.active {
        max-width: 95%;
    }
    
    .btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .files-pane {
        max-height: 55vh !important; /* Increased from 50vh for mobile */
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .karaoke-app {
        padding: 5px;
    }
    
    .large-search-input {
        font-size: 14px !important;
        padding: 12px 50px 12px 12px !important;
    }
    
    .files-pane {
        max-height: 50vh !important; /* Increased from 45vh for extra small screens */
    }
}

/* Drawer Close Button - Red styling */
.drawer-close-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.drawer-close-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

.drawer-close-btn:active {
    transform: translateY(0);
}