/**
 * Mobile Optimization CSS
 * Ensures perfect mobile experience and Google Mobile-Friendly compliance
 */

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    /* Navigation Optimization */
    .mobile-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: white;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    /* Touch-friendly buttons */
    .btn-mobile {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
        font-size: 16px;
        touch-action: manipulation;
    }
    
    /* Optimize text size for mobile */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    /* Prevent horizontal scroll */
    .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Mobile carousel optimization */
    .carousel-item {
        min-height: 300px;
    }
    
    /* Mobile-friendly forms */
    input, textarea, select {
        font-size: 16px;
        padding: 12px;
        border-radius: 8px;
        border: 2px solid #e5e7eb;
    }
    
    /* Mobile spacing */
    .mobile-spacing {
        margin-bottom: 20px;
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Mobile typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    h5 { font-size: 1.125rem; }
    h6 { font-size: 1rem; }
}

/* Tablet Optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .tablet-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
    /* Reduce animations on mobile */
    * {
        animation-duration: 0.3s;
        transition-duration: 0.3s;
    }
    
    /* Optimize scrolling */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Mobile-friendly shadows */
    .mobile-shadow {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Touch-friendly hover states */
    .hover-effect:hover {
        transform: none;
    }
    
    /* Touch-friendly links */
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Mobile Viewport Optimization */
@media (max-width: 480px) {
    /* Extra small mobile devices */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Compact mobile layout */
    .mobile-compact {
        padding: 10px;
        margin: 5px;
    }
    
    /* Mobile typography adjustments */
    body {
        font-size: 14px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Mobile Accessibility */
@media (max-width: 768px) {
    /* Ensure sufficient contrast */
    .text-mobile {
        color: #1f2937;
        background: #ffffff;
    }
    
    /* Mobile focus states */
    input:focus, textarea:focus, select:focus {
        outline: 2px solid #3b82f6;
        outline-offset: 2px;
    }
    
    /* Mobile-friendly spacing */
    .mobile-section {
        padding: 20px 0;
    }
}

/* Mobile Performance */
@media (max-width: 768px) {
    /* Reduce paint complexity on mobile */
    .mobile-optimized {
        contain: layout style paint;
        will-change: auto;
    }
    
    /* Optimize mobile images */
    .mobile-image {
        content-visibility: auto;
        contain-intrinsic-size: 300px;
    }
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: white;
        transition: left 0.3s ease;
        z-index: 1001;
        overflow-y: auto;
    }
    
    .mobile-menu.open {
        left: 0;
    }
    
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Mobile Forms */
@media (max-width: 768px) {
    .mobile-form {
        padding: 20px;
    }
    
    .mobile-form input,
    .mobile-form textarea,
    .mobile-form select {
        width: 100%;
        margin-bottom: 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .mobile-form button {
        width: 100%;
        padding: 15px;
        font-size: 18px;
    }
}

/* Mobile Carousel */
@media (max-width: 768px) {
    .mobile-carousel {
        touch-action: pan-x;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }
    
    .mobile-carousel-item {
        scroll-snap-align: start;
        flex-shrink: 0;
    }
}
