/* ==========================================================================
   MP3 Local Playlist — UI Styles
   Scoped to .mp3-lp-* and .lp-* so nothing bleeds into existing styles.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Control Bar  (#mp3-lp-bar)
   Sits at the very top of the .mp3-song-voting-container
   -------------------------------------------------------------------------- */

.mp3-lp-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-family: inherit;
    transition: all 0.3s ease;
}

/* Hidden state — use class instead of display:none so display:flex is preserved */
.mp3-lp-bar.lp-bar-hidden {
    display: none !important;
}

/* Active state — when local playlist is currently playing */
.mp3-lp-bar.lp-bar-active {
    border-color: rgba(99, 179, 237, 0.5);
    box-shadow: 0 4px 20px rgba(99, 179, 237, 0.2);
}

/* Left section: icon + label + count */
.lp-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 500;
    min-width: 0;
}

.lp-bar-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.lp-bar-label {
    font-weight: 600;
    white-space: nowrap;
    color: #90cdf4;
}

.lp-bar-count {
    color: #a0aec0;
    font-size: 13px;
    white-space: nowrap;
}

/* Right section: action buttons */
.lp-bar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   Control Bar Buttons  (.lp-btn)
   -------------------------------------------------------------------------- */

.lp-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.07);
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
    user-select: none;
}

.lp-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-1px);
}

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

.lp-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Play button */
.lp-btn-primary {
    background: rgba(99, 179, 237, 0.2);
    border-color: rgba(99, 179, 237, 0.4);
    color: #90cdf4;
}

.lp-btn-primary:hover {
    background: rgba(99, 179, 237, 0.35);
    border-color: rgba(99, 179, 237, 0.7);
    color: #fff;
}

/* "Now Playing" state */
.lp-btn-playing {
    background: rgba(72, 187, 120, 0.25) !important;
    border-color: rgba(72, 187, 120, 0.6) !important;
    color: #9ae6b4 !important;
}

/* Clear / danger button */
.lp-btn-danger {
    background: rgba(252, 129, 74, 0.1);
    border-color: rgba(252, 129, 74, 0.3);
    color: #fbd38d;
}

.lp-btn-danger:hover {
    background: rgba(252, 129, 74, 0.25);
    border-color: rgba(252, 129, 74, 0.6);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Per-song "Add to Local Playlist" button  (.lp-add-btn)
   Injected inside each .cover-item via JavaScript.
   Positioned at the bottom-center of the card.
   -------------------------------------------------------------------------- */

.lp-add-btn {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;

    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.65);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;

    /* Hidden by default on non-center items — revealed on hover / center */
    opacity: 0;
    pointer-events: none;
}

/* Show on any cover-item hover */
.cover-item:hover .lp-add-btn {
    opacity: 1;
    pointer-events: auto;
}

/* Always show on the center (active) item */
.cover-item.center .lp-add-btn {
    opacity: 1;
    pointer-events: auto;
    bottom: 8px;
    padding: 4px 12px;
    font-size: 12px;
}

/* In-playlist state: green check */
.lp-add-btn.lp-in-playlist {
    background: rgba(72, 187, 120, 0.8);
    border-color: rgba(72, 187, 120, 0.9);
    color: #fff;
    opacity: 1;
    pointer-events: auto;
}

.lp-add-btn:hover {
    background: rgba(99, 179, 237, 0.85);
    border-color: #63b3ed;
    color: #fff;
    transform: translateX(-50%) scale(1.05);
}

.lp-add-btn.lp-in-playlist:hover {
    background: rgba(229, 62, 62, 0.8);
    border-color: rgba(229, 62, 62, 0.9);
}

/* --------------------------------------------------------------------------
   Toast Notification  (#mp3-lp-toast)
   -------------------------------------------------------------------------- */

.mp3-lp-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 99999;

    padding: 10px 20px;
    background: rgba(26, 32, 44, 0.95);
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-width: 420px;
    text-align: center;
    line-height: 1.4;
    pointer-events: none;

    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.mp3-lp-toast.mp3-lp-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --------------------------------------------------------------------------
   Flash animations  (keyboard shortcut + voice feedback)
   -------------------------------------------------------------------------- */

@keyframes lp-flash-bar {
    0%   { box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
    50%  { box-shadow: 0 4px 30px rgba(99, 179, 237, 0.6); border-color: rgba(99,179,237,0.8); }
    100% { box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
}

.mp3-lp-bar.lp-bar-flash {
    animation: lp-flash-bar 0.6s ease;
}

@keyframes lp-flash-btn {
    0%   { transform: translateX(-50%) scale(1);    background: rgba(0,0,0,0.65); }
    50%  { transform: translateX(-50%) scale(1.15); background: rgba(99,179,237,0.85); }
    100% { transform: translateX(-50%) scale(1);    background: rgba(0,0,0,0.65); }
}

.lp-add-btn.lp-flash {
    animation: lp-flash-btn 0.6s ease;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
    .mp3-lp-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .lp-bar-actions {
        width: 100%;
    }

    .lp-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
    }

    .lp-add-btn {
        font-size: 10px;
        padding: 2px 8px;
    }

    .mp3-lp-toast {
        bottom: 70px; /* above mobile nav bars */
        left: 16px;
        right: 16px;
        max-width: none;
        transform: translateY(20px);
    }

    .mp3-lp-toast.mp3-lp-toast-visible {
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   Secret Unlock Modal  (#mp3-lp-unlock-overlay)
   -------------------------------------------------------------------------- */

#mp3-lp-unlock-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#mp3-lp-unlock-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
    padding: 36px 32px 28px;
    width: 360px;
    max-width: 92vw;
    font-family: inherit;
    text-align: center;
    animation: lp-modal-in 0.22s ease;
}

@keyframes lp-modal-in {
    from { opacity: 0; transform: scale(0.92) translateY(-10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);     }
}

.lp-modal-icon {
    font-size: 36px;
    margin-bottom: 10px;
    display: block;
}

.lp-modal-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #90cdf4;
    letter-spacing: 0.02em;
}

.lp-modal-desc {
    margin: 0 0 20px;
    font-size: 13px;
    color: #a0aec0;
    line-height: 1.5;
}

.lp-modal-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #e2e8f0;
    outline: none;
    margin-bottom: 14px;
    transition: border-color 0.2s ease;
}

.lp-modal-input:focus {
    border-color: rgba(99, 179, 237, 0.7);
    background: rgba(255, 255, 255, 0.1);
}

.lp-modal-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.lp-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.lp-modal-error {
    min-height: 18px;
    font-size: 12px;
    color: #fc8181;
    margin: 0;
    line-height: 1.4;
}
