
/* Mobile UX Enhancements */

/* Ensure minimum touch target size (48x48px) */
@media (max-width: 768px) {
    /* Buttons and interactive elements */
    button, .btn, a.button, input[type="submit"], input[type="button"] {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 20px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Navigation links */
    .nav-menu a, .mobile-menu a {
        padding: 12px 16px;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    /* Form inputs */
    input[type="text"], input[type="email"], input[type="tel"], 
    input[type="password"], textarea, select {
        min-height: 48px;
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 4px;
        border: 2px solid #ddd;
    }
    
    /* Checkbox and radio buttons */
    input[type="checkbox"], input[type="radio"] {
        width: 24px;
        height: 24px;
        margin: 12px;
    }
    
    /* Links in content */
    .content a, article a {
        padding: 4px 0;
        margin: 0 -4px;
        display: inline-block;
    }
    
    /* Mobile-optimized spacing */
    .container {
        padding: 0 16px;
    }
    
    h1 { font-size: 28px; margin: 20px 0; }
    h2 { font-size: 24px; margin: 18px 0; }
    h3 { font-size: 20px; margin: 16px 0; }
    
    /* Improve readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    p {
        margin-bottom: 16px;
    }
    
    /* Mobile navigation styles */
    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        z-index: 1001;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-menu.active {
        left: 0;
    }
    
    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        display: none;
        z-index: 1000;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    /* Swipe gesture areas */
    .swipe-area {
        position: absolute;
        top: 0;
        width: 20px;
        height: 100%;
        z-index: 10;
    }
    
    .swipe-left {
        left: 0;
    }
    
    .swipe-right {
        right: 0;
    }
    
    /* Carousel touch optimization */
    .carousel {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .carousel::-webkit-scrollbar {
        display: none;
    }
    
    .carousel-item {
        scroll-snap-align: start;
        flex: 0 0 100%;
    }
    
    /* Form optimization */
    .form-group {
        margin-bottom: 20px;
    }
    
    label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
    }
    
    /* Error messages */
    .error-message {
        color: #d32f2f;
        font-size: 14px;
        margin-top: 4px;
    }
    
    /* Loading states */
    .btn.loading {
        position: relative;
        color: transparent;
    }
    
    .btn.loading::after {
        content: "";
        position: absolute;
        width: 16px;
        height: 16px;
        top: 50%;
        left: 50%;
        margin-left: -8px;
        margin-top: -8px;
        border: 2px solid #fff;
        border-radius: 50%;
        border-top-color: transparent;
        animation: spinner 0.8s linear infinite;
    }
    
    @keyframes spinner {
        to { transform: rotate(360deg); }
    }
    
    /* Sticky footer buttons */
    .mobile-cta-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 16px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 999;
        display: none;
    }
    
    .show-mobile-cta .mobile-cta-footer {
        display: block;
    }
    
    .show-mobile-cta {
        padding-bottom: 80px;
    }
    
    /* Table responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Card layout for mobile */
    .card-grid {
        display: block;
    }
    
    .card {
        margin-bottom: 16px;
        padding: 16px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 8px 16px;
    }
    
    .hero {
        padding: 60px 20px 40px;
    }
    
    h1 {
        font-size: 24px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    button, .btn {
        border: 2px solid currentColor;
    }
    
    input, textarea, select {
        border-width: 2px;
    }
}

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