/* ========================================================
   BWXP AUDIO PLAYER & MUSIC HUB STYLES
   Emerald & Cyber Gold Aesthetic matching BWXP Sanctuary
   ======================================================== */

/* Reserve bottom space so page content isn't obscured by fixed audio bar */
body {
    padding-bottom: 95px !important;
}

/* ----------------------------------------------------
   1. FIXED FOOTER AUDIO BAR
   ---------------------------------------------------- */
.bwxp-audio-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 76px;
    z-index: 9999;
    background: rgba(6, 26, 20, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 229, 153, 0.32);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-sizing: border-box;
    font-family: 'Sometype Mono', monospace;
}

/* Surgical Progress Seam at Top of Footer Player */
#footer-progress-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

#footer-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00E599 0%, #FFA100 100%);
    box-shadow: 0 0 10px rgba(0, 229, 153, 0.8);
    transition: width 0.1s linear;
}

/* Player Left Section: Art & Meta */
.footer-player-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.track-art-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 229, 153, 0.4);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.track-art-wrapper:hover {
    transform: scale(1.06);
    border-color: #FFA100;
    box-shadow: 0 0 15px rgba(255, 161, 0, 0.4);
}

.track-art-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.player-meta-box {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.track-title-wrapper {
    overflow: hidden;
    white-space: nowrap;
    max-width: 260px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#track-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s ease;
}

#track-title:hover {
    color: #FFA100;
}

#track-artist {
    font-size: 0.72rem;
    color: #00E599;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Center Controls */
.footer-player-center {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-controls button {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 1.05rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-controls button:hover {
    color: #FFA100;
    background: rgba(255, 161, 0, 0.12);
}

.bwxp-play-btn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #00E599, #00b377) !important;
    color: #051a14 !important;
    font-size: 1.15rem !important;
    font-weight: bold !important;
    box-shadow: 0 0 15px rgba(0, 229, 153, 0.45) !important;
    border: 1px solid #00E599 !important;
}

.bwxp-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(0, 229, 153, 0.7) !important;
}

.repeat-btn.active-all, .repeat-btn.active-one {
    background: rgba(0, 229, 153, 0.2) !important;
    color: #00E599 !important;
    border: 1px solid #00E599 !important;
}

.shuffle-btn.active-shuffle {
    background: rgba(255, 161, 0, 0.2) !important;
    color: #FFA100 !important;
    border: 1px solid #FFA100 !important;
}

/* Volume Slider */
#volume-slider {
    width: 75px;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00E599;
    cursor: pointer;
}

/* Player Right Section: Badges & Expand CTA */
.footer-player-right {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
    flex: 1;
}

.player-branding-badge {
    font-size: 0.72rem;
    color: rgba(203, 213, 225, 0.8);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
}

.expand-player-btn {
    background: rgba(0, 229, 153, 0.12);
    border: 1px solid rgba(0, 229, 153, 0.4);
    color: #00E599;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.expand-player-btn:hover {
    background: #00E599;
    color: #041410;
    box-shadow: 0 0 15px rgba(0, 229, 153, 0.5);
}

.sonar-btn {
    background: rgba(255, 161, 0, 0.12);
    border: 1px solid rgba(255, 161, 0, 0.4);
    color: #FFA100;
    font-size: 0.72rem;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sonar-btn:hover {
    background: #FFA100;
    color: #000;
}

/* ----------------------------------------------------
   2. EXPANDABLE MUSIC POPUP MODAL
   ---------------------------------------------------- */
#music-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: radial-gradient(circle at center, rgba(9, 36, 28, 0.96) 0%, rgba(4, 14, 11, 0.98) 100%) !important;
    display: none;
    align-items: flex-start !important;
    justify-content: center !important;
    z-index: 99999 !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    margin: 0 !important;
    padding: 24px 16px !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    font-family: 'Sometype Mono', monospace;
}

#music-popup {
    width: 100% !important;
    max-width: 1020px !important;
    background: rgba(8, 30, 23, 0.9) !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 229, 153, 0.35) !important;
    border-radius: 24px !important;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.9), 0 0 40px rgba(0, 229, 153, 0.12) !important;
    padding: 32px 36px !important;
    position: relative !important;
    margin: auto 0 !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    color: #fff;
}

#close-popup {
    position: absolute;
    top: 18px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 229, 153, 0.4);
    color: #00E599;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#close-popup:hover {
    background: #00E599;
    color: #000;
}

#popup-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 20px;
    padding-right: 40px;
    flex-wrap: wrap;
    gap: 12px;
}

#popup-track-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #FFA100;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

#popup-track-artist {
    font-size: 0.85rem;
    color: #00E599;
    font-weight: 700;
    letter-spacing: 1px;
}

.popup-flex {
    display: flex;
    gap: 32px;
    align-items: center;
}

.popup-left {
    flex-shrink: 0;
}

#popup-track-art {
    width: 240px;
    height: 240px;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid rgba(0, 229, 153, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 229, 153, 0.15);
}

.popup-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

#popup-track-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #cbd5e1;
    max-height: 4.8rem;
    overflow-y: auto;
}

/* Waveform Visualizer */
#waveform-container {
    height: 60px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    margin: 8px 0 12px;
    overflow: hidden;
    border: 1px solid rgba(0, 229, 153, 0.25);
    position: relative;
}

#waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Scrubber / Progress */
.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

#current-time, #total-duration {
    font-size: 0.8rem;
    font-weight: bold;
    color: #ffffff;
    min-width: 38px;
}

#popup-progress {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
}

#popup-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00E599;
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 0 0 10px #00E599;
}

/* Secondary Popup Controls */
.popup-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.player-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.player-btn:hover {
    background: rgba(0, 229, 153, 0.15);
    border-color: #00E599;
    color: #00E599;
    transform: scale(1.05);
}

.main-play {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: #041410 !important;
    border: 2px solid #00E599 !important;
    color: #ffffff !important;
    font-size: 1.35rem !important;
    box-shadow: 0 0 20px rgba(0, 229, 153, 0.3) !important;
}

.main-play:hover {
    background: #00E599 !important;
    color: #000000 !important;
    transform: scale(1.08) !important;
}

/* ----------------------------------------------------
   3. UP NEXT QUEUE & LYRICS TABS
   ---------------------------------------------------- */
#popup-playlist-container {
    margin-top: 20px;
    border-top: 1px solid rgba(0, 229, 153, 0.2);
    padding-top: 14px;
}

#playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.popup-tab-btn {
    background: none;
    border: none;
    color: #888888;
    font-weight: bold;
    font-size: 0.85rem;
    letter-spacing: 1px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    padding-bottom: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.popup-tab-btn.active, .popup-tab-btn:hover {
    color: #FFA100 !important;
    border-bottom-color: #FFA100 !important;
}

.queue-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.queue-action-btn {
    background: rgba(0, 229, 153, 0.12);
    border: 1px solid rgba(0, 229, 153, 0.35);
    color: #00E599;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
}

.queue-action-btn:hover {
    background: #00E599;
    color: #000;
}

#popup-playlist-scroll {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(4, 16, 12, 0.85);
    border-radius: 10px;
    padding: 8px;
    border: 1px solid rgba(0, 229, 153, 0.2);
}

#playlist-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    gap: 10px;
}

.playlist-item:hover {
    background: rgba(0, 229, 153, 0.1);
}

.playlist-item.active-track {
    background: rgba(0, 229, 153, 0.18);
    border-left: 3px solid #00E599;
}

.pi-handle {
    cursor: grab;
    color: #777;
    font-size: 0.95rem;
    padding: 0 4px;
    touch-action: none;
}

.pi-art {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.pi-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.pi-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: #ffffff;
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.pi-artist {
    font-size: 0.7rem;
    color: #00E599;
    display: block;
    margin-top: 1px;
}

.pi-now-playing-badge {
    font-size: 0.65rem;
    background: rgba(0, 229, 153, 0.2);
    color: #00E599;
    border: 1px solid #00E599;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.pi-remove-btn {
    background: none;
    border: none;
    color: #777;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.2s;
}

.pi-remove-btn:hover {
    color: #ff5555;
}

/* Lyrics Scroll Container */
#popup-lyrics-scroll {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(4, 16, 12, 0.85);
    border-radius: 10px;
    padding: 14px 18px;
    border: 1px solid rgba(0, 229, 153, 0.2);
    font-size: 0.9rem;
    line-height: 1.8;
    color: #cbd5e1;
    white-space: pre-wrap;
}

/* ----------------------------------------------------
   4. FLOATING DRAWERS & MODALS
   ---------------------------------------------------- */
#playlist-overlay, #lyrics-overlay {
    position: fixed;
    right: 24px;
    bottom: 88px;
    width: 340px;
    max-height: 480px;
    background: rgba(6, 26, 20, 0.96);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 229, 153, 0.35);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: none;
    flex-direction: column;
    padding: 14px;
    box-sizing: border-box;
    font-family: 'Sometype Mono', monospace;
}

/* 2D Sonar Radar Fullscreen Overlay */
#sonar-map-overlay {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(6, 30, 22, 0.97) 0%, rgba(3, 12, 9, 0.99) 100%);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 999999;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Sometype Mono', monospace;
}

#sonar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    border-bottom: 1px solid rgba(0, 229, 153, 0.3);
    z-index: 10;
    background: rgba(4, 16, 12, 0.6);
}

#sonar-canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#sonar-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

#sonar-node-card {
    display: none;
    position: absolute;
    width: 310px;
    background: rgba(8, 28, 22, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 229, 153, 0.6);
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 229, 153, 0.2);
    padding: 16px;
    z-index: 20;
    transition: transform 0.2s ease, opacity 0.2s ease;
    pointer-events: auto;
    font-family: 'Sometype Mono', monospace;
}

/* Add Tracks Picker Modal */
#bwxp-add-tracks-modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 14, 10, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    font-family: 'Sometype Mono', monospace;
}

.bwxp-catalog-modal-card {
    width: 580px;
    max-width: 95vw;
    max-height: 80vh;
    background: rgba(6, 26, 20, 0.98);
    border: 1px solid rgba(0, 229, 153, 0.4);
    border-radius: 18px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Audio Playing Waveform Indicator inside Art */
.bwxp-wave-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    padding: 2px 4px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    pointer-events: none;
}

.bwxp-wave-indicator span {
    width: 2px;
    height: 4px;
    background: #00E599;
    border-radius: 1px;
    transition: height 0.2s ease;
}

.bwxp-wave-indicator.playing span:nth-child(1) {
    animation: wave-bounce 0.8s ease-in-out infinite alternate;
}
.bwxp-wave-indicator.playing span:nth-child(2) {
    animation: wave-bounce 0.8s ease-in-out infinite alternate 0.2s;
}
.bwxp-wave-indicator.playing span:nth-child(3) {
    animation: wave-bounce 0.8s ease-in-out infinite alternate 0.4s;
}
.bwxp-wave-indicator.playing span:nth-child(4) {
    animation: wave-bounce 0.8s ease-in-out infinite alternate 0.1s;
}

@keyframes wave-bounce {
    0% { height: 3px; }
    100% { height: 12px; }
}

/* ----------------------------------------------------
   5. MOBILE RESPONSIVENESS
   ---------------------------------------------------- */
@media (max-width: 768px) {
    .bwxp-audio-bar {
        height: 68px;
        padding: 0 14px;
    }

    .player-branding-badge,
    #volume-slider,
    #mute-toggle,
    .repeat-btn,
    .shuffle-btn {
        display: none !important;
    }

    .track-title-wrapper {
        max-width: 140px;
    }

    #popup-track-title {
        font-size: 1.25rem;
    }

    .popup-flex {
        flex-direction: column;
        gap: 16px;
    }

    #popup-track-art {
        width: 160px;
        height: 160px;
    }

    #music-popup {
        padding: 24px 18px !important;
    }

    #playlist-overlay, #lyrics-overlay {
        right: 10px;
        left: 10px;
        width: auto;
    }
}
