/* Touch & Mobile Specific Fixes */

/* Prevent zoom on input focus on iOS */
@media (max-width: 768px) {
    input, 
    select, 
    textarea {
        font-size: 16px !important;
    }
}

/* Better tap highlights */
button,
a,
.sidebar-item,
.song-card,
.album-card,
.genre-filter,
.page-btn,
.player-btn {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Modal backdrop click area */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
}

/* Fix for sticky hover on mobile */
@media (hover: hover) {
    .song-card-overlay {
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .song-card:hover .song-card-overlay {
        opacity: 1;
    }
}

@media (hover: none) {
    .song-card-overlay {
        opacity: 0;
        background: transparent;
    }
    
    /* Show overlay on tap using JavaScript */
    .song-card.tapped .song-card-overlay {
        opacity: 1;
    }
}

/* Ensure images don't overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Fix for 100vh issues on mobile browsers */
.app-container {
    min-height: -webkit-fill-available;
}

/* Better scrolling on iOS */
* {
    -webkit-overflow-scrolling: touch;
}

/* Fix for fixed position elements on mobile */
@media (max-width: 768px) {
    .fixed-top {
        position: sticky;
        top: 0;
        z-index: 100;
    }
}

/* Loading indicator for slow connections */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Prevent layout shift */
img,
video,
iframe {
    aspect-ratio: attr(width) / attr(height);
}

/* Smooth transitions for theme switching */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Better form elements on mobile */
@media (max-width: 768px) {
    select {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
        background-repeat: no-repeat;
        background-position: right 12px center;
        appearance: none;
        padding-right: 36px;
    }
    
    .light-theme select {
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    }
}

/* Fix for 300ms click delay on some browsers */
button,
.btn,
.song-card,
.album-card {
    touch-action: manipulation;
}

/* Keyboard navigation improvements */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}