/* Touch & Mobile Specific Fixes */

@media (max-width: 768px) {
    input, 
    select, 
    textarea {
        font-size: 16px !important;
    }
}

button,
a,
.sidebar-item,
.song-card,
.album-card,
.genre-filter,
.page-btn,
.player-btn,
.mobile-menu-btn,
.notification-icon,
.dropdown-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

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

@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;
    }
    
    .song-card.tapped .song-card-overlay {
        opacity: 1;
    }
}

img {
    max-width: 100%;
    height: auto;
}

.app-container {
    min-height: -webkit-fill-available;
}

* {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .fixed-top {
        position: sticky;
        top: 0;
        z-index: 100;
    }
}

.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;
}

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

* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

@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>");
    }
}

button,
.btn,
.song-card,
.album-card {
    touch-action: manipulation;
}

:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mobile Specific Fixes */
@media (max-width: 768px) {
    .mobile-menu-btn {
        position: relative;
        z-index: 1002;
        min-width: 44px;
        min-height: 44px;
    }
    
    .dropdown > .nav-link,
    .dropdown > .user-menu {
        cursor: pointer;
    }
    
    .dropdown .dropdown-menu {
        display: none;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
        position: static;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .mobile-menu-btn:active,
    .sidebar-item:active,
    .dropdown-item:active,
    .nav-link:active,
    .player-btn:active {
        transform: scale(0.96);
        transition: transform 0.05s;
        opacity: 0.8;
    }
    
    button, 
    .btn, 
    .sidebar-item, 
    .nav-link,
    .dropdown-item,
    .genre-filter,
    .page-btn,
    .player-btn,
    .mobile-menu-btn,
    .notification-icon {
        min-height: 44px;
        min-width: 44px;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 940;
        display: none;
        cursor: pointer;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    #main-content {
        padding-bottom: 20px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        max-height: 80vh;
        margin: 20px auto;
    }
    
    .modal-body {
        max-height: 55vh;
        overflow-y: auto;
    }
}