/**
 * Enhanced Mobile Styles
 * Advanced mobile-specific CSS optimizations
 */

/* Additional mobile breakpoints for better control */
@media (max-width: 480px) {
    /* Small mobile phones */
    .hero-logo {
        max-width: 90% !important;
        max-width: min(400px, 90%) !important;
    }
    
    .text-cycling-wrapper {
        height: auto !important;
        min-height: 80px !important;
    }
    
    .text-cycling-wrapper p {
        font-size: 1.25rem !important;
        line-height: 1.5 !important;
    }
    
    .reservation-form {
        padding: 1rem !important;
    }
    
    .service-card {
        margin-bottom: 1rem;
    }
    
    .stats-counter {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 640px) {
    /* Mobile landscape and small tablets */
    .mobile-nav-link {
        padding: 1rem 0.75rem;
        font-size: 1.1rem;
    }
    
    .hero-content {
        padding: 1rem;
    }
    
    .glass-effect {
        backdrop-filter: blur(5px); /* Reduced blur for better performance on mobile */
        -webkit-backdrop-filter: blur(5px);
    }
}

/* Touch-friendly improvements - ONLY ON MOBILE/TABLET */
@media (max-width: 1024px) {
    .btn, .nav-link, .mobile-nav-link {
        min-height: 44px; /* Apple's recommended minimum touch target */
        min-width: 44px;
    }
}

/* Improved form inputs for mobile */
@media (max-width: 768px) {
    .form-input, .form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
    }
    
    select.form-input {
        font-size: 16px;
        min-height: 48px;
    }
}

/* Mobile-specific animations (reduced for performance) */
.reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Orientation-specific styles */
.orientation-landscape .hero-content {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.orientation-portrait .hero-logo {
    max-width: 80%;
}

/* Mobile-optimized grid layouts */
@media (max-width: 640px) {
    .grid.auto-mobile {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* Touch gesture feedback */
.swipe-container {
    touch-action: pan-y; /* Allow vertical scrolling but handle horizontal swipes */
    user-select: none;
}

.swipe-hint {
    position: relative;
}

.swipe-hint::after {
    content: '← Swipe →';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    color: #666;
    opacity: 0.7;
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Mobile-specific loading states */
.mobile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.mobile-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--khudra-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Improved mobile scrollbars */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 6px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--khudra-primary);
        border-radius: 3px;
    }
}

/* Mobile-safe z-index layers */
.mobile-menu-overlay {
    z-index: 9999;
}

.mobile-modal {
    z-index: 10000;
}

.mobile-notification {
    z-index: 10001;
}

/* Safe area support for newer devices */
@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));
    }
}

/* Mobile-optimized image containers */
.mobile-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.mobile-image-container img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.mobile-image-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

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

/* Mobile-specific utility classes */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-text-center {
        text-align: center;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-no-margin {
        margin: 0 !important;
    }
    
    .mobile-small-padding {
        padding: 0.5rem !important;
    }
}

/* Performance optimizations for mobile */
.operations-paused * {
    animation-play-state: paused !important;
}

/* Mobile-friendly print styles */
@media print {
    .mobile-nav-link,
    .mobile-menu-button,
    #mobile-menu {
        display: none !important;
    }
}