/* Additional Mobile Optimizations */

/* Enhanced Mobile Navigation */
@media (max-width: 768px) {
    /* 确保移动端 header 保持 sticky */
    .header {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    .nav-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-menu.active {
        max-height: 400px;
    }
}

/* Mobile-First Hero Section */
@media (max-width: 480px) {
    /* 确保小屏幕移动端 header 也保持 sticky */
    .header {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
    }
    
    .hero {
        min-height: 80vh;
        padding: 2rem 0;
    }
    
    .hero-content {
        padding-top: 2rem;
    }
    
    .hero-features {
        grid-template-columns: 1fr;
        max-width: 320px;
        margin: 0 auto 2rem;
        gap: 0.75rem;
    }
    
    .feature {
        padding: 1rem;
        font-size: 0.9rem;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(10px);
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left;
    }

    .feature-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
        flex-shrink: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .feature-icon svg {
        width: 24px;
        height: 24px;
        fill: white;
    }

    .hero-cta {
        align-items: stretch;
        max-width: 320px;
        margin: 0 auto;
    }

    .hero-phone {
        text-align: center;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 12px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .phone-number {
        color: #dc2626;
        font-weight: bold;
        font-size: 1.25rem;
    }
}

/* Touch-Friendly Buttons */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .contact-item a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Improved Form Experience on Mobile */
@media (max-width: 768px) {
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 1rem;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
    /* Reduce box-shadows for better performance */
    .product-card,
    .advantage-card,
    .app-card {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }
    
    .product-card:hover,
    .app-card:hover {
        transform: none; /* Disable hover transforms on mobile */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    }
    
    /* Simplify gradients for mobile */
    .hero {
        background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    }
    
    .advantages {
        background: #1e293b;
    }

    /* Better spacing for mobile sections */
    section {
        padding: 2.5rem 0;
    }

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

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        border: 2px solid #fff;
    }
    
    .nav-link:hover,
    .nav-link.active {
        background-color: #000;
        color: #fff;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* This can be uncommented if dark mode is desired */
    /*
    body {
        background-color: #1a1a1a;
        color: #e5e5e5;
    }
    
    .header {
        background: rgba(26, 26, 26, 0.95);
    }
    
    .product-card,
    .contact-form {
        background: #2a2a2a;
        color: #e5e5e5;
    }
    */
}

/* Print Styles */
@media print {
    .header,
    .nav-toggle,
    .btn,
    .footer {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    .hero {
        background: #fff !important;
        min-height: auto;
        padding: 1rem 0;
    }
    
    .section-title {
        font-size: 18pt;
        margin-bottom: 0.5rem;
    }
    
    .contact-item a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .phone-number {
        color: #000 !important;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus Styles for Accessibility */
.btn:focus,
.form-input:focus,
.nav-link:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Skip to Content Link for Screen Readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #2563eb;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10001;
}

.skip-link:focus {
    top: 6px;
}

/* Error States */
.form-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Success States */
.form-input.success {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Mobile Landscape Optimization */
@media (max-width: 896px) and (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: 100vh;
        padding: 1rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-features {
        margin-bottom: 1.5rem;
    }
}

/* Very Small Screens */
@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .product-grid,
    .advantages-grid,
    .applications-grid {
        gap: 1rem;
    }
    
    .feature {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}
