/* THEJOAi Simple Sticky Audio Player - CSS Only Implementation */

/* Base sticky audio player - uses native CSS sticky positioning */
.sticky-audio-player {
    position: sticky;
    top: 70px; /* Below navbar - adjust based on your navbar height */
    z-index: 999; /* Below navbar (1000) but above content */
    
    /* No transitions for seamless behavior */
    transition: none;
}

/* Enhanced styling when in sticky state (detected by JavaScript) */
.sticky-audio-player.sticky-active {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 15px;
    margin: 0 10px; /* Slight margin when sticky */
}

/* Audio controls styling when sticky */
.sticky-audio-player.sticky-active audio {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Enhanced button styling when sticky */
.sticky-audio-player.sticky-active .article-read {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 8px 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    
    /* No hover transitions for seamless behavior */
    transition: none;
}

.sticky-audio-player.sticky-active .article-read:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Play/pause icon styling when sticky */
.sticky-audio-player.sticky-active .play-icon,
.sticky-audio-player.sticky-active .pause-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}

/* SVG icon styling when sticky */
.sticky-audio-player.sticky-active svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .sticky-audio-player {
        top: 60px; /* Adjust for smaller mobile navbar */
    }
    
    .sticky-audio-player.sticky-active {
        margin: 0 5px;
        padding: 8px 12px;
        border-radius: 6px;
    }
    
    .sticky-audio-player.sticky-active .article-read {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    /* Hide text labels on mobile for space */
    .sticky-audio-player.sticky-active .play-icon span,
    .sticky-audio-player.sticky-active .pause-icon span {
        display: none;
    }
    
    .sticky-audio-player.sticky-active svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .sticky-audio-player {
        top: 55px; /* Further adjust for very small screens */
    }
    
    .sticky-audio-player.sticky-active {
        margin: 0 2px;
        padding: 6px 10px;
    }
    
    .sticky-audio-player.sticky-active .article-read {
        padding: 4px 8px;
    }
    
    .sticky-audio-player.sticky-active audio {
        height: 32px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sticky-audio-player.sticky-active {
        background: rgba(255, 255, 255, 1) !important;
        border: 2px solid #000;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .sticky-audio-player.sticky-active .article-read {
        background: rgba(255, 255, 255, 1);
        border: 2px solid #000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .sticky-audio-player.sticky-active {
        background: rgba(33, 37, 41, 0.95) !important;
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #fff;
    }
    
    .sticky-audio-player.sticky-active .article-read {
        background: rgba(55, 58, 60, 0.9);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #fff;
    }
    
    .sticky-audio-player.sticky-active .article-read:hover {
        background: rgba(55, 58, 60, 1);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
}

/* Focus states for accessibility */
.sticky-audio-player.sticky-active .article-read:focus {
    outline: 2px solid #2490CF;
    outline-offset: 2px;
}

.sticky-audio-player.sticky-active audio:focus {
    outline: 2px solid #2490CF;
    outline-offset: 2px;
}

/* Print styles - return to normal positioning */
@media print {
    .sticky-audio-player {
        position: static !important;
    }
    
    .sticky-audio-player.sticky-active {
        background: none !important;
        box-shadow: none !important;
        border: 1px solid #000;
        padding: 10px;
        margin: 0;
    }
}

/* Safe area insets for devices with notches */
@supports (padding-top: env(safe-area-inset-top)) {
    .sticky-audio-player {
        top: calc(70px + env(safe-area-inset-top));
    }
    
    @media (max-width: 768px) {
        .sticky-audio-player {
            top: calc(60px + env(safe-area-inset-top));
        }
    }
    
    @media (max-width: 480px) {
        .sticky-audio-player {
            top: calc(55px + env(safe-area-inset-top));
        }
    }
}

/* Fallback for browsers without sticky support */
@supports not (position: sticky) {
    .sticky-audio-player {
        position: relative;
    }
}

/* Performance optimization - disable any animations for seamless behavior */
.sticky-audio-player * {
    transition: none !important;
    animation: none !important;
}

/* Only allow hover transitions on buttons */
.sticky-audio-player .article-read {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}