/**
 * 移动端样式修复和优化
 * Mobile Responsive Fixes
 * 解决所有页面的移动端兼容性问题
 */

/* ========================================
   全局移动端优化
   ======================================== */

/* 防止水平滚动 */
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* 确保所有容器不超出屏幕 */
.container {
    padding-left: 15px;
    padding-right: 15px;
}

/* 优化触摸目标大小 */
a, button, .nav-link, .quote-btn, .action-btn, .cta-btn, .read-more-btn {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* 优化字体大小 - 移动端可读性 */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* ========================================
   导航栏移动端优化
   ======================================== */
@media (max-width: 768px) {
    .nav-container {
        padding: 12px 15px;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .logo-name {
        font-size: 1.1rem;
    }
    
    .logo-tagline {
        display: none;
    }
    
    /* 汉堡菜单优化 */
    .hamburger {
        padding: 10px;
    }
    
    .hamburger span {
        width: 28px;
        height: 3px;
    }
    
    /* 移动菜单优化 */
    .nav-menu {
        padding: 20px;
    }
    
    .nav-menu li {
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-link {
        display: block;
        padding: 15px 20px;
        font-size: 1.05rem;
    }
    
    .quote-btn {
        display: none !important;
    }
}

/* ========================================
   Page Header 移动端优化（与 header-fixes.css 配合）
   ======================================== */
@media (max-width: 768px) {
    .page-header {
        padding: 80px 0 60px;
    }
    
    .page-header-content h1 {
        font-size: 2rem;
        padding: 0 15px;
    }
    
    .breadcrumb {
        flex-wrap: wrap;
        padding: 0 15px;
        font-size: 0.9rem;
    }
    
    .breadcrumb i {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 60px 0 50px;
    }
    
    .page-header-content h1 {
        font-size: 1.6rem;
    }
}

/* ========================================
   博客列表页移动端优化
   ======================================== */
@media (max-width: 1024px) {
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .blog-sidebar {
        position: static;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .blog-section {
        padding: 60px 0;
    }
    
    .blog-post-card {
        grid-template-columns: 1fr;
        margin-bottom: 30px;
    }
    
    .post-image {
        min-height: 200px;
    }
    
    .post-content {
        padding: 20px;
    }
    
    .post-title {
        font-size: 1.3rem;
    }
    
    .post-meta {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.85rem;
    }
    
    .post-footer {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .post-tags {
        flex-wrap: wrap;
    }
    
    /* 侧边栏优化 */
    .sidebar-widget {
        padding: 20px;
    }
    
    .widget-title {
        font-size: 1.15rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form button {
        width: 100%;
    }
}

/* ========================================
   博客详情页移动端优化
   ======================================== */
@media (max-width: 768px) {
    .blog-detail-section {
        padding: 40px 0;
    }
    
    .blog-detail-grid {
        gap: 30px;
    }
    
    .article-meta {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .meta-left {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .meta-share {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .article-content {
        padding: 20px;
    }
    
    .content-section h2 {
        font-size: 1.5rem;
        word-break: break-word;
    }
    
    .content-section h3 {
        font-size: 1.2rem;
        word-break: break-word;
    }
    
    .content-section p {
        font-size: 1rem;
    }
    
    /* 目录导航移动端优化 */
    .table-of-contents {
        margin-bottom: 20px;
    }
    
    .toc-toggle {
        display: flex !important;
        width: 100%;
        padding: 15px 20px;
        background: var(--bg-white);
        border: 2px solid var(--border-color);
        border-radius: var(--border-radius);
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 15px;
        transition: var(--transition);
    }
    
    .toc-toggle:hover {
        border-color: var(--primary-color);
    }
    
    .toc-toggle i:last-child {
        transition: transform 0.3s ease;
    }
    
    .toc-toggle.active i:last-child {
        transform: rotate(180deg);
    }
    
    .toc-nav {
        display: none;
    }
    
    .toc-nav.show {
        display: block;
        animation: slideDown 0.3s ease;
    }
    
    .toc-link {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    /* 表格优化 - 可滚动 */
    .comparison-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .comparison-table {
        min-width: 600px;
        font-size: 0.9rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 12px 15px;
    }
    
    /* 应用网格优化 */
    .application-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .app-card {
        padding: 20px;
    }
    
    /* 成本对比优化 */
    .cost-comparison {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .cost-item {
        padding: 20px;
    }
    
    /* 优缺点网格优化 */
    .pros-cons-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .pros-cons-card {
        padding: 20px;
    }
    
    /* CTA 盒子优化 */
    .cta-box {
        padding: 25px 20px;
    }
    
    .cta-box h3 {
        font-size: 1.4rem;
    }
    
    .cta-box p {
        font-size: 1rem;
    }
    
    .cta-btn-primary {
        width: 100%;
        text-align: center;
    }
    
    /* 作者框优化 */
    .author-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 25px 20px;
    }
    
    .author-avatar {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
    
    .author-info h4 {
        font-size: 1.15rem;
    }
    
    .author-social {
        justify-content: center;
    }
    
    /* 相关文章优化 */
    .related-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .related-card {
        padding: 20px;
    }
    
    /* 标签优化 */
    .article-tags {
        padding: 20px;
        flex-wrap: wrap;
    }
    
    .tag-link {
        font-size: 0.85rem;
        padding: 5px 12px;
    }
    
    /* 分享按钮优化 */
    .share-btn {
        width: 45px;
        height: 45px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   产品页面移动端优化
   ======================================== */
@media (max-width: 768px) {
    .products-categories-section {
        padding: 60px 0;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .product-category-card {
        margin-bottom: 25px;
    }
    
    .category-info {
        padding: 20px;
    }
    
    .category-features {
        padding: 15px;
    }
    
    .why-products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .why-product-item {
        padding: 25px 20px;
    }
    
    /* 产品详情页优化 */
    .product-main-section {
        padding: 40px 0;
    }
    
    .product-detail-grid {
        gap: 30px;
    }
    
    .product-gallery {
        position: static;
    }
    
    .image-placeholder-large {
        height: 300px;
    }
    
    .thumbnail-gallery {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .thumbnail {
        aspect-ratio: 1;
    }
    
    .product-title {
        font-size: 1.8rem;
    }
    
    .product-subtitle {
        font-size: 1rem;
    }
    
    .product-highlights {
        flex-direction: column;
        gap: 12px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .spec-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .spec-label {
        width: 100%;
    }
    
    /* Tabs 优化 */
    .tabs-header {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: 1px solid var(--border-color);
        padding: 15px 20px;
    }
    
    .tab-btn.active::after {
        display: none;
    }
    
    .tab-content {
        padding: 25px 20px;
    }
    
    .packaging-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ========================================
   首页移动端优化
   ======================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
        padding: 0 15px;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        padding: 0 15px;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 15px;
        padding: 0 15px;
    }
    
    .hero-btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero-features {
        margin: 0 15px;
        border-radius: 8px;
    }
    
    .hero-features .container {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .hero-feature-item {
        flex-direction: row;
        justify-content: center;
    }
    
    .hero-feature-item i {
        font-size: 1.5rem;
    }
    
    .hero-feature-item span {
        font-size: 0.9rem;
    }
    
    section {
        padding: 60px 0;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .about-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px 15px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .features-grid,
    .showcase-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .contact-content {
        gap: 40px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.6rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-features .container {
        grid-template-columns: 1fr;
    }
    
    .hero-section {
        /* 小屏幕保持统一间距 */
    }
    
    .about-stats {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 1.7rem;
    }
}

/* ========================================
   关于我们页面移动端优化
   ======================================== */
@media (max-width: 768px) {
    .who-content,
    .culture-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .who-image,
    .culture-image {
        order: -1;
    }
    
    .image-placeholder {
        height: 250px;
    }
    
    .capability-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .capability-card {
        padding: 25px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card-large {
        padding: 20px 15px;
    }
    
    .stat-card-large .stat-number {
        font-size: 2.2rem;
    }
    
    .culture-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    
    .culture-item-icon {
        width: 60px;
        height: 60px;
    }
    
    .certifications-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .cert-card {
        padding: 25px 20px;
    }
    
    .about-cta-section .cta-content h2 {
        font-size: 1.8rem;
    }
    
    .about-cta-section .cta-content p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .certifications-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   通用组件移动端优化
   ======================================== */
@media (max-width: 768px) {
    /* 按钮优化 */
    .cta-btn, .hero-btn, .submit-btn, .action-btn {
        width: 100%;
        max-width: 100%;
        justify-content: center;
    }
    
    /* 表格优化 */
    .specs-table,
    .comparison-table {
        font-size: 0.85rem;
    }
    
    .specs-table th,
    .specs-table td,
    .comparison-table th,
    .comparison-table td {
        padding: 10px 12px;
    }
    
    /* 卡片通用优化 */
    .product-card,
    .news-card,
    .feature-card,
    .application-card {
        margin-bottom: 20px;
    }
    
    /* 表单优化 */
    input, textarea, select {
        font-size: 16px !important; /* 防止 iOS 缩放 */
    }
    
    .contact-form input,
    .contact-form textarea,
    .contact-form select {
        padding: 14px 16px;
    }
    
    /* 图片优化 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 返回顶部按钮优化 */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

/* ========================================
   性能优化
   ======================================== */

/* 减少移动端动画，提升性能 */
@media (max-width: 768px) {
    * {
        animation-duration: 0.2s !important;
        transition-duration: 0.2s !important;
    }
    
    /* 禁用某些耗性能的动画 */
    .hero-slide,
    .parallax {
        animation: none !important;
    }
}

/* 横屏优化 */
@media (max-width: 896px) and (orientation: landscape) {
    .page-header {
        padding: 120px 0 60px;
    }
    
    .hero-section {
        min-height: 100vh;
    }
    
    .blog-post-card {
        grid-template-columns: 250px 1fr;
    }
}

/* ========================================
   iOS Safari 特殊优化
   ======================================== */

/* 修复 iOS 点击延迟 */
@media (max-width: 768px) {
    a, button, input, select, textarea {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 修复 iOS 输入框样式 */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        -webkit-appearance: none;
        border-radius: 8px;
    }
    
    /* 修复 iOS select 样式 */
    select {
        -webkit-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 40px;
    }
}

/* ========================================
   Android Chrome 特殊优化
   ======================================== */

/* 地址栏变化时的布局稳定 */
@supports (-webkit-appearance: none) {
    .page-header,
    .hero-section {
        min-height: -webkit-fill-available;
    }
}
