/* ========================================
   MOBILE RESPONSIVENESS ENHANCEMENTS
   Comprehensive fixes for both websites
   ======================================== */

/* ===== ENHANCED MOBILE NAVIGATION ===== */
@media (max-width: 768px) {
    /* Logo adjustments */
    .logo {
        font-size: 1.2rem !important;
        gap: 8px !important;
    }
    
    .logo img {
        height: 50px !important;
        width: 50px !important;
    }
    
    .logo span {
        font-size: 1rem !important;
        max-width: 150px;
        line-height: 1.2;
    }
    
    /* Mobile menu improvements */
    .nav-menu {
        padding: 1.5rem 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }
    
    .nav-menu li {
        padding: 0.5rem 0;
    }
    
    .nav-link {
        padding: 0.75rem 1.5rem !important;
        font-size: 1.1rem !important;
        display: block;
    }
    
    /* Hamburger menu - ensure visibility */
    .nav-toggle, .hamburger {
        display: flex !important;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 25px;
        cursor: pointer;
        z-index: 1001;
    }
    
    .nav-toggle span, .hamburger span {
        width: 100%;
        height: 3px;
        background-color: var(--primary-color, #0891b2);
        transition: all 0.3s ease;
        border-radius: 2px;
    }
}

/* ===== MOBILE FORMS ===== */
@media (max-width: 768px) {
    /* Contact form layout */
    .contact-form,
    .volunteer-form,
    #contactForm,
    #volunteerForm {
        padding: 1.5rem !important;
    }
    
    /* Form grid - stack on mobile */
    form div[style*="grid-template-columns: 1fr 1fr"],
    .form-row {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column;
        gap: 1rem !important;
    }
    
    /* Form inputs - better touch targets */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    select,
    textarea {
        min-height: 48px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.875rem !important;
    }
    
    textarea {
        min-height: 120px !important;
    }
    
    /* Form labels */
    label {
        font-size: 0.95rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Submit buttons */
    button[type="submit"],
    .btn {
        min-height: 48px !important;
        font-size: 1rem !important;
        padding: 0.875rem 1.5rem !important;
        width: 100% !important;
    }
    
    /* Contact page specific */
    div[style*="grid-template-columns: 1fr 1fr"][style*="gap: 3rem"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
}

@media (max-width: 480px) {
    input,
    select,
    textarea {
        font-size: 16px !important; /* Critical for iOS */
    }
}

/* ===== MOBILE GALLERY ===== */
@media (max-width: 768px) {
    /* Gallery grid - 2 columns on mobile */
    .gallery-grid,
    #gallery-grid,
    div[style*="grid-template-columns: repeat(auto-fill, minmax(280px, 1fr))"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    /* Gallery items */
    .gallery-item {
        height: auto !important;
    }
    
    .gallery-item img {
        height: 200px !important;
        width: 100%;
        object-fit: cover !important;
    }
    
    /* Filter buttons - wrap properly */
    .category-filters,
    .gallery-filters,
    div[style*="display: flex"][style*="justify-content: center"] {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        padding: 0 1rem;
    }
    
    .category-filter-btn,
    .gallery-filter-btn,
    button[data-category] {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
        min-width: auto !important;
    }
    
    /* Lightbox controls */
    .lightbox-close {
        font-size: 2.5rem !important;
        right: 1rem !important;
        top: 1rem !important;
        width: 50px !important;
        height: 50px !important;
    }
}

@media (max-width: 480px) {
    /* Single column on very small screens */
    .gallery-grid,
    #gallery-grid {
        grid-template-columns: 1fr !important;
    }
    
    .gallery-item img {
        height: 250px !important;
    }
}

/* ===== MOBILE HERO SECTIONS ===== */
@media (max-width: 768px) {
    /* Hero titles */
    .hero h1,
    .hero-title,
    .page-title,
    h1[style*="font-size: 3rem"] {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    /* Hero descriptions */
    .hero p,
    .hero-description,
    p[style*="font-size: 1.25rem"] {
        font-size: 1rem !important;
    }
    
    /* Hero images */
    .hero-illustration img,
    .hero img,
    img[style*="max-width: 800px"] {
        max-width: 100% !important;
        padding: 0 1rem;
    }
    
    /* Stats section */
    .stats-grid,
    .hero-stats {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .stat-number {
        font-size: 2.5rem !important;
    }
}

@media (max-width: 480px) {
    .hero h1,
    h1[style*="font-size"] {
        font-size: 1.75rem !important;
    }
    
    .stat-number {
        font-size: 2rem !important;
    }
}

/* ===== MOBILE CTA SECTIONS ===== */
@media (max-width: 768px) {
    .cta-buttons,
    .hero-buttons,
    div[style*="display: flex"][style*="gap"] a.btn {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .cta-buttons a,
    .hero-buttons a {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
    }
}

/* ===== MOBILE FOOTER ===== */
@media (max-width: 768px) {
    .footer-content,
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .social-links {
        justify-content: center !important;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-links a {
        display: inline-block;
        margin: 0 0.5rem;
    }
}

/* ===== MOBILE INFO CARDS ===== */
@media (max-width: 768px) {
    /* Contact info cards, service cards, etc. */
    div[style*="grid-template-columns: repeat(auto-fit"],
    div[style*="grid-template-columns: repeat(3"],
    .services-grid,
    .events-grid,
    .testimonials-grid,
    .contact-info-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* ===== MOBILE TYPOGRAPHY ===== */
@media (max-width: 768px) {
    .section-title,
    h2[style*="font-size: 2rem"],
    h2 {
        font-size: 1.75rem !important;
    }
    
    .section-subtitle {
        font-size: 1rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    p {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }
}

@media (max-width: 480px) {
    .section-title,
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.125rem !important;
    }
}

/* ===== MOBILE SPACING & PADDING ===== */
@media (max-width: 768px) {
    .section,
    section[style*="padding: 80px 0"] {
        padding: 3rem 0 !important;
    }
    
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Card padding */
    .service-card,
    .event-card,
    .testimonial-card,
    .opportunity-card {
        padding: 1.5rem !important;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 2rem 0 !important;
    }
    
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* ===== MOBILE IMAGES ===== */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Inline styled images */
    img[style*="max-width"] {
        max-width: 100% !important;
    }
    
    img[style*="height: 65px"],
    img[style*="height: 100px"] {
        height: 50px !important;
        width: auto !important;
    }
}

/* ===== MOBILE TABLES & LISTS ===== */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    ul,
    ol {
        padding-left: 1.5rem;
    }
}

/* ===== MOBILE SOCIAL MEDIA LINKS ===== */
@media (max-width: 768px) {
    .social-links {
        flex-wrap: wrap;
        gap: 0.75rem !important;
    }
    
    .social-link {
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    /* Inline styled social links */
    div[style*="display: flex"][style*="gap: 1rem"] a[style*="width: 40px"] {
        width: 44px !important;
        height: 44px !important;
    }
}

/* ===== MOBILE VOLUNTEER OPPORTUNITIES ===== */
@media (max-width: 768px) {
    .opportunities-grid,
    .requirements-list {
        grid-template-columns: 1fr !important;
    }
    
    .opportunity-card,
    .requirement-item {
        padding: 1.25rem !important;
    }
}

/* ===== MOBILE MAP EMBEDS ===== */
@media (max-width: 768px) {
    iframe[style*="height: 400"] {
        height: 300px !important;
    }
    
    div[style*="height: 400px"] {
        height: 300px !important;
    }
}

/* ===== MOBILE SCROLL TO TOP BUTTON ===== */
@media (max-width: 768px) {
    .back-to-top,
    .scroll-to-top,
    button[style*="position: fixed"][style*="bottom"] {
        bottom: 20px !important;
        right: 20px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 1.25rem !important;
    }
}

/* ===== FIX FOR INLINE STYLED ELEMENTS ===== */
@media (max-width: 768px) {
    /* Override aggressive inline styles */
    div[style*="display: grid"][style*="gap: 3rem"] {
        gap: 2rem !important;
    }
    
    div[style*="padding: 2rem"] {
        padding: 1.5rem !important;
    }
    
    div[style*="padding: 3rem"] {
        padding: 2rem !important;
    }
}

@media (max-width: 480px) {
    div[style*="padding: 2rem"],
    div[style*="padding: 1.5rem"] {
        padding: 1rem !important;
    }
}

/* ===== TOUCH TARGET SIZES (Accessibility) ===== */
@media (max-width: 768px) {
    button,
    a,
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn {
        padding: 0.875rem 1.5rem !important;
    }
}

/* ===== PREVENT HORIZONTAL SCROLL ===== */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .container,
    section,
    div {
        max-width: 100%;
        overflow-x: hidden;
    }
}
