/**
 * Mobile-First Page Optimization CSS
 * Phase 4: Enhanced mobile experience across all MVP templates
 * Fay EdTech - December 3, 2025
 */

/* ==========================================================================
   Phase 4: Mobile-First Optimizations
   ========================================================================== */

/* Touch-friendly sizing and spacing improvements */
@media (max-width: 768px) {
    
    /* Global mobile optimizations */
    body {
        /* Improve text rendering on mobile */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        /* Prevent horizontal scroll */
        overflow-x: hidden;
    }

    /* Enhanced container spacing for mobile */
    .container {
        padding: 1rem;
        max-width: 100%;
    }

    /* ==========================================================================
       Contact Page Mobile Optimization
       ========================================================================== */
    
    /* Contact hero section mobile improvements */
    .contact-hero {
        text-align: center;
        padding: 2rem 0;
        margin-bottom: 2rem;
    }

    .contact-hero h2 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
        color: #2C3E50;
    }

    .contact-hero p {
        font-size: 1.1rem;
        line-height: 1.6;
        color: #666;
        max-width: 90%;
        margin: 0 auto;
    }

    /* Contact grid mobile-first layout */
    .contact-grid {
        display: flex;
        flex-direction: column;
        gap: 2.5rem;
    }

    /* Form section mobile optimization */
    .contact-form-section {
        order: 1;
    }

    .contact-info-section {
        order: 2;
    }

    /* Enhanced mobile form styling */
    .contact-form {
        background: white;
        border-radius: 16px;
        padding: 2rem;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .form-group {
        margin-bottom: 1.5rem;
    }

    .form-group label {
        display: block;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: #2C3E50;
        font-size: 1rem;
    }

    /* Touch-optimized form inputs */
    .form-group input,
    .form-group textarea,
    .form-group select {
        width: 100%;
        font-size: 16px !important; /* Prevent iOS zoom */
        line-height: 1.5;
        padding: 14px 16px;
        border: 2px solid #e1e5e9;
        border-radius: 12px;
        background: #f8f9fa;
        transition: all 0.3s ease;
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
        /* Touch target minimum size */
        min-height: 48px;
    }

    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        outline: none;
        border-color: #F38E20;
        background: white;
        box-shadow: 0 0 0 3px rgba(243, 142, 32, 0.1);
        transform: translateY(-1px);
    }

    /* Textarea specific mobile styling */
    .form-group textarea {
        resize: vertical;
        min-height: 120px;
        font-family: inherit;
    }

    /* Select dropdown mobile optimization */
    .form-group select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 12px center;
        background-repeat: no-repeat;
        background-size: 16px;
        padding-right: 40px;
    }

    /* Enhanced submit button for mobile */
    .submit-btn,
    .contact-form button[type="submit"] {
        width: 100%;
        font-size: 1.1rem;
        font-weight: 600;
        padding: 16px 24px;
        min-height: 56px;
        background: linear-gradient(135deg, #F38E20 0%, #D42027 100%);
        color: white;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(243, 142, 32, 0.3);
        margin-top: 1rem;
        /* Touch feedback */
        -webkit-tap-highlight-color: rgba(243, 142, 32, 0.2);
    }

    .submit-btn:hover,
    .contact-form button[type="submit"]:hover,
    .submit-btn:active,
    .contact-form button[type="submit"]:active {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(243, 142, 32, 0.4);
    }

    /* Contact info section mobile styling */
    .contact-info-section {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-radius: 16px;
        padding: 2rem;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .contact-item {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .contact-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .contact-item h4 {
        font-size: 1.1rem;
        font-weight: 600;
        color: #2C3E50;
        margin-bottom: 0.5rem;
    }

    .contact-item p {
        color: #666;
        line-height: 1.6;
        margin: 0;
    }

    .contact-item a {
        color: #F38E20;
        text-decoration: none;
        font-weight: 500;
    }

    .contact-item a:hover {
        text-decoration: underline;
    }

    /* ==========================================================================
       Universal Mobile Button Optimizations
       ========================================================================== */
    
    /* Touch-friendly button sizing across all pages */
    button,
    .btn,
    input[type="button"],
    input[type="submit"],
    .nav-link,
    .cta-button {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 20px;
        font-size: 16px;
        touch-action: manipulation;
    }

    /* ==========================================================================
       Typography Mobile Improvements
       ========================================================================== */
    
    /* Mobile-optimized headings */
    h1 {
        font-size: 2.5rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    h2 {
        font-size: 2rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    h3 {
        font-size: 1.5rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }

    /* Improved paragraph spacing */
    p {
        line-height: 1.6;
        margin-bottom: 1rem;
        max-width: 100%;
    }

    /* ==========================================================================
       Card and Content Mobile Optimization
       ========================================================================== */
    
    /* Mobile-first card layouts */
    .card,
    .feature-card,
    .service-card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
        overflow: hidden;
    }

    /* Grid layouts mobile optimization */
    .grid,
    .features-grid,
    .services-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* ==========================================================================
       Navigation Mobile Improvements (beyond hamburger)
       ========================================================================== */
    
    /* Hide desktop navigation on mobile */
    .main-nav {
        display: none;
    }

    /* Mobile header improvements */
    .main-header {
        padding: 1rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .site-title {
        font-size: 1.5rem;
    }

    /* ==========================================================================
       Footer Mobile Optimization
       ========================================================================== */
    
    /* Mobile-friendly footer */
    .footer {
        padding: 2rem 1rem;
    }

    .footer-container {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    /* ==========================================================================
       Performance and UX Improvements
       ========================================================================== */
    
    /* Smooth scrolling for mobile */
    html {
        scroll-behavior: smooth;
    }

    /* Reduce motion for accessibility */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }

    /* Focus improvements for accessibility */
    *:focus {
        outline: 2px solid #F38E20;
        outline-offset: 2px;
    }

    /* ==========================================================================
       iOS Safari Specific Fixes
       ========================================================================== */
    
    /* Fix iOS viewport issues */
    body {
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent iOS zoom on form focus */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Fix iOS button appearance */
    button,
    input[type="submit"],
    input[type="button"] {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 12px;
    }
}

/* ==========================================================================
   Tablet Optimizations (768px to 1024px)
   ========================================================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .contact-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: start;
    }

    .container {
        padding: 2rem;
    }
}

/* ==========================================================================
   Large Mobile Optimizations (480px to 768px)
   ========================================================================== */

@media (min-width: 480px) and (max-width: 768px) {
    .contact-hero h2 {
        font-size: 2.5rem;
    }

    .contact-form {
        padding: 2.5rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 16px 20px;
        min-height: 52px;
    }
}

/* ==========================================================================
   Very Small Mobile (below 480px)
   ========================================================================== */

@media (max-width: 479px) {
    .contact-hero h2 {
        font-size: 1.75rem;
    }

    .contact-form {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }

    .contact-info-section {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }

    .container {
        padding: 0.5rem;
    }
}