/**
 * Mobile Enhancements - LostFound
 * Enhanced mobile experience and touch optimizations
 * Version: 1.0.0
 */

/* ===== MOBILE-FIRST BASE STYLES ===== */

/* Touch-friendly sizing */
.touch-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced tap targets */
.btn-primary,
.btn-secondary {
    min-height: 44px;
    touch-action: manipulation;
}

/* Prevent text selection on interactive elements */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===== MOBILE NAVIGATION ENHANCEMENTS ===== */

@media (max-width: 768px) {
    /* Mobile navigation optimization */
    .mobile-nav-optimized {
        position: sticky;
        top: 0;
        z-index: 1000;
        backdrop-filter: blur(20px);
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    /* Mobile menu button enhancement */
    .mobile-menu-btn {
        padding: 12px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 8px;
        transition: background-color 0.2s ease;
    }
    
    .mobile-menu-btn:hover,
    .mobile-menu-btn:focus {
        background-color: rgba(59, 130, 246, 0.1);
    }
    
    /* Mobile dropdown improvements */
    .mobile-dropdown {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-nav-item {
        padding: 16px 20px;
        border-bottom: 1px solid #f3f4f6;
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 16px;
        min-height: 56px;
    }
}

/* ===== MOBILE HERO SECTION ===== */

@media (max-width: 768px) {
    .hero-bg {
        min-height: 60vh;
        padding-top: 80px;
        background-attachment: scroll; /* Fix for mobile */
    }
    
    .hero-content-mobile {
        text-align: center;
        padding: 0 16px;
    }
    
    .hero-title-mobile {
        font-size: 2.5rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle-mobile {
        font-size: 1.125rem;
        line-height: 1.6;
        margin-bottom: 2rem;
    }
    
    .hero-buttons-mobile {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .hero-buttons-mobile .btn-primary,
    .hero-buttons-mobile .btn-secondary {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        border-radius: 12px;
    }
}

/* ===== MOBILE CARD OPTIMIZATIONS ===== */

@media (max-width: 768px) {
    .card-mobile {
        border-radius: 16px;
        margin-bottom: 16px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }
    
    .card-mobile:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }
    
    /* Statistics cards mobile layout */
    .stats-mobile {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 16px;
    }
    
    .stat-card-mobile {
        padding: 20px 16px;
        text-align: center;
    }
    
    .stat-card-mobile .feature-icon {
        width: 48px;
        height: 48px;
        margin: 0 auto 12px;
    }
    
    .stat-card-mobile .stat-value {
        font-size: 1.75rem;
        font-weight: 700;
        margin-bottom: 4px;
    }
    
    .stat-card-mobile .stat-label {
        font-size: 0.875rem;
        color: #6b7280;
    }
}

/* ===== MOBILE TESTIMONIALS ===== */

@media (max-width: 768px) {
    .testimonials-mobile {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 16px;
    }
    
    .testimonial-card-mobile {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .testimonial-quote-mobile {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 20px;
    }
    
    .testimonial-author-mobile {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .testimonial-avatar-mobile {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        flex-shrink: 0;
    }
}

/* ===== MOBILE TOUCH OPTIMIZATIONS ===== */

/* Larger touch targets for mobile */
@media (max-width: 768px) {
    .touch-optimized {
        padding: 12px 16px;
        min-height: 48px;
    }
    
    /* Mobile-specific button sizing */
    .btn-mobile {
        padding: 14px 24px;
        font-size: 16px;
        border-radius: 12px;
        min-height: 48px;
        font-weight: 600;
    }
    
    .btn-mobile-sm {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 40px;
    }
    
    .btn-mobile-lg {
        padding: 18px 32px;
        font-size: 18px;
        min-height: 56px;
    }
}

/* ===== MOBILE FORM ENHANCEMENTS ===== */

@media (max-width: 768px) {
    .form-mobile {
        padding: 0 16px;
    }
    
    .form-input-mobile {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 12px;
        min-height: 48px;
    }
    
    .form-input-mobile:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    }
    
    .form-group-mobile {
        margin-bottom: 20px;
    }
    
    .form-label-mobile {
        font-size: 14px;
        font-weight: 600;
        color: #374151;
        margin-bottom: 8px;
        display: block;
    }
}

/* ===== MOBILE MODAL OPTIMIZATIONS ===== */

@media (max-width: 768px) {
    .modal-mobile {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        border-radius: 0;
        margin: 0;
        max-width: none;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-header-mobile {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding: 16px 20px;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .modal-close-mobile {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #f3f4f6;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #6b7280;
    }
    
    .modal-body-mobile {
        padding: 20px;
    }
    
    .modal-footer-mobile {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px 20px;
        border-top: 1px solid #e5e7eb;
        display: flex;
        gap: 12px;
    }
    
    .modal-footer-mobile .btn-primary,
    .modal-footer-mobile .btn-secondary {
        flex: 1;
    }
}

/* ===== MOBILE SEARCH OPTIMIZATIONS ===== */

@media (max-width: 768px) {
    .search-mobile {
        position: sticky;
        top: 64px;
        z-index: 100;
        background: white;
        padding: 16px;
        border-bottom: 1px solid #e5e7eb;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .search-input-mobile {
        width: 100%;
        padding: 12px 16px 12px 44px;
        border: 1px solid #d1d5db;
        border-radius: 24px;
        font-size: 16px;
        background: #f9fafb;
        position: relative;
    }
    
    .search-icon-mobile {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        color: #6b7280;
        pointer-events: none;
    }
    
    .search-results-mobile {
        padding: 16px;
    }
    
    .search-result-item-mobile {
        padding: 16px;
        border-bottom: 1px solid #f3f4f6;
        border-radius: 12px;
        margin-bottom: 12px;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
}

/* ===== MOBILE IMAGE GALLERY ===== */

@media (max-width: 768px) {
    .gallery-mobile {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 16px;
    }
    
    .gallery-item-mobile {
        aspect-ratio: 1;
        border-radius: 12px;
        overflow: hidden;
        position: relative;
    }
    
    .gallery-image-mobile {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }
    
    .gallery-item-mobile:active .gallery-image-mobile {
        transform: scale(0.95);
    }
    
    .gallery-overlay-mobile {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
        color: white;
        padding: 12px 8px 8px;
        font-size: 12px;
        font-weight: 500;
    }
}

/* ===== MOBILE ANIMATIONS ===== */

@media (max-width: 768px) {
    /* Simplified animations for mobile */
    .mobile-fade-in {
        opacity: 0;
        transform: translateY(20px);
        animation: mobileFadeIn 0.6s ease forwards;
    }
    
    @keyframes mobileFadeIn {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .mobile-slide-up {
        transform: translateY(100%);
        animation: mobileSlideUp 0.4s ease forwards;
    }
    
    @keyframes mobileSlideUp {
        to {
            transform: translateY(0);
        }
    }
    
    /* Disable complex animations on mobile */
    .floating-animation,
    .complex-animation {
        animation: none !important;
        transform: none !important;
    }
}

/* ===== MOBILE SPECIFIC UTILITIES ===== */

@media (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    .mobile-flex {
        display: flex !important;
    }
    
    .mobile-grid {
        display: grid !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
    
    .mobile-text-left {
        text-align: left !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-padding {
        padding: 16px !important;
    }
    
    .mobile-margin-bottom {
        margin-bottom: 16px !important;
    }
}

/* ===== MOBILE ACCESSIBILITY ===== */

@media (max-width: 768px) {
    /* Larger focus indicators on mobile */
    .focus-mobile:focus {
        outline: 3px solid #3b82f6;
        outline-offset: 2px;
    }
    
    /* Better contrast for mobile */
    .text-mobile-contrast {
        color: #1f2937;
        font-weight: 500;
    }
    
    /* Mobile-specific skip links */
    .skip-link-mobile {
        position: absolute;
        top: -40px;
        left: 16px;
        background: #1f2937;
        color: white;
        padding: 12px 16px;
        border-radius: 8px;
        text-decoration: none;
        font-weight: 600;
        z-index: 10000;
        transition: top 0.2s ease;
    }
    
    .skip-link-mobile:focus {
        top: 16px;
    }
}

/* ===== PWA MOBILE ENHANCEMENTS ===== */

@media (max-width: 768px) {
    /* Safe area handling for notched devices */
    .safe-area-top {
        padding-top: env(safe-area-inset-top);
    }
    
    .safe-area-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .safe-area-left {
        padding-left: env(safe-area-inset-left);
    }
    
    .safe-area-right {
        padding-right: env(safe-area-inset-right);
    }
    
    /* Mobile app-like navigation */
    .mobile-app-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: env(safe-area-inset-bottom) 0 8px;
        z-index: 1000;
    }
    
    .mobile-app-nav-items {
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 8px 16px;
    }
    
    .mobile-app-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 12px;
        border-radius: 12px;
        transition: background-color 0.2s ease;
        text-decoration: none;
        color: #6b7280;
        font-size: 12px;
        font-weight: 500;
        min-width: 64px;
    }
    
    .mobile-app-nav-item.active {
        color: #3b82f6;
        background: rgba(59, 130, 246, 0.1);
    }
    
    .mobile-app-nav-item i {
        font-size: 20px;
        margin-bottom: 4px;
    }
}

/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */

@media (max-width: 768px) {
    /* Reduce motion for better mobile performance */
    .performance-optimized * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }
    
    /* Optimize images for mobile */
    .mobile-image-optimized {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
    }
    
    /* Reduce GPU usage on mobile */
    .mobile-cpu-friendly {
        transform: none !important;
        filter: none !important;
        backdrop-filter: none !important;
    }
}
