/* 移动端优化CSS - 专门解决手机页面体验问题 */

/* 基础移动端调整 */
@media (max-width: 768px) {
    /* 1. 修复导航栏 */
    .nav-modern {
        padding: 0.75rem 1rem;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    .nav-actions {
        position: absolute;
        top: 0.75rem;
        right: 1rem;
    }
    
    /* 2. 修复英雄区域 */
    .hero-modern {
        min-height: 70vh;
        padding: 2rem 1rem;
    }
    
    .hero-title-modern {
        font-size: 2.2rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle-modern {
        font-size: 1.1rem !important;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }
    
    .search-demo-modern {
        padding: 1rem;
        margin: 0 0.5rem;
    }
    
    .search-input-modern {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .search-examples-modern {
        gap: 0.5rem;
    }
    
    .search-example-modern {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* 3. 修复功能卡片 */
    .features-grid-modern {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        margin-top: 1.5rem;
    }
    
    .feature-card-modern {
        padding: 1.25rem;
        margin: 0 0.5rem;
    }
    
    .feature-icon-modern {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .feature-title-modern {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .feature-desc-modern {
        font-size: 0.95rem;
        line-height: 1.5;
    }
    
    /* 4. 修复统计展示 */
    .stats-modern {
        flex-direction: column;
        gap: 1rem;
        margin: 1.5rem 0;
    }
    
    .stat-card-modern {
        min-width: 100% !important;
        padding: 1rem;
        margin: 0 0.5rem;
    }
    
    .stat-number-modern {
        font-size: 2rem !important;
        margin-bottom: 0.5rem;
    }
    
    .stat-label-modern {
        font-size: 0.9rem;
    }
    
    /* 5. 修复页脚 */
    .footer-modern {
        padding: 2rem 1rem;
    }
    
    .footer-links-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
    
    .footer-column {
        text-align: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    /* 6. 通用修复 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
    }
    
    .section-title {
        font-size: 1.75rem !important;
        line-height: 1.2;
    }
    
    .section-subtitle {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* 7. 按钮调整 */
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    /* 更激进的调整 */
    .hero-title-modern {
        font-size: 1.8rem !important;
    }
    
    .hero-subtitle-modern {
        font-size: 1rem !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
    }
    
    .nav-links {
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .search-input-modern {
        font-size: 0.95rem;
        padding: 0.625rem;
    }
    
    .feature-card-modern {
        padding: 1rem;
    }
    
    .feature-title-modern {
        font-size: 1.1rem;
    }
    
    .feature-desc-modern {
        font-size: 0.9rem;
    }
    
    /* 防止文字溢出 */
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* 改善触摸体验 */
    button, 
    .btn,
    .nav-link,
    .search-example-modern {
        min-height: 44px; /* 苹果推荐的最小触摸目标尺寸 */
        min-width: 44px;
    }
    
    /* 改善滚动体验 */
    html {
        -webkit-overflow-scrolling: touch;
    }
    
    /* 防止缩放问题 */
    input, 
    textarea, 
    select {
        font-size: 16px !important; /* 防止iOS自动缩放 */
    }
}

/* 平板设备优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .features-grid-modern {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .hero-title-modern {
        font-size: 3rem;
    }
    
    .hero-subtitle-modern {
        font-size: 1.25rem;
    }
}

/* 修复常见移动端问题 */
/* 1. 防止水平滚动 */
body {
    max-width: 100%;
    overflow-x: hidden;
}

/* 2. 改善图片显示 */
img {
    max-width: 100%;
    height: auto;
}

/* 3. 改善表单元素 */
input, 
textarea, 
select {
    font-size: 16px; /* 防止iOS自动缩放 */
}

/* 4. 改善触摸反馈 */
.touch-feedback {
    transition: transform 0.1s ease, opacity 0.1s ease;
}

.touch-feedback:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* 5. 移动端专用类 */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none !important;
    }
}

/* 6. 改善移动端导航体验 */
@media (max-width: 768px) {
    .nav-modern {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--color-surface);
        box-shadow: var(--shadow-sm);
    }
    
    /* 移动端汉堡菜单（如果需要） */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--color-text-primary);
        cursor: pointer;
        padding: 0.5rem;
    }
    
    .nav-links.collapsed {
        display: none;
    }
    
    .nav-links.expanded {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-surface);
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        z-index: 999;
    }
}

/* 7. 改善移动端阅读体验 */
@media (max-width: 768px) {
    body {
        line-height: 1.6;
    }
    
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.3;
    }
    
    p {
        margin-bottom: 1rem;
    }
}

/* 8. 改善移动端加载性能 */
@media (max-width: 768px) {
    /* 延迟加载非关键资源 */
    .lazy-load {
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .lazy-load.loaded {
        opacity: 1;
    }
}