/* ===== Overlay Styles ===== */
#fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - 80px);
    background: #000;
    z-index: 1500;
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow: hidden;
}
#fullscreen-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-bg-blur {
    position: absolute;
    top: -150px; left: -150px; right: -150px; bottom: -150px;
    background-size: 160% 200%;
    background-position: 50% 50%;
    filter: blur(25px) brightness(0.25);
    z-index: -1;
    transform: translateZ(0) scale(1.1);
    pointer-events: none;
    will-change: transform;
    contain: layout size;
}

/* ===== Side Panels ===== */
.overlay-queue-panel,
.overlay-lyrics-panel {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    transition: width 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.overlay-queue-panel {
    width: 310px;
    min-width: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.85) 0%, rgba(10,10,10,0.5) 100%);
    border-right: 1px solid rgba(255,255,255,0.06);
}
.overlay-lyrics-panel {
    width: 340px;
    min-width: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.85) 0%, rgba(10,10,10,0.5) 100%);
    border-left: 1px solid rgba(255,255,255,0.06);
}

/* Collapsed state */
.overlay-queue-panel.collapsed,
.overlay-lyrics-panel.collapsed {
    width: 0 !important;
    opacity: 0;
    padding: 0 !important;
    pointer-events: none;
    border: none;
}

/* Panel header — fixed, never scrolls */
.overlay-panel-header {
    flex-shrink: 0;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.overlay-panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}

/* ===== Lyrics Content ===== */
.overlay-lyrics-content {
    flex: 1;
    overflow-y: auto;
    color: #bbb;
    font-size: 0.92rem;
    line-height: 1.7;
    padding: 14px 18px 20px;
    white-space: normal;
    word-wrap: break-word;
}
.overlay-lyrics-content::-webkit-scrollbar { width: 5px; }
.overlay-lyrics-content::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
.overlay-lyrics-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }

/* ===== Queue List ===== */
.overlay-queue-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    padding: 8px 10px;
    list-style: none;
}
.overlay-queue-list::-webkit-scrollbar { width: 5px; }
.overlay-queue-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.04); }
.overlay-queue-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }

.overlay-queue-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 5px;
    background: rgba(255,255,255,0.02);
    cursor: grab;
    transition: background 0.2s;
    user-select: none;
}
.overlay-queue-item:active { cursor: grabbing; }
.overlay-queue-item:hover { background: rgba(255,255,255,0.07); }
.overlay-queue-item.dragging { opacity: 0.5; background: rgba(255,255,255,0.1); }
.overlay-queue-item.active-play {
    background: rgba(46, 204, 113, 0.1);
    border-left: 3px solid var(--icon-active);
    padding-left: 7px;
}

.queue-grip {
    color: #555;
    cursor: grab;
    padding-right: 10px;
    display: flex;
    align-items: center;
}
.queue-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.queue-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.overlay-queue-item.active-play .queue-title { color: var(--icon-active); }
.queue-artist {
    font-size: 0.68rem;
    color: #777;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Center Art Panel ===== */
.overlay-art-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 16px 14px;
    box-sizing: border-box;
    position: relative;
    min-width: 0;
}

.overlay-art-controls {
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 14px;
    z-index: 5;
}

.overlay-toggle {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--icon, #888);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.overlay-toggle:hover {
    background: rgba(255,255,255,0.15);
    color: var(--icon-hover, #fff);
}
.overlay-toggle.active {
    background: rgba(46,204,113,0.15);
    border-color: var(--icon-active);
    color: var(--icon-active);
}

/* Art image — fills as much space as possible */
.overlay-art {
    width: auto;
    height: auto;
    max-width: min(90%, 600px);
    max-height: calc(100% - 70px);
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    background: #111;
    transition: max-width 0.3s ease, max-height 0.3s ease;
}

/* Dynamic art sizing when panels collapse */
#fullscreen-overlay:has(.overlay-queue-panel.collapsed) .overlay-art,
#fullscreen-overlay:has(.overlay-lyrics-panel.collapsed) .overlay-art {
    max-width: min(90%, 750px);
}
#fullscreen-overlay:has(.overlay-queue-panel.collapsed):has(.overlay-lyrics-panel.collapsed) .overlay-art {
    max-width: min(90%, 900px);
}

/* Track info below art */
.overlay-track-info {
    margin-top: 10px;
    text-align: center;
    max-width: 700px;
    width: 100%;
    flex-shrink: 0;
}
.overlay-track-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.overlay-track-album {
    font-size: 0.8rem;
    color: #999;
    margin-top: 2px;
}

/* ===== Mobile ===== */
@media (max-width: 1000px) {
    #fullscreen-overlay {
        flex-direction: column;
        overflow-y: auto;
    }
    .overlay-art-panel {
        flex: none;
        padding: 10px 10px 6px;
        order: 1;
    }
    .overlay-art {
        max-width: 100%;
        max-height: 45vh;
        width: auto;
    }
    .overlay-art-controls {
        top: 4px;
        gap: 10px;
    }
    .overlay-toggle { width: 28px; height: 28px; }
    .overlay-track-title { font-size: 0.95rem; }
    .overlay-track-album { font-size: 0.72rem; }

    .overlay-lyrics-panel {
        width: 100%;
        flex: none;
        order: 2;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.08);
        background: transparent;
    }
    .overlay-lyrics-content {
        overflow-y: visible;
        white-space: normal; /* Restore word wrap on mobile */
    }
    .overlay-queue-panel {
        width: 100%;
        flex: none;
        order: 3;
        border-right: none;
        border-top: 1px solid rgba(255,255,255,0.08);
        background: transparent;
    }
    .overlay-queue-list {
        overflow-y: visible;
    }
    .overlay-queue-panel.collapsed,
    .overlay-lyrics-panel.collapsed {
        display: none !important;
    }
    .queue-title { font-size: 0.8rem; }
}
