/* Mobile Responsive Styles for Healing Streams Crusades */

/* Tablet and Mobile Devices */
@media (max-width: 768px) {
    /* Critical overflow fixes for mobile */
    * {
        max-width: 100vw !important;
        position: relative;
    }

    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    #sponsorModal,
    #registerModal {
        max-width: 100vw !important;
    }

    /* Force sponsor button to stay in viewport */
    .sponsor-widget {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        left: auto !important;
        z-index: 998 !important;
        max-width: fit-content !important;
    }

    /* Navigation */
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 2rem;
        box-shadow: 0 5px 20px rgba(0,0,0,0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
        max-width: 100% !important;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-links a {
        padding: 1rem 0;
        border-bottom: 1px solid #eee;
        width: 100%;
        text-align: center;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .sponsor-nav-btn {
        margin-top: 1rem;
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Hero Section Mobile */
    .hero {
        padding: 80px 15px 40px;
        min-height: auto;
    }

    .hero-badge {
        font-size: 0.8rem;
        padding: 0.4rem 1.2rem;
    }

    .hero h1 {
        font-size: 2rem;
        font-weight: 900;
        color: white;
        background: none;
        -webkit-text-fill-color: white;
        text-shadow: 2px 3px 6px rgba(0,0,0,0.5);
        margin-bottom: 1rem;
    }

    .hero .subtitle {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    .hero p {
        font-size: 0.95rem;
        padding: 0 10px;
        line-height: 1.6;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        padding: 0;
        gap: 0.8rem;
        align-items: center;
    }

    .btn-primary, .btn-secondary {
        width: 90%;
        max-width: 300px;
        text-align: center;
        padding: 0.9rem 2rem;
        font-size: 1rem;
    }

    /* Section Headers */
    .section-header h2 {
        font-size: 1.75rem;
    }

    .section-header p {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .section-badge {
        font-size: 0.8rem;
        padding: 0.4rem 1.5rem;
    }

    /* Timeline Mobile */
    .timeline-item {
        grid-template-columns: auto 1fr;
        gap: 1rem;
    }

    .timeline-content.left {
        text-align: left;
        grid-column: 2;
    }

    .timeline-content.right {
        grid-column: 2;
    }

    .timeline-dot {
        width: 30px;
        height: 30px;
    }

    .timeline-content {
        padding: 1.5rem;
    }

    .timeline-content h3 {
        font-size: 1.3rem;
    }

    /* Categories Section */
    .categories-section::before {
        font-size: 5rem;
        opacity: 0.03;
    }

    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .category-card {
        padding: 1.8rem;
    }

    .category-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .category-card h3 {
        font-size: 1.5rem;
    }

    /* Mobile Sponsor Widget - Fixed Position */
    .sponsor-button {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
        white-space: nowrap;
        box-shadow: 0 3px 15px rgba(247, 179, 43, 0.4);
    }

    .sponsor-button i {
        font-size: 0.9rem;
    }

    /* Mobile Sponsor Modal */
    .sponsor-modal {
        padding: 0;
        align-items: center;
        justify-content: center;
    }

    .sponsor-modal.active {
        display: flex;
    }

    .sponsor-content {
        padding: 2rem 1.5rem;
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
        width: 100%;
        max-width: 100%;
        margin: auto 0 0 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    .sponsor-content h3 {
        font-size: 1.4rem;
        margin-bottom: 0.8rem;
    }

    .sponsor-content p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .sponsor-form {
        gap: 1.2rem;
    }

    .form-section-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    /* Fix form inputs */
    .form-group label {
        font-size: 0.85rem;
        font-weight: 600;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important;
        padding: 0.8rem;
    }

    /* Mobile Stats */
    .stats-section {
        margin-top: -30px;
        padding: 3rem 1rem;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .stat-card {
        padding: 1.5rem 1rem;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .stat-icon {
        font-size: 2.5rem;
    }

    .stat-label {
        font-size: 0.9rem;
    }

    /* Mobile Impact Gallery */
    .impact-gallery {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .impact-card {
        height: 280px;
    }

    .impact-content h3 {
        font-size: 1.5rem;
    }

    .country-flag {
        font-size: 2.5rem;
    }

    .impact-cta {
        padding: 2rem;
    }

    .impact-cta h3 {
        font-size: 2rem;
    }

    .impact-cta p {
        font-size: 1rem;
    }

    /* Mobile Groups */
    .groups-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .group-card {
        padding: 2rem 1.5rem;
    }

    .group-card h3 {
        font-size: 1.3rem;
    }

    .group-list li {
        font-size: 0.95rem;
        padding: 0.6rem 0;
    }

    /* Mobile Footer */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .social-links {
        justify-content: center;
    }

    .footer-section h4 {
        font-size: 1.1rem;
    }

    /* Mobile Navigation Adjustments */
    .logo-text {
        font-size: 1rem;
    }

    .logo-text span {
        font-size: 0.65rem;
    }

    .nav-container {
        padding: 0.8rem 1rem;
    }

    /* Mobile Section Padding */
    section {
        padding: 3rem 1rem !important;
    }

    .vision-section,
    .categories-section,
    .impact-section,
    .groups-section {
        padding: 3rem 1rem !important;
    }

    /* Mobile CTA Section */
    .cta-section {
        padding: 3rem 1rem !important;
    }

    .cta-content {
        padding: 0;
    }

    .cta-section h2 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .cta-section p {
        font-size: 1rem;
        padding: 0 0.5rem;
        margin-bottom: 1.5rem;
    }

    /* Form Adjustments */
    .close-modal {
        top: 10px;
        right: 10px;
        font-size: 1.2rem;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0,0,0,0.08);
        border-radius: 50%;
    }

    .submit-btn {
        padding: 1rem;
        font-size: 1rem;
    }

    /* Fix any overflow issues */
    .hero-content,
    .vision-container,
    .container {
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Ensure images don't overflow */
    img {
        max-width: 100% !important;
        height: auto;
    }

    /* Fix button animations on mobile */
    .sponsor-button:hover {
        transform: none;
    }

    .category-card:hover {
        transform: translateY(-5px);
    }

    /* Adjust reveal animations for mobile */
    .reveal,
    .reveal-left,
    .reveal-right {
        transform: translateY(20px) !important;
    }

    .reveal.active,
    .reveal-left.active,
    .reveal-right.active {
        transform: translateY(0) !important;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    /* Extra small devices */
    .hero h1 {
        font-size: 1.6rem;
        line-height: 1.2;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 0.4rem 1rem;
        margin-bottom: 1.5rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .btn-primary, .btn-secondary {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .section-badge {
        font-size: 0.75rem;
        padding: 0.4rem 1.2rem;
    }

    /* Stats on very small screens */
    .stats-container {
        grid-template-columns: 1fr;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-icon {
        font-size: 2rem;
    }

    .categories-section::before {
        display: none;
    }

    .category-card {
        padding: 1.5rem;
    }

    .category-icon {
        font-size: 2rem;
    }

    .category-card h3 {
        font-size: 1.3rem;
    }

    .impact-card {
        height: 240px;
    }

    .country-flag {
        font-size: 2rem;
    }

    .impact-content h3 {
        font-size: 1.3rem;
    }

    .impact-content p {
        font-size: 0.9rem;
    }

    /* Smaller sponsor button on very small screens */
    .sponsor-widget {
        bottom: 15px;
        right: 15px;
    }

    .sponsor-button {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }

    .sponsor-button i {
        font-size: 0.85rem;
    }

    /* Adjust modal for very small screens */
    .sponsor-content {
        padding: 1.5rem 1rem;
    }

    .sponsor-content h3 {
        font-size: 1.2rem;
    }

    .form-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }

    /* Timeline adjustments */
    .timeline-content {
        padding: 1.2rem;
    }

    .timeline-content h3 {
        font-size: 1.1rem;
    }

    .timeline-content p {
        font-size: 0.9rem;
    }

    .timeline-dot {
        width: 25px;
        height: 25px;
    }

    /* Groups adjustments */
    .group-card {
        padding: 1.5rem 1rem;
    }

    .group-card h3 {
        font-size: 1.2rem;
    }

    .group-list li {
        font-size: 0.9rem;
    }

    /* CTA adjustments */
    .cta-section h2 {
        font-size: 1.5rem;
    }

    .cta-section p {
        font-size: 0.95rem;
    }

    /* Footer adjustments */
    .footer-section {
        margin-bottom: 1.5rem;
    }

    .footer-section h4 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .footer-section ul li {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
}

/* Very Small Devices (320px and below) */
@media (max-width: 320px) {
    .hero h1 {
        font-size: 1.4rem;
    }

    .sponsor-button {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }

    .btn-primary, .btn-secondary {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific styles */
    .sponsor-modal {
        -webkit-overflow-scrolling: touch;
    }

    .hero h1 {
        -webkit-text-fill-color: white !important;
        color: white !important;
    }

    /* Fix for iOS input zoom */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }

    /* Fix for iOS modal scrolling */
    .sponsor-content {
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
    }

    /* Fix for iOS button styles */
    .btn-primary,
    .btn-secondary,
    .submit-btn,
    .sponsor-button {
        -webkit-appearance: none;
    }
}

/* Landscape orientation fixes */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 60px 20px 30px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero-badge {
        margin-bottom: 1rem;
    }

    .hero p {
        margin-bottom: 1rem;
    }

    .sponsor-content {
        max-height: 90vh;
    }
}