/* ===================================
   CRITICAL MOBILE FIXES
   Ultra-aggressive fixes for mobile rendering
   =================================== */

/* Reset and base mobile styles */
* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Force proper viewport on mobile */
@media (max-width: 768px) {
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* Prevent any element from causing horizontal scroll */
    * {
        max-width: 100%;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
}

/* CRITICAL: Override ALL inline styles on mobile */
@media (max-width: 768px) {
    /* Force single column layout */
    .about-content {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        padding: 1.5rem !important;
    }
    
    /* Force proper image sizing */
    .about-image {
        width: 100% !important;
        height: 280px !important;
        margin-bottom: 1.5rem !important;
        overflow: hidden !important;
    }
    
    .about-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    /* Force text container sizing */
    .about-text {
        width: 100% !important;
        padding: 0 !important;
    }
    
    /* Force heading sizes */
    .about-text h2,
    .about-text h3,
    h1, h2, h3 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
        word-wrap: break-word !important;
    }
    
    /* Force paragraph sizing */
    .about-text p,
    p {
        font-size: 0.95rem !important;
        line-height: 1.7 !important;
        margin-bottom: 1rem !important;
        word-wrap: break-word !important;
    }
    
    /* Force button containers to stack */
    div[style*="display: flex"] {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }
    
    /* Force buttons to full width */
    .btn,
    a.btn,
    button.btn,
    [class*="btn"] {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        margin: 0.5rem 0 !important;
        padding: 1rem !important;
        text-align: center !important;
    }
    
    /* Force grid layouts to single column */
    .values-grid,
    .stats-grid,
    .card-grid,
    .features-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
        width: 100% !important;
    }
    
    /* Force cards to full width */
    .value-card,
    .stat-box,
    .card,
    .property-card,
    .feature-box {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 1rem 0 !important;
    }
    
    /* Force section padding */
    .section {
        padding: 40px 15px !important;
    }
    
    /* Force container width */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 15px !important;
    }
    
    /* Force section title sizing */
    .section-title h2 {
        font-size: 1.75rem !important;
    }
    
    .section-title p {
        font-size: 1rem !important;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    /* Even more aggressive sizing */
    .about-content {
        padding: 1rem !important;
    }
    
    .about-image {
        height: 220px !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.4rem !important;
    }
    
    h3 {
        font-size: 1.2rem !important;
    }
    
    p {
        font-size: 0.9rem !important;
    }
    
    .btn {
        padding: 0.875rem !important;
        font-size: 0.95rem !important;
    }
    
    .section {
        padding: 30px 10px !important;
    }
    
    .container {
        padding: 0 10px !important;
    }
}

/* Fix hero section specifically */
@media (max-width: 768px) {
    .hero {
        padding: 60px 20px 50px !important;
        min-height: auto !important;
    }
    
    .hero h1 {
        font-size: 1.85rem !important;
    }
    
    .hero p {
        font-size: 1rem !important;
    }
    
    /* Fix scroll down indicator on mobile */
    .scroll-indicator {
        display: none !important;
    }
    
    .scroll-indicator > div {
        bottom: 15px !important;
        font-size: 0.75rem !important;
    }
    
    .scroll-indicator p {
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .scroll-indicator i {
        font-size: 1rem !important;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 50px 15px 40px !important;
    }
    
    .hero h1 {
        font-size: 1.5rem !important;
    }
    
    .hero p {
        font-size: 0.95rem !important;
    }
    
    /* Hide scroll indicator completely on small mobile */
    .scroll-indicator {
        display: none !important;
    }
}

/* Fix founder section specifically */
@media (max-width: 768px) {
    .about-content[style*="background: white"] {
        padding: 1.5rem !important;
        margin: 0 !important;
    }
    
    .about-image[style*="position: relative"] {
        border: 3px solid white !important;
        outline: 2px solid var(--primary-green) !important;
    }
    
    .about-image div[style*="position: absolute"] {
        padding: 1rem !important;
    }
    
    .about-image div[style*="position: absolute"] h3 {
        font-size: 1.1rem !important;
    }
    
    .about-image div[style*="position: absolute"] p {
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    .about-content[style*="background: white"] {
        padding: 1rem !important;
    }
    
    .about-image[style*="position: relative"] {
        border: 2px solid white !important;
    }
}

/* Fix value cards */
@media (max-width: 768px) {
    .value-card {
        padding: 2rem 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .value-icon {
        font-size: 2.5rem !important;
    }
    
    .value-title {
        font-size: 1.35rem !important;
    }
    
    .value-text {
        font-size: 0.95rem !important;
    }
}

@media (max-width: 480px) {
    .value-card {
        padding: 1.5rem 1.25rem !important;
    }
    
    .value-icon {
        font-size: 2.25rem !important;
    }
    
    .value-title {
        font-size: 1.2rem !important;
    }
    
    .value-text {
        font-size: 0.9rem !important;
    }
}

/* Fix stats */
@media (max-width: 768px) {
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    
    .stat-box {
        padding: 1.5rem 1rem !important;
    }
    
    .stat-number {
        font-size: 2.25rem !important;
    }
    
    .stat-label {
        font-size: 0.95rem !important;
    }
}

/* Fix CTA sections */
@media (max-width: 768px) {
    section div[style*="max-width: 800px"] {
        max-width: 100% !important;
        padding: 0 15px !important;
    }
    
    section div[style*="max-width: 800px"] h2 {
        font-size: 1.75rem !important;
    }
    
    section div[style*="max-width: 800px"] p {
        font-size: 1rem !important;
    }
}

@media (max-width: 480px) {
    section div[style*="max-width: 800px"] h2 {
        font-size: 1.5rem !important;
    }
    
    section div[style*="max-width: 800px"] p {
        font-size: 0.95rem !important;
    }
}

/* Prevent text overflow */
@media (max-width: 768px) {
    * {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Prevent images from breaking layout */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Fix footer on mobile */
@media (max-width: 768px) {
    .footer-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
    }
    
    .footer-section {
        width: 100% !important;
        text-align: center !important;
    }
    
    .footer-links,
    .footer-contact {
        align-items: center !important;
    }
}

/* Ensure proper spacing */
@media (max-width: 768px) {
    .section-title {
        margin-bottom: 2rem !important;
        padding: 0 10px !important;
    }
    
    .card-content,
    .property-content {
        padding: 1.25rem !important;
    }
    
    /* Fix property badge on mobile */
    .property-badge {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
        padding: 0.35rem 0.7rem !important;
        font-size: 0.75rem !important;
        border-radius: 6px !important;
        white-space: nowrap !important;
        z-index: 10 !important;
        max-width: calc(100% - 1rem) !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

@media (max-width: 480px) {
    .section-title {
        margin-bottom: 1.5rem !important;
    }
    
    .card-content,
    .property-content {
        padding: 1rem !important;
    }
    
    /* Further reduce property badge size on small mobile */
    .property-badge {
        top: 0.4rem !important;
        right: 0.4rem !important;
        padding: 0.3rem 0.6rem !important;
        font-size: 0.7rem !important;
        border-radius: 5px !important;
    }
}

/* Fix any remaining layout issues */
@media (max-width: 768px) {
    /* Remove any negative margins */
    * {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Ensure proper box sizing */
    *,
    *::before,
    *::after {
        box-sizing: border-box !important;
    }
    
    /* CRITICAL: Ensure body doesn't interfere with fixed positioning */
    html, body {
        position: relative !important;
        transform: none !important;
        -webkit-transform: none !important;
    }
    
    /* CRITICAL: Fix floating buttons to stay visible during scroll */
    .whatsapp-float,
    .chatbot-container,
    .scroll-to-top {
        position: fixed !important;
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
    }
    
    /* Chatbot has highest priority - Right side popup */
    .chatbot-container {
        position: fixed !important;
        bottom: 15px !important;
        right: 10px !important;
        z-index: 10000 !important;
    }
    
    .chatbot-window {
        position: fixed !important;
        bottom: 80px !important;
        right: 10px !important;
        width: 90vw !important;
        max-width: 360px !important;
        height: 70vh !important;
        max-height: 500px !important;
        border-radius: 16px !important;
        z-index: 10000 !important;
    }
    
    .chatbot-messages {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* CRITICAL: Make input area HIGHLY VISIBLE */
    .chatbot-input-area {
        position: relative !important;
        background: #e2e8f0 !important;
        border-top: 3px solid #cbd5e0 !important;
        padding: 16px 12px !important;
        flex-shrink: 0 !important;
        z-index: 100 !important;
        display: flex !important;
        gap: 10px !important;
        align-items: center !important;
        min-height: 70px !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
    }
    
    .chatbot-input {
        flex: 1 !important;
        font-size: 16px !important;
        padding: 14px 18px !important;
        border: 3px solid #006B3C !important;
        background: white !important;
        color: #2d3748 !important;
        border-radius: 25px !important;
        min-height: 48px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .chatbot-send-btn {
        width: 48px !important;
        height: 48px !important;
        background: linear-gradient(135deg, #006B3C 0%, #008F4F 100%) !important;
        color: white !important;
        border: none !important;
        flex-shrink: 0 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* WhatsApp button positioned above chatbot */
    .whatsapp-float {
        bottom: 80px !important;
        right: 15px !important;
        z-index: 9999 !important;
    }
    
    /* Scroll-to-top positioned on LEFT side to avoid overlap */
    .scroll-to-top {
        bottom: 10px !important;
        left: 15px !important;
        right: auto !important;
        z-index: 9998 !important;
    }
}
