/* === 全局移动端优化 === */
*, *::before, *::after { box-sizing: border-box; }

/* 图片自适应 */
img { max-width: 100%; height: auto; }

/* 表格横向滚动 */
table { max-width: 100%; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 容器宽度自适应 */
.container, .wrapper, .content, .main, section, article { max-width: 100% !important; width: 100% !important; }

/* 768px以下移动端优化 */
@media (max-width: 768px) {
    html { font-size: 14px; }
    body { overflow-x: hidden; }
    
    /* 标题字体缩小 */
    h1 { font-size: 1.6rem !important; line-height: 1.3 !important; }
    h2 { font-size: 1.4rem !important; line-height: 1.3 !important; }
    h3 { font-size: 1.2rem !important; }
    h4 { font-size: 1.1rem !important; }
    
    /* 大标题特殊处理（超过40px的） */
    [style*="font-size: 4"], [style*="font-size: 5"], [style*="font-size: 6"], [style*="font-size: 7"], [style*="font-size: 8"] {
        font-size: 1.8rem !important;
    }
    
    /* 导航栏优化 */
    .top-nav, nav, .nav, .navbar {
        padding: 0 15px !important;
        flex-wrap: wrap;
        height: auto !important;
        min-height: 50px;
    }
    .top-nav .nav-links, nav .nav-links, .nav-links {
        flex-wrap: wrap;
        gap: 2px !important;
    }
    .top-nav .nav-links a, .nav-links a {
        padding: 6px 10px !important;
        font-size: 13px !important;
    }
    
    /* 卡片/网格布局改为单列 */
    .card, .cards, .grid, .grid-2, .grid-3, .grid-4, .features, .feature-grid, .pricing-cards, .stats-grid {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
    }
    
    /* 内边距调整 */
    .container, .wrapper, .content {
        padding: 15px !important;
    }
    
    /* 页面头部 */
    .page-header, .hero, .banner {
        padding: 30px 15px !important;
    }
    .page-header h1, .hero h1 {
        font-size: 1.5rem !important;
    }
    
    /* 文章内容 */
    .article-content, .blog-content, .post-content {
        padding: 20px 15px !important;
    }
    
    /* 按钮 */
    .btn, button, input[type="submit"], input[type="button"] {
        width: 100%;
        max-width: 100%;
        padding: 12px 20px !important;
        font-size: 15px !important;
    }
    
    /* 表单 */
    input, select, textarea {
        font-size: 16px !important; /* 防止iOS缩放 */
        max-width: 100%;
    }
    .form-group, .form-row {
        flex-direction: column !important;
    }
    
    /* 表格 */
    table { font-size: 13px; }
    th, td { padding: 8px 6px !important; }
    
    /* 页脚 */
    footer, .footer {
        padding: 20px 15px !important;
        text-align: center;
    }
    
    /* 隐藏非关键元素 */
    .hide-mobile, .desktop-only { display: none !important; }
    
    /* Tab导航 */
    .tabs, .tab-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .tab, .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* 480px以下小屏优化 */
@media (max-width: 480px) {
    html { font-size: 13px; }
    h1 { font-size: 1.4rem !important; }
    h2 { font-size: 1.25rem !important; }
    .article-card, .card { padding: 15px !important; }
    .cta-box { padding: 20px 15px !important; }
    .cta-box .phone { font-size: 1.3rem !important; }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    h1 { font-size: 1.4rem !important; }
    .hero, .page-header { padding: 20px 15px !important; }
}
