/* Mobile-specific styles */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 30px 0;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main {
        padding: 20px 0;
    }
    
    /* Form styles */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 5px;
        display: block;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        border: 1px solid #ddd;
        border-radius: 4px;
        min-height: 44px; /* Ensure minimum touch target size */
    }
    
    .form-group textarea {
        min-height: 100px;
    }
    
    /* Button styles */
    .btn {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        margin-bottom: 10px;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn-block {
        width: 100%;
    }
    
    /* Pricing cards */
    .pricing-cards {
        flex-direction: column;
        gap: 20px;
    }
    
    .pricing-card {
        width: 100%;
        margin: 0;
    }
    
    /* Workspace layout */
    .workspace-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .user-info-panel,
    .content-creation-area,
    .template-library,
    .history-section {
        width: 100%;
    }
    
    /* Dashboard layout */
    .dashboard-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .user-info,
    .usage-stats,
    .quick-actions,
    .history-section {
        width: 100%;
    }
    
    .stats-grid,
    .actions-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card,
    .action-card {
        width: 100%;
    }
    
    /* Result container */
    .result-container {
        padding: 15px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .result-actions .btn {
        width: 100%;
    }
    
    /* History list */
    .history-list {
        max-height: 300px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .history-item {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    /* Progress bar */
    .progress-bar {
        height: 8px;
    }
    
    .progress-fill {
        height: 8px;
    }
    
    /* Template library */
    .templates-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .template-card {
        width: 100%;
    }
    
    /* Navigation menu */
    .navbar-menu {
        position: fixed;
        top: 60px;
        right: 0;
        background: white;
        width: 100%;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .navbar-menu.active {
        transform: translateX(0);
    }
    
    .navbar-menu a,
    .navbar-login,
    .navbar-register {
        display: block;
        margin: 10px 0;
        text-align: center;
        padding: 12px;
        min-height: 44px; /* Ensure minimum touch target size */
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .navbar-user {
        margin-top: 20px;
        border-top: 1px solid #eee;
        padding-top: 20px;
    }
    
    /* Dropdown menu for mobile */
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        margin-top: 10px;
        width: 100%;
    }
    
    .dropdown-menu.show {
        display: block;
    }
    
    /* Features grid */
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    /* Industries list */
    .industries-list {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .industry-tag {
        margin: 5px;
        padding: 8px 16px; /* Ensure readable size on small screens */
    }
    
    /* Testimonials */
    .testimonial-card {
        padding: 20px;
    }
    
    .testimonial-card:before {
        font-size: 3rem;
        top: 15px;
        left: 15px;
    }
    
    /* CTA section */
    .wechat-contact {
        gap: 20px;
        flex-direction: column;
        align-items: center;
    }
    
    .wechat-qr {
        width: 120px;
        height: 120px;
        font-size: 0.8rem;
    }
    
    /* Ensure proper spacing for all sections */
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    /* Footer adjustments */
    .footer {
        padding: 20px 0;
    }
    
    /* Prevent horizontal scrolling */
    body {
        overflow-x: hidden;
    }
    
    /* Ensure images are responsive */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 44px;
    }
    
    /* Prevent zoom on input focus */
    input[type="email"],
    input[type="password"],
    input[type="text"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px;
    }
    
    /* Improve touch targets */
    a,
    button,
    .btn,
    .nav-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Ensure proper tap feedback */
    a:active,
    button:active,
    .btn:active {
        opacity: 0.7;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    html {
        height: -webkit-fill-available;
    }
    
    body {
        height: -webkit-fill-available;
    }
    
    /* Fix input issues on iOS */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea {
        -webkit-appearance: none;
        -webkit-border-radius: 0;
    }
    
    /* Fix 100vh issue on iOS */
    .navbar {
        position: -webkit-sticky;
    }
}

/* Android Chrome specific fixes */
@supports (-webkit-appearance: none) {
    /* Additional touch target sizing */
    button,
    .btn {
        touch-action: manipulation;
    }
    
    /* Fix viewport issues on Android */
    html {
        height: 100%;
        overflow-x: hidden;
    }
}

/* Very small screens (320px and below) */
@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 10px;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .feature-icon {
        font-size: 2rem;
    }
    
    .feature-card h3 {
        font-size: 1.1rem;
    }
    
    .pricing-header h3 {
        font-size: 1.3rem;
    }
    
    .price {
        font-size: 2rem;
    }
    
    .wechat-qr {
        width: 100px;
        height: 100px;
    }
    
    /* Ensure form elements are usable */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 16px;
    }
    
    /* Adjust spacing for very small screens */
    .main {
        padding: 15px 0;
    }
    
    .section-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
}