/* AudioVibe v6.0 - Mobile-First Optimizations */

/* Mobile-First Base */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Ensure footer elements don't overlap on mobile */
@media (max-width: 640px) {
    #footer-donation-banner {
        bottom: 80px !important;
        left: 4px !important;
        max-width: 160px !important;
        padding: 8px !important;
    }
    
    #footer-donation-banner h3 {
        font-size: 0.75rem !important;
    }
    
    #footer-donation-banner img {
        max-width: 100px !important;
    }
    
    #footer-donation-banner a {
        font-size: 0.65rem !important;
        padding: 6px 8px !important;
    }
    
    #footer-access-counter {
        bottom: 80px !important;
        right: 4px !important;
        padding: 8px !important;
        min-width: 90px !important;
    }
    
    #footer-access-counter .text-2xl {
        font-size: 1.25rem !important;
    }
    
    #footer-access-counter .text-xs {
        font-size: 0.65rem !important;
    }
    
    #footer-theme-toggle {
        bottom: 12px !important;
        width: 44px !important;
        height: 44px !important;
    }
    
    /* Hide smartlink on very small screens */
    .adsterra-smartlink {
        display: none !important;
    }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    #footer-donation-banner {
        max-width: 180px !important;
    }
    
    #footer-access-counter {
        min-width: 110px !important;
    }
}

/* Ensure TOP MUSIC button is always visible */
.nav_topmusic {
    display: inline-block !important;
    min-width: fit-content !important;
}

/* Ad containers optimization */
.adsterra-native-banner {
    max-width: 100% !important;
    margin: 15px auto !important;
    padding: 0 10px !important;
}

@media (max-width: 768px) {
    .adsterra-native-banner {
        margin: 10px auto !important;
    }
}

/* Footer spacing to accommodate fixed elements */
body {
    padding-bottom: 80px !important;
}

@media (max-width: 640px) {
    body {
        padding-bottom: 160px !important;
    }
}

/* Smooth theme transitions */
body {
    transition: background 0.3s ease, color 0.3s ease !important;
}

/* Prevent layout shift from ads */
#container-0589bf09965921667631b6c1406a134c {
    min-height: 100px;
    display: block;
}

/* Mobile menu improvements */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

#mobile-menu:not(.hidden) {
    max-height: 500px;
}

/* Header optimization for mobile */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Converter section spacing */
#converter {
    margin-top: 20px;
    margin-bottom: 40px;
}

@media (max-width: 640px) {
    #converter {
        margin-top: 10px;
        margin-bottom: 30px;
    }
    
    #converter h1 {
        font-size: 1.75rem !important;
    }
    
    #converter p {
        font-size: 0.95rem !important;
    }
}

/* Button improvements */
button, .btn, a.button {
    touch-action: manipulation;
    user-select: none;
}

/* Performance optimizations */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Reduce animations on slow devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    #footer-donation-banner,
    #footer-access-counter,
    #footer-theme-toggle {
        bottom: calc(env(safe-area-inset-bottom) + 16px) !important;
    }
}

/* Accessibility improvements */
:focus-visible {
    outline: 2px solid #FF3333;
    outline-offset: 2px;
}

/* Loading state for ads */
[id^="container-"] {
    position: relative;
}

[id^="container-"]:empty::before {
    content: '';
    display: block;
    width: 100%;
    height: 100px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Print styles */
@media print {
    #footer-donation-banner,
    #footer-access-counter,
    #footer-theme-toggle,
    .adsterra-smartlink,
    header,
    #cookie-banner {
        display: none !important;
    }
}
