[data-popper-arrow],
[data-popper-arrow]:before,
[data-popper-arrow]:after {
    border-color: #52525b !important;
}

#nowPlayingImage.track-image-container {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

#nowPlayingImage .track-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
    z-index: 10;
    border-radius: 0.5rem;
    pointer-events: none;
}

#nowPlayingImage:hover .track-image-overlay {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.track-image-play-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.track-image-play-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.track-image-play-btn:active {
    transform: scale(0.95);
}

.track-image-play-btn svg {
    width: 28px;
    height: 28px;
    margin-left: 2px;
}

.track-image-play-btn.playing svg {
    margin-left: 0;
}

/* Karaoke Mode Styles - Optimized for Dashboard */
#lyricsContent {
    scrollbar-width: thin;
    scrollbar-color: rgb(63 63 70 / 0.6) transparent;
}

#lyricsContent::-webkit-scrollbar {
    width: 6px;
}

#lyricsContent::-webkit-scrollbar-track {
    background: transparent;
}

#lyricsContent::-webkit-scrollbar-thumb {
    background: rgb(63 63 70 / 0.6);
    border-radius: 3px;
}

#lyricsContent::-webkit-scrollbar-thumb:hover {
    background: rgb(63 63 70 / 0.8);
}

#lyricsContent.karaoke-mode {
    scroll-behavior: smooth;
}

.lyrics-line {
    display: block;
    margin: 2px 0;
    padding: 8px 12px;
    border-radius: 6px;
    line-height: 1.5;
    position: relative;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    color: #a1a1aa;
    cursor: pointer;
}

.lyrics-line:hover {
    background: rgba(63, 63, 70, 0.3);
}

.lyrics-line.active {
    background: linear-gradient(135deg, rgb(79 70 229 / 29%), rgb(33 33 36));
    color: #ffffff;
    font-weight: 500;
    transform: translateX(2px);
}

.lyrics-line.empty-line {
    display: none;
}

#karaokeToggleBtn.active {
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.8),
        rgba(236, 72, 153, 0.8)
    );
    color: #ffffff;
}

#karaokeToggleBtn.active:hover {
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.9),
        rgba(236, 72, 153, 0.9)
    );
}

#lyricsContent.karaoke-mode #karaokeToggleBtn{
    background: #4f46e5;
    color: white;
}

@media (min-width: 1024px) {
    html,
    body {
        height: 100vh;
        overflow: hidden;
    }

}

@media (max-width: 1023px) {
    html,
    body {
        height: 100vh;
        overflow: hidden;
    }
}

#header {
    position: relative !important;
    z-index: 999999 !important;
    background: rgb(35 35 38) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(75, 85, 99, 0.5);
    padding: 12px 20px;
}

/* Ensure user menu dropdown appears above all dashboard content */
#userMenu {
    z-index: 9999999 !important;
    position: absolute !important;
}

/* Force user menu container to have proper stacking context */
#header .relative {
    z-index: 999999 !important;
}

/* Ensure mobile menu appears above header */
#mobileMenu {
    z-index: 9999999 !important;
}

main {
    padding-top: 0 !important;
}

@media (min-width: 1024px) {
    main {
        padding-top: 0 !important;
        height: calc(100vh - 72px);
        overflow: hidden;
    }
}

@media (max-width: 1023px) {
    main {
        height: calc(100vh - 72px);
        overflow: hidden;
    }
}

footer {
    display: none !important;
}

@media (min-width: 1024px) {
    body.player-active #mainGrid {
        height: calc(100% - 80px);
    }

    body.player-active main {
        height: calc(100vh - 72px - 80px);
    }
}

.track-item.active-track {
    background: rgb(93 93 99 / 24%) !important;
    border-color: rgb(30 30 32) !important;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 10%);
}

.track-item.active-track:hover {
    background: rgb(93 93 99 / 24%) !important;
}

.track-item.active-track
    .track-image-container
    > div[class*="absolute inset-0"] {
    opacity: 1 !important;
}

form {
    margin: 0;
}

.track-item.active-track .track-image-container .play-button {
    opacity: 1;
    pointer-events: all;
}

#creationFormCol .flex-1.overflow-y-auto::-webkit-scrollbar,
#lyricsCol::-webkit-scrollbar,
#tracksContainer::-webkit-scrollbar {
    width: 6px;
}

#creationFormCol .flex-1.overflow-y-auto::-webkit-scrollbar-track,
#lyricsCol::-webkit-scrollbar-track,
#tracksContainer::-webkit-scrollbar-track {
    background: transparent;
}

#creationFormCol .flex-1.overflow-y-auto::-webkit-scrollbar-thumb,
#lyricsCol::-webkit-scrollbar-thumb,
#tracksContainer::-webkit-scrollbar-thumb {
    background: rgb(63 63 70 / 0.6);
    border-radius: 3px;
}

#creationFormCol .flex-1.overflow-y-auto::-webkit-scrollbar-thumb:hover,
#lyricsCol::-webkit-scrollbar-thumb:hover,
#tracksContainer::-webkit-scrollbar-thumb:hover {
    background: rgb(63 63 70 / 0.8);
}

#creationFormCol .flex-1.overflow-y-auto,
#lyricsCol,
#tracksContainer {
    scrollbar-width: thin;
    scrollbar-color: rgb(63 63 70 / 0.6) transparent;
}

/* Optimize scrolling performance */
#creationFormCol .flex-1.overflow-y-auto {
    will-change: scroll-position;
    contain: layout style paint;
    transform: translateZ(0);
}

/* Ensure modals are hidden initially to prevent FOUC */
#lyricsGeneratorModal.hidden {
    display: none !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%,
    100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
    }
}

#lyricsCol .animate-fade-in {
    animation: fadeInUp 0.6s ease-out;
}

#lyricsCol #nowPlayingImage.has-content {
    animation: pulseGlow 3s ease-in-out infinite;
}

#lyricsContent.has-lyrics {
    border: 1px solid rgb(63 63 70 / 0.5);
}

@media (min-width: 1024px) {
    #lyricsContent {
        min-height: 200px;
    }
}

#dashboardPlayerContainer {
    position: sticky;
    top: 10px;
    z-index: 10;
    margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
    #dashboardPlayerContainer + div {
        margin-top: 0;
    }

    #lyricsContent {
        margin-top: 1rem;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#trackStatusBadge:not(.hidden) {
    animation: slideInRight 0.4s ease-out;
}

@media (min-width: 1024px) {
    #stickyPlayer.dashboard-mode {
        position: static !important;
        transform: none !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        z-index: auto !important;
        margin-bottom: 1.5rem;
    }

    #stickyPlayer.dashboard-mode.hidden {
        display: none !important;
    }

    #stickyPlayer.dashboard-mode #playerContent {
        background: rgb(39 39 42 / 0.7) !important;
        backdrop-filter: blur(16px);
        border: 1px solid rgb(63 63 70 / 0.5);
        border-radius: 1rem;
        position: relative;
        overflow: hidden;
    }

    #stickyPlayer.dashboard-mode #playerContent::before {
        content: "";
        position: absolute;
        inset: 0;
        opacity: 0.05;
        background: linear-gradient(
            135deg,
            rgba(99, 102, 241, 0.1) 0%,
            transparent 50%,
            rgba(236, 72, 153, 0.1) 100%
        );
        pointer-events: none;
        z-index: 0;
    }

    #stickyPlayer.dashboard-mode #playerContent > * {
        position: relative;
        z-index: 1;
    }

    #stickyPlayer.dashboard-mode #playerToggleBtn {
        display: none !important;
    }

    #stickyPlayer.dashboard-mode .md\:hidden {
        display: none !important;
    }

    #stickyPlayer.dashboard-mode .hidden.md\:flex {
        display: flex !important;
    }

    #stickyPlayer.dashboard-mode .flex.items-center.gap-4.flex-1.min-w-0 {
        display: none !important;
    }

    #stickyPlayer.dashboard-mode #playerCloseBtn {
        display: none !important;
    }

    #stickyPlayer.dashboard-mode .container.mx-auto.hidden.md\\:flex {
        justify-content: center !important;
        gap: 2rem !important;
    }

    #stickyPlayer.dashboard-mode ~ #expandPlayerBtn {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    #dashboardPlayerContainer ~ #expandPlayerBtn,
    #dashboardPlayerContainer + * #expandPlayerBtn {
        display: none !important;
    }
}

#stickyPlayer.hidden {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    overflow: hidden !important;
}

#stickyPlayer.minimized {
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

#playerHideIcon.hidden,
.player-hide-icon.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

@media (max-width: 1023px) {
    #stickyPlayer.dashboard-mode {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 50 !important;
    }

    #stickyPlayer.hidden,
    #stickyPlayer.minimized,
    #stickyPlayer.dashboard-mode.hidden,
    #stickyPlayer.dashboard-mode.minimized {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* Mobile Tab Navigation */
#mobileTabNav {
    background: rgba(39, 39, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgb(63 63 70);
}

.mobile-tab {
    position: relative;
    transition: all 0.2s ease;
    padding: 12px;
    font-size: 0.8rem;
}

.mobile-tab:hover {
    background-color: rgba(63, 63, 70, 0.3);
}

.mobile-tab.active {
    color: #ffffff;
    border-bottom-color: rgb(79 70 229);
    background-color: rgb(79 70 229 / 28%);
}

/* Mobile Tab Content */
@media (max-width: 1023px) {
    .mobile-tab-content {
        display: none !important;
    }

    .mobile-tab-content.active {
        display: flex !important;
    }

    #mainGrid {
        grid-template-columns: 1fr;
    }

    #creationFormCol,
    #lyricsCol,
    #sidebarCol {
        width: 100%;
        position: static;
        max-width: 100vw;
        border: none;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
    }

    #sidebarCol {
        background: rgb(39 39 42);
        display: flex;
        flex-direction: column;
    }

    #tracksContainer {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: auto;
        flex: 1;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
    }
}

@media (min-width: 1024px) {
    #mobileTabNav {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    #lyricsCol {
        padding: 0 !important;
        width: 100%;
        overflow: hidden;
    }

    #lyricsCol > div {
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        padding: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    #creationFormCol {
        padding: 0;
        overflow: hidden;
    }

    #creationFormCol .flex-1.overflow-y-auto {
        overflow-y: auto;
        overflow-x: hidden;
        padding: 1.5rem;
        max-width: 100vw;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
    }

    /* Fixed button at bottom for mobile */
    #creationFormCol > div.py-5 {
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        z-index: 10;
    }

    /* Lyrics column now playing section - mobile responsive */
    #lyricsCol .mb-8 {
        margin-bottom: 1.5rem !important;
    }

    #lyricsCol .flex.space-x-6,
    #lyricsCol .mb-8 .flex.space-x-6,
    #lyricsCol .mb-8 > .flex.space-x-6,
    #lyricsCol > div > .mb-8 .flex.space-x-6 {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1.5rem !important;
        text-align: center !important;
        padding: 0 !important;
    }

    /* Remove horizontal spacing when stacking vertically */
    #lyricsCol .flex.space-x-6 > *,
    #lyricsCol .mb-8 .flex.space-x-6 > * {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Ensure the relative wrapper doesn't affect layout */
    #lyricsCol .flex.space-x-6 > .relative {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    #lyricsCol #nowPlayingImage {
        width: 180px !important;
        height: 180px !important;
        flex-shrink: 0 !important;
        margin: 0 auto !important;
    }

    #lyricsCol .flex-1.min-w-0,
    #lyricsCol .space-y-3.flex-1.min-w-0,
    #lyricsCol .flex.space-x-6 .flex-1.min-w-0 {
        width: 100% !important;
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        margin-left: 0 !important;
    }

    #lyricsCol .flex-1.min-w-0 > div {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    #lyricsCol .flex.items-start.justify-between,
    #lyricsCol .mb-2.flex.items-start.justify-between {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1rem !important;
        width: 100% !important;
    }

    #lyricsCol h3 {
        text-align: center !important;
        font-size: 1.5rem !important;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    #lyricsCol #nowPlayingStyle {
        text-align: center !important;
        justify-content: center !important;
    }

    #lyricsCol #nowPlayingStyle span {
        font-size: 0.75rem;
        line-height: 1rem;
    }

    #trackMetaInfo {
        margin-top: 0.5rem !important;
        padding-top: 0.5rem;
        justify-content: center !important;
    }

    #trackMetaInfo span {
        font-size: 11px;
        line-height: 1rem;
    }

    #lyricsCol p {
        text-align: center !important;
    }

    /* Action buttons - center them on mobile */
    #lyricsCol .flex.flex-col.items-center,
    #lyricsCol .ml-3.flex-shrink-0 .flex.flex-col {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 1rem !important;
        margin-left: 0 !important;
    }

    #lyricsCol .flex.flex-col.items-center > div,
    #lyricsCol .ml-3.flex-shrink-0 .flex.flex-col > div {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.75rem !important;
    }

    /* Override any ml-3 margin on mobile */
    #lyricsCol .ml-3,
    #lyricsCol .ml-3.flex-shrink-0 {
        margin-left: 0 !important;
    }

    /* Ensure flex-shrink-0 doesn't prevent layout changes */
    #lyricsCol .flex-shrink-0 {
        flex-shrink: 1 !important;
    }

    #lyricsContent {
        min-height: 350px !important;
        margin-top: 2rem;
    }

    #copyLyricsBtn {
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.375rem !important;
        white-space: nowrap !important;
    }

    #copyLyricsBtn span {
        display: inline !important;
    }
}

/* Medium tablets */
@media (min-width: 641px) and (max-width: 1023px) {
    #lyricsCol #nowPlayingImage {
        width: 200px !important;
        height: 200px !important;
    }

    #lyricsCol h3 {
        font-size: 1.75rem !important;
    }

    #lyricsCol #nowPlayingStyle span {
        font-size: 0.8rem !important;
    }

    #trackMetaInfo span {
        font-size: 12px !important;
    }
}

/* Small phones */
@media (max-width: 640px) {
    #lyricsCol {
        padding: 0.75rem !important;
    }

    #lyricsCol #nowPlayingImage {
        width: 150px !important;
        height: 150px !important;
    }

    #lyricsCol h3 {
        font-size: 1.25rem !important;
    }

    #lyricsContent {
        padding: 1rem !important;
        min-height: 300px !important;
        font-size: 0.875rem;
    }

    #lyricsCol .mb-8 {
        margin-bottom: 1.25rem !important;
    }

    #trackMetaInfo span {
        font-size: 10px !important;
    }

    #lyricsCol #nowPlayingStyle span {
        font-size: 0.7rem !important;
    }
}
