/* Mobile Responsive CSS */
.touch-device {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.touch-device input,
.touch-device textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* iOS */
.ios-device {
    -webkit-overflow-scrolling: touch;
}

.ios-device input[type="text"],
.ios-device input[type="email"],
.ios-device input[type="password"],
.ios-device textarea {
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
}

/* Android */
.android-device {
    text-rendering: optimizeLegibility;
}

/* Offline State */
.offline {
    filter: grayscale(50%);
}

.offline::before {
    content: "Offline Mode";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ef4444;
    color: white;
    text-align: center;
    padding: 0.5rem;
    z-index: 9999;
    font-size: 0.875rem;
}
.low-battery * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.1s !important;
}

.low-battery .animate-pulse,
.low-battery .animate-bounce,
.low-battery .animate-spin {
    animation: none !important;
}

/* Mobile Navigation */
@media (max-width: 640px) {
    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 39;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .mobile-menu {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .mobile-menu.open {
        transform: translateX(0);
    }
}

/* Responsive Typography */
.responsive-text {
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    line-height: 1.6;
}

.responsive-heading {
    font-size: clamp(1.5rem, 5vw, 3rem);
    line-height: 1.2;
}
.btn-touch {
    min-height: 48px;
    min-width: 48px;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-touch:active {
    transform: scale(0.96);
}

/* Swipe Indicators */
.swipe-hint {
    position: relative;
}

.swipe-hint::after {
    content: "← Swipe";
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    opacity: 0.8;
    animation: fade-in-out 2s infinite;
}

@keyframes fade-in-out {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.8; }
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Pull to Refresh */
.pull-to-refresh-container {
    position: relative;
    overflow: hidden;
}

.pull-to-refresh-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: #3B82F6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.pull-to-refresh-indicator.active {
    top: 20px;
}

/* Safe Area Support */
@supports (padding: max(0px)) {
    .safe-area-top {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    .safe-area-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .safe-area-left {
        padding-left: max(1rem, env(safe-area-inset-left));
    }
    
    .safe-area-right {
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Landscape Orientation */
@media (max-width: 640px) and (orientation: landscape) {
    .landscape-hide {
        display: none;
    }
    
    .hero-section {
        min-height: 100vh;
        padding-top: 3rem;
        padding-bottom: 1rem;
    }
    
    .mobile-menu {
        max-height: 80vh;
        overflow-y: auto;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-touch {
        border: 2px solid currentColor;
    }
    
    .mobile-menu {
        border: 1px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu {
        transition: none;
    }
    
    .btn-touch {
        transition: none;
    }
    
    .loading-skeleton {
        animation: none;
        background: #f0f0f0;
    }
}

/* Focus Management */
.focus-trap {
    position: relative;
}

.focus-trap::before,
.focus-trap::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Mobile-First Utilities */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-scroll {
    will-change: scroll-position;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Network Status Indicators */
.network-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #10B981;
    color: white;
    text-align: center;
    padding: 0.5rem;
    z-index: 9999;
    font-size: 0.875rem;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.network-status.offline {
    background: #EF4444;
    transform: translateY(0);
}

.network-status.slow {
    background: #F59E0B;
    transform: translateY(0);
}

/* Touch Feedback */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.touch-feedback:active::after {
    width: 200px;
    height: 200px;
}