/* 
* Mobile-Optimized Contact Form Styles
* Created to fix lag issues on mobile devices
* Date: May 2025
*/

/* Base optimizations for all devices */
.contact-form {
    transition: none; /* Remove transitions that could cause lag */
    will-change: auto; /* Only use will-change where absolutely necessary */
}

/* Optimize form inputs for better performance */
.form-group input,
.form-group select,
.form-group textarea {
    -webkit-appearance: none; /* Remove default styling that can cause lag */
    appearance: none;
    backface-visibility: hidden; /* Prevent unnecessary layer creation */
    transform: translateZ(0); /* Hardware acceleration for smoother rendering */
}

/* Optimize submit button */
.modern-btn {
    transform: translateZ(0); /* Hardware acceleration */
    backface-visibility: hidden;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* No loading animations */

/* Optimize form submission state */
.submitting .form-group input,
.submitting .form-group select,
.submitting .form-group textarea {
    pointer-events: none;
    opacity: 0.7;
}

/* Optimize form validation */
.error-message {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    color: #e74c3c;
    transform: translateZ(0);
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    /* Reduce padding to save space */
    .contact-form {
        padding: 20px;
    }
    
    /* Optimize form inputs for mobile */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px; /* Prevent iOS zoom */
        border-radius: 8px;
        box-shadow: none; /* Remove box-shadow for better performance */
    }
    
    /* Optimize submit button for mobile */
    .modern-btn {
        padding: 12px 20px;
        width: 100%;
        font-size: 16px;
        box-shadow: 0 4px 8px rgba(206, 17, 38, 0.2); /* Lighter shadow for better performance */
    }
    
    /* Disable hover effects on mobile for better performance */
    .modern-btn:hover {
        transform: none;
        box-shadow: 0 4px 8px rgba(206, 17, 38, 0.2);
    }
    
    /* Active state for touch feedback */
    .modern-btn:active {
        transform: translateY(1px);
        box-shadow: 0 2px 4px rgba(206, 17, 38, 0.2);
    }
    
    /* No loading animations for mobile */
    
    /* Optimize form messages for mobile */
    .form-message {
        padding: 12px;
        margin: 15px 0;
        border-radius: 8px;
    }
}

/* Small mobile optimizations */
@media (max-width: 480px) {
    .contact-form {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        margin-bottom: 5px;
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 10px;
    }
    
    .modern-btn {
        padding: 10px 16px;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    /* Disable all hover animations for touch devices */
    .modern-btn:hover,
    .form-group input:hover,
    .form-group select:hover,
    .form-group textarea:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Use active state for touch feedback */
    .modern-btn:active {
        background-color: var(--red-dark);
    }
    
    .form-group input:active,
    .form-group select:active,
    .form-group textarea:active {
        border-color: var(--primary);
    }
}

/* Optimize for reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    
    .modern-btn {
        transition: background-color 0.3s linear;
    }
    
    .modern-btn:hover,
    .modern-btn:active {
        transform: none;
    }
}
