/* ===================================================================
   FLOTILLA TRACKER - COMPREHENSIVE MOBILE LAYOUT FIXES
   Resolves all mobile layout issues across all pages
   Load this AFTER all other stylesheets
   =================================================================== */

/* ===================================================================
   CRITICAL MOBILE VIEWPORT AND BASE FIXES
   =================================================================== */

/* Ensure proper mobile viewport behavior */
@viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 5.0;
    user-scalable: yes;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Prevent horizontal scrolling globally */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Fix body layout issues on mobile */
@media (max-width: 991px) {
    body {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
        overflow-x: hidden !important;
    }
    
    /* Simplify complex backgrounds on mobile */
    body::before {
        display: none !important;
    }
    
    body {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        background-attachment: scroll !important;
    }
}

/* ===================================================================
   HEADER AND NAVIGATION MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 1030 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(15px) !important;
        border-bottom: 1px solid #e5e7eb !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .nav-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem 1.5rem !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        position: relative !important;
    }
    
    .brand-text {
        color: #2563eb !important;
        font-weight: 700 !important;
        font-size: 1.25rem !important;
        text-shadow: none !important;
        background: none !important;
        -webkit-text-fill-color: #2563eb !important;
    }
}

/* ===================================================================
   MAIN CONTENT MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    .main-content {
        padding-top: 80px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        background: transparent !important;
        overflow-x: hidden !important;
    }
    
    /* Container fixes */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        box-sizing: border-box !important;
    }
    
    /* Section fixes */
    section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 2rem 0 !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}

/* ===================================================================
   HERO SECTIONS MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    .hero-section,
    .page-hero,
    .legal-hero {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 2rem 1rem !important;
        border-radius: 0 !important;
        background: rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(15px) !important;
        border: none !important;
        text-align: center !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    /* Remove complex animations and effects on mobile */
    .hero-section::before,
    .page-hero::before,
    .legal-hero::before {
        display: none !important;
    }
    
    .hero-title,
    .page-title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        color: white !important;
        background: none !important;
        -webkit-text-fill-color: white !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
        margin-bottom: 1rem !important;
        animation: none !important;
    }
    
    .hero-description,
    .page-description {
        font-size: 1rem !important;
        line-height: 1.5 !important;
        color: rgba(255, 255, 255, 0.9) !important;
        margin: 0 auto !important;
        padding: 0 1rem !important;
        max-width: 100% !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    }
    
    .hero-subtitle {
        font-size: 1.1rem !important;
        color: rgba(255, 255, 255, 0.8) !important;
        background: none !important;
        -webkit-text-fill-color: rgba(255, 255, 255, 0.8) !important;
    }
}

/* ===================================================================
   CONTENT SECTIONS MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    /* Grid layouts */
    .content-grid,
    .features-grid,
    .values-grid,
    .technology-grid,
    .team-grid,
    .commitment-grid,
    .contact-options-grid,
    .stats-showcase,
    .mission-stats {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Cards and components */
    .feature-card,
    .value-card,
    .tech-card,
    .team-card,
    .commitment-card,
    .contact-option,
    .stat-card,
    .showcase-stat {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 1rem 0 !important;
        padding: 1.5rem !important;
        box-sizing: border-box !important;
        background: white !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Typography fixes */
    .section-title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        text-align: center !important;
        margin-bottom: 1rem !important;
        color: #1e293b !important;
    }
    
    .section-description {
        font-size: 1rem !important;
        line-height: 1.5 !important;
        text-align: center !important;
        color: #64748b !important;
        margin-bottom: 1.5rem !important;
        padding: 0 1rem !important;
    }
}

/* ===================================================================
   FORM ELEMENTS MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    .contact-form-container,
    .form-container {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .form-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 2rem 0 !important;
        padding: 1.5rem !important;
        box-sizing: border-box !important;
    }
    
    .form-group {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .form-control,
    input,
    textarea,
    select {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.75rem !important;
        font-size: 1rem !important;
        border: 1px solid #d1d5db !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }
    
    .btn,
    button {
        width: 100% !important;
        max-width: 300px !important;
        margin: 0.5rem auto !important;
        display: block !important;
        text-align: center !important;
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
        border-radius: 8px !important;
    }
}

/* ===================================================================
   BREADCRUMB MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    .breadcrumb {
        width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .breadcrumb-list {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.5rem !important;
        font-size: 0.9rem !important;
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* ===================================================================
   CTA SECTIONS MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    .cta-section {
        padding: 3rem 0 !important;
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .cta-title {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        color: white !important;
        margin-bottom: 1rem !important;
    }
    
    .cta-description {
        font-size: 1rem !important;
        line-height: 1.5 !important;
        color: rgba(255, 255, 255, 0.9) !important;
        padding: 0 1rem !important;
        margin-bottom: 2rem !important;
    }
    
    .cta-actions,
    .hero-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    
    .cta-actions .btn,
    .hero-actions .btn {
        width: 100% !important;
        max-width: 280px !important;
        margin: 0 !important;
    }
}

/* ===================================================================
   FOOTER MOBILE FIXES
   =================================================================== */
@media (max-width: 991px) {
    .footer {
        width: 100% !important;
        max-width: 100% !important;
        padding: 2rem 0 1rem !important;
        background: #1e293b !important;
        color: white !important;
    }
    
    .footer-content {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center !important;
    }
    
    .footer-section {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .footer-bottom {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
        padding-top: 2rem !important;
        border-top: 1px solid #374151 !important;
    }
    
    .footer-bottom-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: center !important;
    }
}

/* ===================================================================
   SPECIFIC MOBILE SCREEN SIZE FIXES
   =================================================================== */

/* Small mobile devices (480px and below) */
@media (max-width: 480px) {
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    .hero-title,
    .page-title {
        font-size: 1.75rem !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
    }
    
    .hero-description,
    .page-description,
    .section-description {
        font-size: 0.95rem !important;
        padding: 0 0.5rem !important;
    }
    
    .feature-card,
    .value-card,
    .tech-card,
    .team-card,
    .commitment-card,
    .contact-option {
        padding: 1rem !important;
    }
    
    section {
        padding: 1.5rem 0 !important;
    }
}

/* Extra small mobile devices (360px and below) */
@media (max-width: 360px) {
    .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .hero-title,
    .page-title {
        font-size: 1.5rem !important;
    }
    
    .nav-container {
        padding: 0.75rem 1rem !important;
    }
    
    .brand-text {
        font-size: 1.1rem !important;
    }
}

/* ===================================================================
   SPECIAL FIXES FOR SPECIFIC ELEMENTS
   =================================================================== */

/* Mission points and similar content */
@media (max-width: 991px) {
    .mission-points,
    .values-list {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .mission-point,
    .value-item {
        display: flex !important;
        align-items: flex-start !important;
        gap: 1rem !important;
        margin-bottom: 1.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .point-icon {
        flex-shrink: 0 !important;
        width: 50px !important;
        height: 50px !important;
    }
    
    .point-content {
        flex: 1 !important;
        min-width: 0 !important;
    }
}

/* Visual elements */
@media (max-width: 991px) {
    .visual-element {
        width: 100% !important;
        max-width: 350px !important;
        height: 200px !important;
        margin: 0 auto !important;
        font-size: 2rem !important;
    }
    
    .content-visual {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        margin-top: 2rem !important;
    }
}

/* Social links */
@media (max-width: 991px) {
    .social-links {
        display: flex !important;
        justify-content: center !important;
        gap: 1rem !important;
        flex-wrap: wrap !important;
    }
    
    .social-link {
        flex-shrink: 0 !important;
    }
}

/* ===================================================================
   IFRAME AND EMBEDDED CONTENT FIXES
   =================================================================== */
@media (max-width: 991px) {
    .tracker-section,
    .tracker-container,
    .tracker-embed-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 1rem !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    .tracker-iframe {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 400px !important;
        border: none !important;
        border-radius: 8px !important;
    }
}

/* ===================================================================
   ANIMATION AND TRANSFORM FIXES FOR MOBILE
   =================================================================== */
@media (max-width: 991px) {
    /* Disable potentially problematic animations on mobile */
    .hero-section,
    .page-hero,
    .legal-hero,
    .hero-title,
    .page-title {
        animation: none !important;
        transform: none !important;
    }
    
    /* Keep only safe hover effects */
    .feature-card:hover,
    .value-card:hover,
    .tech-card:hover,
    .team-card:hover,
    .commitment-card:hover,
    .contact-option:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15) !important;
    }
}

/* ===================================================================
   ACCESSIBILITY AND TOUCH IMPROVEMENTS
   =================================================================== */
@media (max-width: 991px) and (hover: none) and (pointer: coarse) {
    /* Touch-friendly button sizes */
    .btn,
    button,
    .nav-toggle,
    .social-link {
        min-height: 44px !important;
        min-width: 44px !important;
        touch-action: manipulation !important;
    }
    
    /* Improve touch targets */
    .nav-link {
        padding: 1rem 1.5rem !important;
    }
    
    /* Remove hover effects on touch devices */
    .feature-card:hover,
    .value-card:hover,
    .tech-card:hover,
    .team-card:hover,
    .commitment-card:hover,
    .contact-option:hover {
        transform: none !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    }
}

/* ===================================================================
   FINAL OVERRIDES FOR STUBBORN ELEMENTS
   =================================================================== */
@media (max-width: 991px) {
    /* Ensure no elements escape container bounds */
    * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Force proper text wrapping */
    h1, h2, h3, h4, h5, h6, p, div, span {
        word-wrap: break-word !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Prevent any fixed positioning issues */
    .main-content * {
        position: relative !important;
    }
    
    .main-content .header {
        position: fixed !important;
    }
}

/* ===================================================================
   PRINT MEDIA FIXES
   =================================================================== */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .header,
    .nav-menu,
    .social-links {
        display: none !important;
    }
    
    .main-content {
        padding-top: 0 !important;
    }
}
