/* ========================================
   MOBILE RESPONSIVE ENHANCEMENTS
   MobiSquare - Mobile First Design
   ======================================== */

/* Base Mobile Styles */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

body {
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.6;
}

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Responsive Tables */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Navigation Fixes */
@media (max-width: 768px) {
    /* Ensure header doesn't overlap content */
    body {
        padding-top: 70px;
    }
    
    /* Navigation */
    .sticky-nav {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999;
    }
    
    /* Hero Sections */
    .carousel-item img {
        min-height: 300px;
        max-height: 400px;
        object-fit: cover;
    }
    
    /* Spacing adjustments */
    section {
        padding: 3rem 1rem !important;
    }
    
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Form Elements */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px !important;
        width: 100%;
    }
    
    /* Buttons */
    button,
    .btn,
    a.btn {
        padding: 12px 20px !important;
        font-size: 14px;
        width: 100%;
        text-align: center;
    }
    
    /* Cards & Grid */
    .grid > * {
        margin-bottom: 1rem;
    }
    
    /* Modal & Popups */
    .modal-content,
    .popup-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
    }
    
    /* Footer */
    footer {
        text-align: center;
    }
    
    footer .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }
    
    /* Prevent horizontal scroll */
    .container,
    .max-w-7xl {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Touch-friendly sizing */
    a, button, .clickable {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Tablet Styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    h1 {
        font-size: 2.5rem !important;
    }
    
    h2 {
        font-size: 2rem !important;
    }
}

/* Small Mobile (320px - 480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    /* Tighter spacing on small screens */
    section {
        padding: 2rem 0.75rem !important;
    }
    
    .card,
    .box {
        padding: 1rem !important;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .carousel-item img {
        min-height: 250px;
        max-height: 300px;
    }
    
    section {
        padding: 2rem 1rem !important;
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed in future */
}

/* Responsive utility classes */
.mobile-hide {
    display: block;
}

@media (max-width: 768px) {
    .mobile-hide {
        display: none !important;
    }
    
    .mobile-show {
        display: block !important;
    }
    
    .mobile-center {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
}

/* Print styles */
@media print {
    header,
    footer,
    nav,
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
}
