/* =========================================
   GLOBAL MOBILE RESPONSIVENESS OVERRIDES
   ========================================= */

@media (max-width: 768px) {
    /* 1. Prevent horizontal scrolling */
    body, html {
        overflow-x: hidden !important;
        width: 100% !important;
    }

    /* 2. Force all grids to stack in 1 column on mobile */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr 1fr"],
    div[style*="grid-template-columns: repeat(3, 1fr)"],
    div[style*="grid-template-columns: repeat(4, 1fr)"],
    div[style*="grid-template-columns: 1.2fr 0.8fr"],
    div[style*="grid-template-columns: 1.3fr 0.7fr"],
    div[style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }

    /* 3. Scale down massive headings */
    h1 { font-size: 2rem !important; line-height: 1.3 !important; }
    h2 { font-size: 1.6rem !important; line-height: 1.3 !important; }
    h3 { font-size: 1.3rem !important; }
    
    /* 4. Reduce excessive padding on sections */
    section {
        padding: 40px 15px !important;
    }

    /* 5. Make all images fluid */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* 6. Fix Tables (allow horizontal scroll) */
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    table {
        min-width: 600px !important; /* Forces scroll instead of squishing */
    }

    /* 7. Hero Section Adjustments */
    .hero-slider, .hero-slide {
        min-height: 60vh !important;
        height: auto !important;
        padding: 60px 20px !important;
    }
    .hero-content h1 {
        font-size: 1.8rem !important;
    }
    .hero-actions {
        flex-direction: column !important;
        width: 100% !important;
    }
    .hero-btn-primary, .hero-btn-secondary {
        width: 100% !important;
        text-align: center !important;
    }

    /* 8. Form Elements */
    .form-grid {
        grid-template-columns: 1fr !important;
    }
    input, select, textarea, button {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* 9. Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 15px !important;
    }

    /* 10. Facility Cards (reverse order so image is on top) */
    div[style*="order: 2"] {
        order: 0 !important;
        min-height: 250px !important;
    }
    div[style*="order: 1"] {
        order: 0 !important;
        padding: 30px 20px !important;
    }
}

/* Small Mobile Phones (iPhone SE, etc.) */
@media (max-width: 480px) {
    h1 { font-size: 1.6rem !important; }
    h2 { font-size: 1.4rem !important; }
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}