/* Mobile-specific CSS fixes */

/* Ensure proper touch target sizes on mobile */
@media (max-width: 768px) {
    /* Fix phone buttons to be easily clickable */
    a[href^="tel:"] {
        display: inline-block;
        min-height: 48px !important;
        min-width: 48px !important;
        position: relative;
        z-index: 10 !important;
        padding: 12px 20px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Improve button touch targets */
    .btn {
        min-height: 48px !important;
        padding: 12px 24px !important;
        font-size: 16px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .btn-lg {
        min-height: 56px !important;
        padding: 14px 28px !important;
        font-size: 18px !important;
    }
    
    /* Fix navbar toggler */
    .navbar-toggler {
        min-width: 48px !important;
        min-height: 48px !important;
        padding: 8px !important;
        border: 2px solid rgba(0,0,0,0.1) !important;
        position: relative;
        z-index: 1040 !important;
        touch-action: manipulation;
    }
    
    .navbar-toggler:focus {
        box-shadow: 0 0 0 3px rgba(0,123,255,0.25) !important;
    }
    
    /* Ensure navbar collapse works properly */
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        z-index: 1030;
        padding: 1rem;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .navbar-collapse.show {
        display: block !important;
    }
    
    .navbar-collapse:not(.show) {
        display: none !important;
    }
    
    /* Improve nav links on mobile */
    .navbar-nav .nav-link {
        padding: 12px 16px !important;
        font-size: 16px !important;
        border-bottom: 1px solid #f0f0f0;
        touch-action: manipulation;
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Fix alphabet navigation buttons */
    .letter-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 8px !important;
        font-size: 14px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        border: 2px solid #dee2e6 !important;
    }
    
    .letter-btn.active {
        background-color: var(--primary-color) !important;
        color: white !important;
        border-color: var(--primary-color) !important;
    }
    
    .letter-btn:not(.disabled):active {
        transform: scale(0.95);
        background-color: #f0f0f0;
    }
    
    .letter-btn.disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }
    
    /* Fix alphabet container spacing */
    .alphabet-container {
        padding: 15px 10px !important;
    }
    
    .alphabet-row {
        gap: 4px !important;
        margin-bottom: 6px !important;
    }
    
    /* Ensure cities links are clickable */
    .city-link {
        display: inline-block;
        padding: 8px 4px !important;
        min-height: 44px !important;
        line-height: 1.8 !important;
        touch-action: manipulation;
    }
    
    /* Prevent zoom on double tap */
    * {
        touch-action: manipulation;
    }
    
    /* Fix hero buttons stacking */
    .hero-section .d-flex {
        flex-direction: column !important;
    }
    
    .hero-section .btn {
        width: 100% !important;
        margin-bottom: 12px !important;
    }
    
    /* Remove hover effects on touch devices */
    @media (hover: none) {
        .btn:hover {
            transform: none !important;
            background-color: inherit !important;
        }
        
        .letter-btn:hover:not(.active) {
            background: white !important;
        }
        
        a:hover {
            color: inherit !important;
        }
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    a[href^="tel:"] {
        -webkit-user-select: none;
        user-select: none;
    }
    
    .btn, .letter-btn {
        -webkit-appearance: none;
        appearance: none;
    }
}

/* Ensure proper z-index stacking */
.navbar {
    z-index: 1040 !important;
}

.navbar-collapse {
    z-index: 1035 !important;
}

.btn-accent {
    position: relative;
    z-index: 5;
}

/* High contrast mode for better visibility */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor !important;
    }
    
    .letter-btn {
        border-width: 2px !important;
    }
}