/* =====================================================
   ANOWXRADIO - FOOTER PERSISTENT PLAYER
   Version: 1.7.1
   Site Color Matching + Share Dropdown Fix + No White Gap
   ===================================================== */

/* =====================================================
   1. MAIN CONTAINER
   ===================================================== */
.anowx-footer-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    pointer-events: none;
}

.anowx-footer-player[data-active="true"] {
    transform: translateY(0);
    pointer-events: all;
}

/* =====================================================
   2. INNER WRAPPER - SITE COLOR MATCHING
   Uses CSS variables from site appearance settings
   ===================================================== */
.fp-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    background: linear-gradient(135deg, 
        var(--accent-dark-red, #8B0000), 
        color-mix(in srgb, var(--accent-red, #DC143C) 85%, #000 15%)
    );
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 -4px 30px rgba(0, 0, 0, 0.5),
        0 -1px 0 rgba(255, 255, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    min-height: 72px;
    position: relative;
    overflow: hidden;
}

/* Subtle shine overlay */
.fp-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.04) 0%, 
        transparent 50%, 
        rgba(0, 0, 0, 0.1) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* Ensure all children are above the overlay */
.fp-inner > * {
    position: relative;
    z-index: 1;
}

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
    .fp-inner {
        background: linear-gradient(135deg, 
            var(--accent-dark-red, #8B0000), 
            var(--accent-red, #DC143C)
        );
    }
}

/* =====================================================
   3. STATION LOGO
   ===================================================== */
.fp-logo-wrap {
    position: relative;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

.fp-logo {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.anowx-footer-player[data-playing="true"] .fp-logo {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
}

/* Mini EQ on Logo */
.fp-eq-mini {
    position: absolute;
    bottom: -2px;
    right: -2px;
    display: none;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5px;
    width: 20px;
    height: 20px;
    background: rgba(39, 174, 96, 0.9);
    border-radius: 5px;
    padding: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.anowx-footer-player[data-playing="true"] .fp-eq-mini {
    display: flex;
}

.fp-eq-mini span {
    width: 3px;
    background: #fff;
    border-radius: 1px;
    animation: fpEqAnim 0.6s ease-in-out infinite alternate;
}

.fp-eq-mini span:nth-child(1) { height: 4px; animation-delay: 0s; }
.fp-eq-mini span:nth-child(2) { height: 8px; animation-delay: 0.15s; }
.fp-eq-mini span:nth-child(3) { height: 5px; animation-delay: 0.3s; }

@keyframes fpEqAnim {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1); }
}

/* =====================================================
   4. STATION INFO
   ===================================================== */
.fp-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fp-station-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: color 0.2s ease;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.fp-station-name:hover {
    color: rgba(255, 255, 255, 0.8);
}

.fp-now-playing {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fp-status-text {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.anowx-footer-player[data-playing="true"] .fp-status-text {
    color: rgba(46, 204, 113, 0.95);
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.3);
}

.anowx-footer-player[data-buffering="true"] .fp-status-text {
    color: rgba(243, 156, 18, 0.95);
}

/* =====================================================
   5. PLAY/PAUSE BUTTON
   ===================================================== */
.fp-controls {
    flex-shrink: 0;
}

.fp-play-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.fp-play-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.fp-play-btn:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.fp-play-btn:hover::before {
    opacity: 1;
}

.fp-play-btn:active {
    transform: scale(0.96);
}

/* Buffering animation on play button */
.anowx-footer-player[data-buffering="true"] .fp-play-btn {
    animation: fpPulseBtn 1.5s ease-in-out infinite;
}

@keyframes fpPulseBtn {
    0%, 100% { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 2px 20px rgba(255, 255, 255, 0.2); }
}

/* =====================================================
   6. VOLUME CONTROL
   ===================================================== */
.fp-volume {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.fp-vol-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fp-vol-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.fp-vol-slider-wrap {
    width: 80px;
    display: flex;
    align-items: center;
}

.fp-vol-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
    transition: height 0.2s ease;
}

.fp-vol-slider:hover {
    height: 6px;
}

.fp-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.fp-vol-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.fp-vol-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
}

/* =====================================================
   7. SHARE BUTTON
   ===================================================== */
.fp-share {
    flex-shrink: 0;
}

.fp-share-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fp-share-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.05);
}

/* =====================================================
   8. CLOSE BUTTON
   ===================================================== */
.fp-close {
    flex-shrink: 0;
}

.fp-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fp-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
}

/* =====================================================
   9. GLOW LINE (Progress Indicator) - SITE COLOR
   ===================================================== */
.fp-glow-line {
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.4), 
        rgba(255, 255, 255, 0.8), 
        rgba(255, 255, 255, 0.4)
    );
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    transition: width 0.3s ease;
    opacity: 0;
}

.anowx-footer-player[data-playing="true"] .fp-glow-line {
    width: 100%;
    opacity: 1;
    animation: fpGlowPulse 3s ease-in-out infinite;
}

.anowx-footer-player[data-buffering="true"] .fp-glow-line {
    width: 40%;
    opacity: 1;
    animation: fpGlowLoading 1.5s ease-in-out infinite;
}

@keyframes fpGlowPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes fpGlowLoading {
    0% { width: 0; left: 0; }
    50% { width: 40%; left: 30%; }
    100% { width: 0; left: 100%; }
}

/* =====================================================
   10. BODY PADDING - NO WHITE GAP FIX
   ===================================================== */
body.anowx-fp-active {
    padding-bottom: 0 !important;
}

body.anowx-fp-active .scroll-top {
    bottom: 90px !important;
}

/* Push footer content up so player doesn't overlap */
body.anowx-fp-active .anowx-footer {
    padding-bottom: 76px !important;
}

body.anowx-fp-active .anowx-footer-bottom {
    padding-bottom: 80px !important;
}

/* Fix: Remove any white background gap below footer */
body.anowx-fp-active .anowx-footer::after {
    content: '';
    display: block;
    height: 76px;
    background: inherit;
}

/* Ensure footer background extends to cover the gap */
html {
    /* Prevent white flash at bottom */
}

body.anowx-fp-active {
    /* Match footer background color to prevent white gap */
    background-color: var(--footer-bg, #1a0a12) !important;
}

/* Override: Only the body bottom area should match footer */
body.anowx-fp-active::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 76px;
    background: linear-gradient(135deg, 
        var(--accent-dark-red, #8B0000), 
        var(--accent-red, #DC143C)
    );
    z-index: 9997;
    pointer-events: none;
}

/* The footer player sits on top of this */
.anowx-footer-player {
    z-index: 9998;
}

/* =====================================================
   11. SHARE DROPDOWN - SITE COLOR MATCHING
   ===================================================== */
.fp-share-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 60px;
    background: linear-gradient(135deg, 
        var(--accent-dark-red, #8B0000), 
        color-mix(in srgb, var(--accent-red, #DC143C) 90%, #000 10%)
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 190px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: fpDropUp 0.25s ease;
    z-index: 10;
    overflow: hidden;
}

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
    .fp-share-dropdown {
        background: linear-gradient(135deg, 
            var(--accent-dark-red, #8B0000), 
            var(--accent-red, #DC143C)
        );
    }
}

/* Subtle inner glow */
.fp-share-dropdown::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), transparent);
    pointer-events: none;
    border-radius: 14px 14px 0 0;
}

.fp-share-dropdown.active {
    display: flex;
}

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

/* Share dropdown arrow */
.fp-share-dropdown::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: var(--accent-red, #DC143C);
    transform: rotate(45deg);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.fp-share-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
    z-index: 1;
}

.fp-share-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(2px);
}

.fp-share-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.fp-share-item.facebook i { color: #4267B2; }
.fp-share-item.whatsapp i { color: #25d366; }
.fp-share-item.twitter i { color: #1da1f2; }
.fp-share-item.telegram i { color: #0088cc; }
.fp-share-item.copy-link i { color: #FFD700; }

/* =====================================================
   12. MOBILE RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .fp-inner {
        gap: 10px;
        padding: 10px 14px;
        min-height: 64px;
    }

    .fp-logo-wrap {
        width: 42px;
        height: 42px;
    }

    .fp-logo {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    .fp-station-name {
        font-size: 13px;
    }

    .fp-status-text {
        font-size: 11px;
    }

    .fp-play-btn {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }

    .fp-vol-slider-wrap {
        display: none;
    }

    .fp-share-dropdown {
        right: 14px;
        bottom: calc(100% + 8px);
        min-width: 170px;
    }

    .fp-share-dropdown::after {
        right: 15px;
    }

    body.anowx-fp-active .scroll-top {
        bottom: 82px !important;
    }

    body.anowx-fp-active .anowx-footer {
        padding-bottom: 68px !important;
    }

    body.anowx-fp-active .anowx-footer-bottom {
        padding-bottom: 72px !important;
    }

    body.anowx-fp-active .anowx-footer::after {
        height: 68px;
    }

    body.anowx-fp-active::after {
        height: 68px;
    }
}

@media (max-width: 480px) {
    .fp-inner {
        gap: 8px;
        padding: 8px 12px;
        min-height: 60px;
    }

    .fp-logo-wrap {
        width: 38px;
        height: 38px;
    }

    .fp-logo {
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }

    .fp-station-name {
        font-size: 12px;
    }

    .fp-play-btn {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .fp-vol-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .fp-share-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .fp-close-btn {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }

    body.anowx-fp-active .scroll-top {
        bottom: 76px !important;
    }

    body.anowx-fp-active .anowx-footer {
        padding-bottom: 64px !important;
    }

    body.anowx-fp-active .anowx-footer-bottom {
        padding-bottom: 68px !important;
    }

    body.anowx-fp-active .anowx-footer::after {
        height: 64px;
    }

    body.anowx-fp-active::after {
        height: 64px;
    }

    .fp-share-dropdown {
        right: 10px;
        min-width: 160px;
        border-radius: 12px;
    }

    .fp-share-item {
        padding: 10px 14px;
        font-size: 12px;
        border-radius: 8px;
    }
}

@media (max-width: 360px) {
    .fp-volume {
        display: none;
    }

    .fp-share-dropdown {
        right: 8px;
        left: 8px;
        min-width: auto;
    }

    .fp-share-dropdown::after {
        right: 50px;
    }
}

/* =====================================================
   13. DARK MODE SUPPORT
   ===================================================== */
body.dark-mode .fp-inner {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--accent-dark-red, #8B0000) 70%, #000 30%), 
        color-mix(in srgb, var(--accent-red, #DC143C) 60%, #000 40%)
    );
    border-top-color: rgba(255, 255, 255, 0.04);
}

@supports not (color: color-mix(in srgb, red, blue)) {
    body.dark-mode .fp-inner {
        background: linear-gradient(135deg, #5a0000, #8B0000);
    }
}

body.dark-mode .fp-share-dropdown {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--accent-dark-red, #8B0000) 70%, #000 30%), 
        color-mix(in srgb, var(--accent-red, #DC143C) 60%, #000 40%)
    );
}

@supports not (color: color-mix(in srgb, red, blue)) {
    body.dark-mode .fp-share-dropdown {
        background: linear-gradient(135deg, #5a0000, #8B0000);
    }
}

body.dark-mode::after {
    background: linear-gradient(135deg, #5a0000, #8B0000) !important;
}

/* =====================================================
   14. PRINT HIDE
   ===================================================== */
@media print {
    .anowx-footer-player {
        display: none !important;
    }
    body.anowx-fp-active::after {
        display: none !important;
    }
}

/* =====================================================
   15. ANIMATION - SMOOTH ENTRY
   ===================================================== */
.anowx-footer-player[data-active="true"] {
    animation: fpSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fpSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =====================================================
   16. VOLUME SLIDER - SITE COLOR TRACK
   ===================================================== */
.fp-vol-slider {
    background: linear-gradient(to right, 
        rgba(255, 255, 255, 0.7) 0%, 
        rgba(255, 255, 255, 0.15) 0%
    );
}

/* =====================================================
   17. TOAST POSITION - ABOVE FOOTER PLAYER
   ===================================================== */
body.anowx-fp-active .fp-toast,
body.anowx-fp-active .anowxradio-toast,
body.anowx-fp-active .anowx-toast {
    bottom: 90px !important;
}