/* Frontend public styling for Background Music Player */

.bmp-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.85); /* Premium dark slate slate-900 */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 1px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    padding: 6px 14px;
    user-select: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, background-color 0.3s ease;
}

.bmp-widget:hover {
    transform: translateY(-2px);
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.2);
}

.bmp-controls-container {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
}

/* Audio Visualizer */
.bmp-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    width: 21px;
    margin-right: 6px;
    margin-left: 2px;
}

.bmp-bar {
    display: inline-block;
    width: 3px;
    height: 3px;
    background: linear-gradient(to top, #10b981, #34d399); /* Emerald gradient */
    border-radius: 3px;
    animation: bmp-bounce 1s ease-in-out infinite alternate;
    animation-play-state: paused;
    transform-origin: bottom;
    transition: height 0.2s ease;
}

/* Stagger animations for standard organic sound wave look */
.bmp-bar:nth-child(1) { animation-duration: 0.8s; }
.bmp-bar:nth-child(2) { animation-duration: 1.2s; animation-delay: -0.15s; }
.bmp-bar:nth-child(3) { animation-duration: 0.9s; animation-delay: -0.3s; }
.bmp-bar:nth-child(4) { animation-duration: 1.1s; animation-delay: -0.45s; }

@keyframes bmp-bounce {
    0% { height: 3px; }
    100% { height: 18px; }
}

/* When playing, activate visualizer animations */
.bmp-widget.playing .bmp-bar {
    animation-play-state: running;
}

/* Controls Buttons */
.bmp-control-btn {
    background: transparent;
    border: none;
    color: rgba(248, 250, 252, 0.85); /* slate-50 */
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
    margin: 0;
    outline: none;
}

.bmp-control-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: scale(1.08);
}

.bmp-control-btn:active {
    transform: scale(0.92);
}

.bmp-control-btn svg {
    display: block;
    transition: transform 0.2s ease;
}

.bmp-control-btn:hover svg {
    transform: scale(1.05);
}

/* Volume Control Slide Out Module */
.bmp-volume-module {
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 20px;
    transition: background-color 0.2s ease;
}

.bmp-volume-slider-container {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, margin 0.3s ease;
    display: flex;
    align-items: center;
}

/* Reveal slider on hover or focus-within */
.bmp-volume-module:hover .bmp-volume-slider-container,
.bmp-volume-module:focus-within .bmp-volume-slider-container {
    max-width: 75px;
    opacity: 1;
    margin-left: 6px;
    margin-right: 6px;
}

.bmp-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
    outline: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.bmp-volume-slider:hover {
    background: rgba(255, 255, 255, 0.35);
}

.bmp-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.15s ease, background 0.15s ease;
}

.bmp-volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    background: #34d399;
}

.bmp-volume-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.15s ease, background 0.15s ease;
    cursor: pointer;
}

.bmp-volume-slider::-moz-range-thumb:hover {
    transform: scale(1.3);
    background: #34d399;
}

/* Off-screen hidden YouTube container */
.bmp-hidden-iframe {
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

/* Accessibility / Focus Styles */
.bmp-control-btn:focus-visible,
.bmp-volume-slider:focus-visible {
    box-shadow: 0 0 0 2px #10b981;
}

/* Tap to Unmute Tooltip styling */
.bmp-tooltip {
    position: absolute;
    bottom: 58px;
    right: 12px;
    background: rgba(16, 185, 129, 0.95); /* Emerald background */
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 1000000;
}

.bmp-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 20px;
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: rgba(16, 185, 129, 0.95) transparent;
    display: block;
    width: 0;
}

/* Active tooltip state */
.bmp-widget.show-tooltip .bmp-tooltip {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Pulse animation for the play button to prompt user action */
.bmp-widget.show-tooltip #bmp-play-pause-btn {
    animation: bmp-pulse-green 1.5s infinite;
}

@keyframes bmp-pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
        background: rgba(16, 185, 129, 0.2);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
        background: rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
        background: rgba(16, 185, 129, 0);
    }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .bmp-widget {
        bottom: 16px;
        right: 16px;
        padding: 4px 10px;
    }
    
    .bmp-controls-container {
        height: 34px;
        gap: 6px;
    }
    
    .bmp-control-btn {
        width: 30px;
        height: 30px;
    }
    
    .bmp-visualizer {
        height: 14px;
        width: 17px;
        margin-right: 4px;
        gap: 2px;
    }
    
    .bmp-bar {
        width: 2.5px;
    }
    
    @keyframes bmp-bounce {
        0% { height: 2.5px; }
        100% { height: 14px; }
    }
    
    /* Auto expand slightly less on tiny screens */
    .bmp-volume-module:hover .bmp-volume-slider-container,
    .bmp-volume-module:focus-within .bmp-volume-slider-container {
        max-width: 60px;
    }
    
    .bmp-volume-slider {
        width: 55px;
    }
}
