/*--------------------------------------------------------------
# Enhanced Mobile Device Compatibility Styles
--------------------------------------------------------------*/

/* Base mobile styles for all devices */
.mobile-device {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
}

/* Fix for iOS height issues */
:root {
    --app-height: 100%;
}

html, body {
    height: 100vh;
    height: var(--app-height);
    overflow-x: hidden;
    overflow-y: auto !important;
}

/* iOS specific fixes */
.ios-device {
    /* Prevent elastic scrolling */
    position: fixed;
    overflow-x: hidden;
    overflow-y: auto !important;
    width: 100%;
    
    /* Fix blurry text during animations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ios-device .scrollable-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix for iOS fixed positioning issues */
.ios-device .fixed-element {
    position: fixed;
    transform: translateZ(0);
}

/* Android specific fixes */
.android-device input,
.android-device textarea {
    font-size: 16px; /* Prevents zoom */
}

/* Better touch targets for all mobile devices */
.mobile-device button,
.mobile-device .nav-link,
.mobile-device .dropdown-item {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 15px;
}

/* Enhanced form elements for touch */
.mobile-device input[type="checkbox"],
.mobile-device input[type="radio"] {
    transform: scale(1.2);
    margin-right: 8px;
}

/* Prevent text selection on navigation elements */
.navbar-nav a,
.nav-link,
.dropdown-item,
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Remove hover effects on touch devices, use active states instead */
@media (hover: none) {
    .hover-effect:hover {
        transform: none !important;
    }
    
    .hover-effect:active {
        transform: translateY(-3px) !important;
    }
}

/* Better scrolling experience */
.mobile-device .smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Fix for sticky header on mobile */
.mobile-device #header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
}

/* Enhanced mobile dropdown menus */
.mobile-device .dropdown-menu {
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    border: none;
}

.mobile-device .dropdown-item {
    padding: 12px 20px;
    transition: background-color 0.2s ease;
}

.mobile-device .dropdown-item:active {
    background-color: rgba(0, 128, 128, 0.8);
    color: white;
}

/* Optimize images for mobile */
.mobile-device img {
    max-width: 100%;
    height: auto;
}

/* Fix for Bootstrap modals on mobile */
.mobile-device .modal {
    padding-right: 0 !important;
}

.mobile-device .modal-dialog {
    margin: 10px auto;
    max-width: 95%;
}

/* Prevent unwanted text size changes in landscape mode (iOS) */
@media screen and (orientation: landscape) {
    .ios-device body {
        text-size-adjust: none;
        -webkit-text-size-adjust: none;
    }
}

/* Improve scrollbar appearance on mobile */
.mobile-device ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.mobile-device ::-webkit-scrollbar-thumb {
    background: rgba(0, 128, 128, 0.5);
    border-radius: 10px;
}

.mobile-device ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

/* Fix facility cards for better touch interaction */
.mobile-device .facility-hover-card {
    transition: transform 0.2s ease;
}

.mobile-device .facility-hover-card:active {
    transform: scale(0.98);
}