/* ==========================================================================
   MOBILE RESPONSIVE ENHANCEMENTS 2026
   Mobile-First Design Overrides & Fixes
   ========================================================================== */

/* === GLOBAL FIXES === */
html, body {
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
    -webkit-text-size-adjust: 100%; /* Prevent font scaling on iOS landscape */
}

/* Ensure all images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Minimum touch target size for interactive elements */
button, a, input, select, textarea {
    min-height: 44px; /* Apple's recommended minimum */
    min-width: 44px;
}

/* === HEADER & NAVIGATION === */

/* Sticky Header */
@media (max-width: 768px) {
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
        width: 100%;
    }

    /* Header Top Section breakdown */
    .header-top {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.5rem 1rem;
        gap: 0.75rem;
    }

    /* Logo and Title */
    .village-title-container {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .village-title {
        white-space: normal; /* Allow title to wrap */
        text-align: center;
        font-size: 1.1rem; /* Adjust for readability */
    }

    /* LGD ID & Census */
    .id-center {
        width: 100%;
        margin: 0.5rem 0;
    }

    .id-value {
        font-size: 1.1rem;
        padding: 0.25rem 1rem;
    }

    /* Population Section - Stack beautifully */
    .header-population {
        display: none; /* Hide complex population stats in header on mobile to save space, move to bottom/about section if needed, or simplify */
    } 
    /* Wait, user said "Ensure every section... is properly visible". Hiding might be bad. Let's stack it. */
    .header-population {
        display: block; 
        width: 100%;
        margin-top: 0.5rem;
        padding: 0.5rem;
        background: rgba(255,255,255,0.1);
        border-radius: 8px;
    }
    
    .pop-stats-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .pop-item {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
        background: rgba(255,255,255,0.2);
        border-radius: 4px;
    }

    /* Language & Menu Button */
    .header-right {
        width: 100%;
        justify-content: space-between; /* Space out language and menu btn */
        margin-top: 0.5rem;
    }

    .seal-lang-container {
        flex-direction: row;
        gap: 1rem;
    }

    .mobile-menu-btn {
        display: flex; /* Ensure it's visible */
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        background: rgba(255,255,255,0.2);
    }
}

/* === LEADERSHIP SECTION (SCROLLABLE/GRID) === */
@media (max-width: 768px) {
    .leadership-row {
        padding: 0.5rem 0;
        overflow: visible;
    }

    /* Grid Layout for Leadership - 2 columns on small, 3 on larger mobile */
    .leadership-inline {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 10px;
        justify-content: center;
        width: 100%;
        overflow-x: hidden; /* No horizontal scroll, use vertical stacking */
    }

    .leader-item {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 10px !important;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .leader-img {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 5px;
    }

    .leader-info p {
        font-size: 0.8rem !important;
        line-height: 1.2;
    }
    
    .leader-info span {
        font-size: 0.7rem !important;
    }
}

/* === MAIN CONTENT & SECTIONS === */
@media (max-width: 768px) {
    .main-layout-wrapper {
        padding: 0 1rem; /* Reduce side padding */
        width: 100%;
    }

    .content-area {
        width: 100%;
    }

    /* Sections */
    section {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
        border-radius: 12px;
    }

    .section-title {
        font-size: 1.5rem;
        text-align: center;
    }

    /* Slideshow */
    .slideshow {
        height: 250px; /* Adjust height */
        margin-bottom: 2rem;
    }
    
    .slideshow img {
        object-fit: cover;
    }

    /* Grids (Schemes, Members, Gallery, Contact) */
    .gp-member-grid, 
    .member-grid, 
    .schemes-list, 
    .gallery-grid, 
    .contact-grid, 
    .info-list,
    .population-grid {
        grid-template-columns: 1fr !important; /* Stack vertically */
        gap: 1.5rem;
    }
    
    /* Slightly wider on tablet-ish mobile */
    @media (min-width: 480px) {
        .gallery-grid, 
        .gp-member-grid,
        .member-grid {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }

    /* YouTube Video */
    .video-wrapper-home iframe {
        height: 200px; /* Adjust height */
    }
}

/* === FOOTER === */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .footer ul {
        margin-left: 0;
        list-style: none; /* Remove bullets for cleaner look */
        padding: 0;
    }

    .footer li {
        margin-bottom: 0.5rem;
    }
}

/* === SIDEBAR MENU (HAMBURGER) === */
/* Improve the existing sidebar for better mobile UX */
@media (max-width: 768px) {
    .sidebar {
        width: 80%; /* Don't cover full screen */
        max-width: 300px;
    }
    
    .sidebar-nav a {
        padding: 1rem;
        font-size: 1.1rem; /* Larger touch targets */
    }
}

/* === SPECIFIC COMPONENT FIXES === */

/* Revenue Table - Horizontal Scroll */
.revenue-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    display: block;
}

.revenue-services-table {
    min-width: 600px; /* Force scroll if needed */
}

/* Contact Cards */
.contact-card {
    padding: 1.5rem;
}

/* Scheme Links */
.scheme-link {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
}

.scheme-icon {
    margin-right: 0;
    margin-bottom: 0.5rem;
}

/* === UTILITIES === */
.mobile-hidden {
    display: none !important;
}

.mobile-visible {
    display: block !important;
}

/* Padding adjustments for cleaner UI */
.main-content-grid > div {
    margin-bottom: 1rem;
}
