/* Mobile Responsive Enhancements */
/* This file ensures proper mobile responsiveness and overrides any desktop-forcing styles */

/* Reset any forced minimum widths */
html {
    min-width: initial !important;
    width: 100% !important;
    overflow-x: auto !important; /* Allow horizontal scroll if needed */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

body {
    min-width: initial !important;
    width: 100% !important;
    overflow-x: auto !important; /* Allow horizontal scroll if needed */
    overflow-y: auto !important; /* Ensure vertical scroll works */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Ensure proper box-sizing */
* {
    box-sizing: border-box;
}

/* Container and wrapper adjustments - but NOT sections */
.container,
.wrapper,
.content,
main {
    min-width: initial !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Sections should be scrollable */
section {
    min-width: initial !important;
    width: 100% !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* Mobile-specific styles */
@media screen and (max-width: 768px) {
    /* Reset any forced desktop layouts */
    body {
        min-width: initial !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Ensure containers are responsive */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 15px !important;
        margin: 0 auto !important;
    }
    
    /* Make navigation mobile-friendly and visible */
    nav, .nav {
        width: 100% !important;
        padding: 10px 15px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important; /* Solid background for visibility */
        z-index: 99999 !important; /* Highest z-index to stay on top */
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }
    
    /* Ensure nav container is visible */
    .nav-container {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding: 0 15px !important;
    }
    
    /* Hamburger menu button */
    .hamburger-menu {
        display: block !important;
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        padding: 10px !important;
        z-index: 100000 !important; /* Higher than nav to ensure clickability */
        position: relative !important;
    }
    
    .hamburger-menu span {
        display: block !important;
        width: 25px !important;
        height: 3px !important;
        background-color: #333 !important;
        margin: 5px 0 !important;
        transition: 0.3s !important;
    }
    
    /* Hamburger animation when active */
    .hamburger-menu.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px) !important;
    }
    
    .hamburger-menu.active span:nth-child(2) {
        opacity: 0 !important;
    }
    
    .hamburger-menu.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px) !important;
    }
    
    /* Mobile menu styles */
    .nav-links {
        display: none !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        flex-direction: column !important;
        padding: 20px !important;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important;
        z-index: 99998 !important; /* Just below hamburger button */
        max-height: calc(100vh - 80px) !important;
        overflow-y: auto !important; /* Allow scrolling if menu is long */
    }
    
    /* Show menu when active */
    .nav-links.active {
        display: flex !important;
    }
    
    .nav-links li {
        margin: 10px 0 !important;
        width: 100% !important;
    }
    
    .nav-links a {
        display: block !important;
        padding: 10px !important;
        width: 100% !important;
        text-align: left !important;
    }
    
    /* Add padding to body to account for fixed nav */
    body {
        padding-top: 80px !important; /* Increased padding */
    }
    
    /* Push down any other fixed/absolute elements that might overlap */
    .hero, .hero-section, header, .header {
        margin-top: 60px !important;
        z-index: 1 !important; /* Ensure they're below nav */
    }
    
    /* Ensure all sections are below navigation */
    section:first-of-type {
        padding-top: 20px !important;
    }
    
    /* Responsive text */
    h1 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
        line-height: 1.4 !important;
    }
    
    p, li {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
    
    /* Make images responsive */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Responsive tables */
    table {
        width: 100% !important;
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Responsive forms */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Button responsiveness */
    button,
    .btn,
    .button {
        width: 100% !important;
        max-width: 300px !important;
        margin: 10px auto !important;
        display: block !important;
    }
    
    /* Fix overflow issues while allowing scroll */
    .section,
    .hero,
    .content-section {
        overflow-x: auto !important; /* Allow horizontal scroll if needed */
        overflow-y: visible !important; /* Allow vertical content to be visible */
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Responsive grid */
    .grid,
    .row {
        display: block !important;
        width: 100% !important;
    }

    .col,
    .column {
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    /* Force ALL multi-column grids to single column */
    .feature-grid,
    .benefits-grid,
    .teams-grid,
    .category-grid,
    .use-cases-grid,
    .footer-grid,
    .contact-grid,
    .stats-grid,
    [class*="grid"] {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    /* Force inline style grids to single column */
    div[style*="display: grid"],
    div[style*="display:grid"] {
        display: block !important;
    }

    div[style*="display: grid"] > *,
    div[style*="display:grid"] > * {
        width: 100% !important;
        margin-bottom: 15px !important;
    }

    /* Fix flex layouts that might overflow */
    div[style*="display: flex"],
    div[style*="display:flex"] {
        flex-wrap: wrap !important;
    }

    div[style*="display: flex"] > *,
    div[style*="display:flex"] > * {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }

    /* Fix any element with inline width styles */
    [style*="width:"][style*="px"],
    [style*="min-width:"][style*="px"] {
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
    }

    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }

    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    /* Even smaller font sizes for very small screens */
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    p, li {
        font-size: 0.9rem !important;
    }
    
    /* Tighter padding on small screens */
    .container {
        padding: 0 10px !important;
    }
}

/* Tablet styles */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .container {
        max-width: 100% !important;
        padding: 0 30px !important;
    }
    
    /* Two-column layout for tablets */
    .grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

/* Ensure scrollability */
@media screen and (max-width: 1024px) {
    /* Fix any position fixed elements that might cause issues */
    .fixed-element {
        position: relative !important;
    }

    /* Ensure footer is visible */
    footer {
        position: relative !important;
        width: 100% !important;
    }

    /* Force all grid layouts to single column on mobile */
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns:repeat(2"] {
        grid-template-columns: 1fr !important;
    }

    /* Fix any fixed-width elements */
    [style*="width: 1200px"],
    [style*="width: 1400px"],
    [style*="width: 1000px"],
    [style*="min-width: 1200px"],
    [style*="min-width: 1400px"],
    [style*="min-width: 1000px"] {
        width: 100% !important;
        min-width: unset !important;
        max-width: 100% !important;
    }
}

/* Accessibility improvements for touch devices */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    a, button, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    a:hover,
    button:hover {
        background: inherit;
        color: inherit;
    }
}

/* Desktop styles - ensure normal navigation */
@media screen and (min-width: 769px) {
    /* Hide hamburger on desktop */
    .hamburger-menu {
        display: none !important;
    }
    
    /* Show normal navigation */
    .nav-links {
        display: flex !important;
        position: static !important;
        flex-direction: row !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }
    
    .nav-links li {
        margin: 0 15px !important;
        width: auto !important;
    }
    
    .nav-links a {
        padding: 5px 10px !important;
        width: auto !important;
    }
    
    /* Reset body padding on desktop */
    body {
        padding-top: 0 !important;
    }
}

/* Print styles */
@media print {
    * {
        min-width: initial !important;
        max-width: 100% !important;
    }
}